[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: validating xml

Re:  validating xml

Brian Shields wrote:

> Hi all,
> I have written a system in java that is automatically processing xml 
> files. I now need to put a filter in place that ensures the xml file i 
> recceive matches the schema file contained in my system. If there are 
> any discrepencies then the file should not be processed.
> Is anyone aware of such a tool?
Depends on whether you want to 1) reject the file if it does not comply 
with your schema or 2) re-form the file so that it matches your schema.

If #1, any validation against your schema and XML parser barf should do 
the trick.

If #2, one (contested!) approach is to just filter the elements that 
don't match your schema. In Jave 1.4, you can complile a regex to match 
only your markup and pass only that, plus PCDATA to your application. At 
this point, the demos of JITTs (Just-In-Time-Trees) use a filtering 
approach but we are closing in on more robust implementations.

The danger with #2 is that you may get some odd looking data to your 
application, depending on how far the submitted data varies from what 
you require. Depends on whether you are enforcing compliance to insure 
proper processing or enforcing compliance to insure proper submission. 
Similar but not exactly the same.


> Thanks in advance,
> Brian.
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Faith Hill <http://faith.yahoo.com> - Exclusive Performances, Videos, 
> & more
> faith.yahoo.com <http://faith.yahoo.com> 

Patrick Durusau
Director of Research and Development
Society of Biblical Literature


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.