471,607 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,607 software developers and data experts.

tool to fix non-conforming xml?

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.

Feb 5 '06 #1
2 1359
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.

Feb 5 '06 #2
"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].


[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: ht@markuptechnology.com
URL: http://www.markup.co.uk/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Feb 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by d.warnermurray | last post: by
2 posts views Thread by Christoph Wienands | last post: by
17 posts views Thread by clintonG | last post: by
158 posts views Thread by Giovanni Bajo | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.