xsl-list
[Top] [All Lists]

Re: Validate Doc XML with XML Schema

2005-02-17 07:33:06
Hello!

I am using the exemple:

// create a SchemaFactory that conforms to W3C XML Schema
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

 // set your error handler to catch errors during schema construction
 sf.setErrorHandler(myErrorHandler);

 // parse the purchase order schema
 Schema schema = sf.newSchema("po.xsd");

 // get a DOM factory
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

 // configure the factory
 dbf.setNamespaceAware(true);

 // set schema on the factory
 dbf.setSchema(schema);

 // create a new parser that validates documents against
 // the schema specified (po.xsd)
 DocumentBuilder db = dbf.newDocumentBuilder();

 // attach an error handler to detect document validation errors
 db.setErrorHandler(myErrorHandler);

 // parse and validate against po.xsd an XML document
 Document purchaseOrderDoc = db.parse("po.xml");

I have a problem:
// set schema on the factory
 dbf.setSchema(schema);
My DocumentBuilderFactory haven't "setSchema".

I'm using j2sk 1.4

Can I help me please?

Thanks
Eder


----- Original Message ----- From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, February 17, 2005 9:53 AM
Subject: RE: [xsl] Validate Doc XML with XML Schema


Off-topic for this list, but see the following article on JAXP 1.3:

https://jaxp.dev.java.net/article/jaxp-1_3-article.html

Saxon-SA 8.3 supports the JAXP 1.3 schema validation API, and includes
further examples of its use.

Michael Kay
http://www.saxonica.com/



-----Original Message-----
From: Eder de Oliveira [mailto:eder(_at_)stela(_dot_)ufsc(_dot_)br]
Sent: 17 February 2005 13:23
To: XSL - list
Subject: [xsl] Validate Doc XML with XML Schema

Hi People,

Please, Anyone can help me!

I would like validate a doc XML using XML Schema in JAVA and
parser SAX

Have any samples ?

Thanks a lot
Eder

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>