tool to fix non-conforming xml?

P

Peter Rooney

hi all,

i'm working on a project where i'm marshalling xml files to java
objects created with JAXB 1.0 from an xsd schema. the problem is that
the marshalling fails (UnexpectedElementException) when it hits an
element that is not defined in the schema -- and the process that
produces the xml sometimes includes such elements. Upgrading to JAXB
2.0 is not an option, unfortunately.

so, my question: is there a tool, commercial or not, which fixes
non-conforming xml by supplying defaults for missing elements
and by stripping elements not defined in the schema?

thanks in advance for any help.
peter
 
G

guitar.is.good

Not an xml expert by far, but couldnt you develop a simple XSL
stylesheet / transform your input XML files to a verified output? I.e.
transform all given input xml files to your output defined by the
scheme, any elements not defined in the schema are simply igored in the
stylesheet / transformation process.
 
H

Henry S. Thompson

"Validate twice with surgery" is the informal name of a technique
which will do exactly what you are looking for.

There's a writeup of a talk about this from XML Europe 2004 available
[1], and a free demo of a pipeline-based implementation which you can
try with your own document and schema [2].

ht

[1] http://www.markup.co.uk/XMLEu2004/
[2] http://www.markup.co.uk/showcase/
--
Henry S. Thompson, Markup Technology Ltd.
4 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- +44 (0) 7866 471 388
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.markup.co.uk/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top