There are examples [1] around on how to set properties on a DocumentBuilder. The method name may be different but it behaves pretty much the same as every other setProperty() method in JAXP.
[1] http://xerces.apache.org/xerces2-j/properties.html Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Decoker, Lydie \(Lydie\)" <[EMAIL PROTECTED]> wrote on 09/26/2006 11:06:15 AM: > Michael, > > I guess you are talking about this code: > > import org.apache.xerces.util.XMLCatalogResolver; > import org.xml.sax.*; > > ... > > XMLReader reader; > String [] catalogs = > {"file:///C:/catalog/cat1.xml", "file:///C:/catalog/cat2.xml"}; > > ... > > // Create catalog resolver and set a catalog list. > XMLCatalogResolver resolver = new XMLCatalogResolver(); > resolver.setPreferPublic(true); > resolver.setCatalogList(catalogs); > > // Set the resolver on the parser. > reader.setProperty( > "http://apache.org/xml/properties/internal/entity-resolver", > resolver); > > ... > > This code uses XMLReader which is for SAX, right? Is the "set an > XMLEntityResolver" done by setting the property entity-resolver to the > reader object> > > I already read lots of things but most of example are for SAX and > DTD,not DOM and XML schema. There is many possibilities to implement > parsing and validation and unfortunately they are not all described in > one place and many are out-of-date. That's why I am asking so many > question to try to understand something. > > -----Original Message----- > From: Michael Glavassevich [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 26, 2006 16:44 > To: [email protected] > Subject: RE: Trying to validate XML files using several XSD > > It's your code. You chose the APIs you're using. Presumably you set an > org.xml.sax.EntityResolver on the parser by calling > "builder.setEntityResolver(catalog1)". The FAQ shows how to set an > XMLEntityResolver. If you're not sure what certain interfaces and > methods do I suggest you take a deeper read of the Javadocs and other > documentation. > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: [EMAIL PROTECTED] > E-mail: [EMAIL PROTECTED] > > "Decoker, Lydie \(Lydie\)" <[EMAIL PROTECTED]> wrote on 09/26/2006 > 10:16:31 AM: > > > Not sure I got your point. I read the FAQ and I do not see what has > > been done in more. > > How can I know which Resolver interface is used by my application? > > > > BTW I appreciate your help :o) > > > > -----Original Message----- > > From: Michael Glavassevich [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, September 26, 2006 16:07 > > To: [email protected] > > Subject: RE: Trying to validate XML files using several XSD > > > > "Decoker, Lydie \(Lydie\)" <[EMAIL PROTECTED]> wrote on 09/26/2006 > > 05:39:30 AM: > > > > > Oh yes I see. Sorry about that. I am just loosing my head trying to > > > make this stuff working. > > > > > > I defined my XMLCatalogResolver: > > > > > > XMLCatalogResolver catalog1 = new XMLCatalogResolver(); > > > > > > I have added to it to catalog using setCatalogList() method. > > > > > > I have tested to resolveURI to see if it really took into account my > > > catalog: > > > System.out.println(catalog1.resolveURI("http://my.uri.com/GRIPP/jmsP > > > ro > > > pe > > > rties")); > > > > > > This test works fine. I got as output the location of my xsd file. > > > > > > I have added the catalogResolver to my parser: > > > builder.setEntityResolver(catalog1); > > > > > > BUT when parsing and validating my XML file, I got: > > > cvc-elt.1: Cannot find the declaration of element 'JMSProperties'. > > > > > > XMLCatalogResolver uses target namespace to resolve location. So in > > > my > > > > > xsd, I do not need to have the schemaLocation tag, right? > > > > Only if the resolver interface you're using reports the target > > namespace. > > EntityResolver does not. You need to use one of the other resolver > > interfaces: LSResourceResolver or XNI's XMLEntityResolver. There's an > > example of how to set an XMLCatalogResolver as the parser's > > XMLEntityResolver in the FAQs [1]. > > > > > It should use: xmlns="http://my.uri.com/GRIPP/jmsProperties", right? > > > > The JMSProperties is the root tag: > > > > > > <JMSProperties xmlns="http://my.uri.com/GRIPP/jmsProperties" > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > .... > > > </JMSProperties> > > > > > > Lydie. > > > > > > -------------------------------------------------------------------- > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > [1] http://xerces.apache.org/xerces2-j/faq-xcatalogs.html > > > > Michael Glavassevich > > XML Parser Development > > IBM Toronto Lab > > E-mail: [EMAIL PROTECTED] > > E-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
