OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] validating xml

[ Lists Home | Date Index | Thread Index ]


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS