xml-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Das, Kuntal" <Kuntal....@Schwab.com>
Subject RE: Validator for xml-schema & xml documents...
Date Fri, 01 Jun 2001 20:33:56 GMT
Thanks a lot for the information. Atleast I have something to work with. But
I tried to get a binary version of the xerces 1.4, but couldn't get it on
the web. On the web it has only "Xerces-J-src.1.4.0", the source files. Will
it be ok if I compile all the source files and then start working with it ?
And can u be more specific as to where did u get the sample code from the
apache website ?

Thanks,
Kuntal Das
Charles Schwab & Co., Inc.
Wireless Technology
45 Fremont, SF
Email : kuntal.das@schwab.com
Phone : (415)667-4322
Live life to the brim.................



-----Original Message-----
From: dswanson1@mmm.com [mailto:dswanson1@mmm.com]
Sent: Friday, June 01, 2001 6:27 AM
To: soap-dev@xml.apache.org
Subject: Re: Validator for xml-schema & xml documents...



Kuntal,
     I recently went through the validation scenerio and I did not find any
good examples of how to implement schema validation (ie good code examples)
but the apache site did have an example of a namespace/nonamespace
schema...here is a snippet of code that I used to get the validation of XML
documents to work...(using xerces1.4)...


DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     factory.setValidating(true);
     factory.setNamespaceAware(true);
     MyErrorHandler err = new MyErrorHandler(); //inherited from
org.xml.sax.ErrorHandler

     DocumentBuilder builder = factory.newDocumentBuilder();
     builder.setErrorHandler(err);

     Document mydoc = builder.parse(new InputSource
("file:///D:/MES_WebSite/development/xmldoc/person-schema3.xml"));

If any errors pop they are handed to your error handler...the problem that
I see is that the XML docs must have a reference to the exact location/name
of the schema document....IMHO this presents a problem if you are exposing
some methods via SOAP that accept an XML document as an
argument...obviously you would want to validate that the document coming in
is valid for the requested soap service...all of the clients calling your
service would have to construct their documents with intimate knowledge of
the location of your schemas....Also I haven't found an example of how to
cache these documents...

Anyways, end of personal rant and if you think of a solution to these
shortcomings please let me know.

thanks
Doug

Mime
View raw message