DocumentBuilder [1] is the JAXP flavour of a DOM parser and can be setup in the same way as a SAX. Take a look at the example here [2].
Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/parsers/DocumentBuilder.html [2] http://xerces.apache.org/xerces2-j/faq-pcfp.html#faq-4 Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] RossOliver <[EMAIL PROTECTED]> wrote on 04/17/2008 04:51:31 AM: > Hi, thanks for replying. > > Both those methods look encouraging, but I am in need of the resulting DOM > tree that you can get after a DOMParser has finished validating XML. Both > those seem to use SAX parsers - is there a way to get the Document object > after a SAX parse? or is there a method that uses the DOM parser that will > take an input stream for the schema? > > Thanks, > > -Ross > > > Michael Glavassevich wrote: > > > > Hi Ross, > > > > As documented [1], the value specified for the > > "external-noNamespaceSchemaLocation" property can only be a > > java.lang.String. Xerces supports many other methods for specifying a > > schema. Some of them support construction from an InputStream, > > specifically > > the Valdation API and schemaSource property provided by JAXP [2]. > > > > Thanks. > > > > [1] > > http://xerces.apache.org/xerces2-j/properties.html#schema. > external-noNamespaceSchemaLocation > > [2] http://xerces.apache.org/xerces2-j/faq-pcfp.html#faq-4 > > > > Michael Glavassevich > > XML Parser Development > > IBM Toronto Lab > > E-mail: [EMAIL PROTECTED] > > E-mail: [EMAIL PROTECTED] > > > > RossOliver <[EMAIL PROTECTED]> wrote on 04/16/2008 01:10:50 PM: > > > >> Hey, > >> > >> I'm designing a servlet that takes uploaded XML and XSD files and > > validates > >> them using Xerces. The problem I have is that my XML and XSD files are > >> stored as Strings (this is unavoidable). I can give the parser the XML > > file > >> easily enough using: > >> > >> parser.parse( new InputSource( new StringReader( xml ) ) ); > >> > >> However, setting the XSD schema file is not as easy. It doesn't seem to > >> support the InputSource type as the value of the setProperty method. I > > have > >> also tried using a ByteArrayInputStream: > >> > >> parser.setProperty( > >> > > "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation > ", > > > >> new ByteArrayInputStream( xsd.getBytes() ) ); > >> > >> As well as converting the string into a StreamSource and then into a > > Schema > >> object from the StreamSource, which also throws class cast exceptions... > >> > >> Any help would be greatly appretiated. > >> > >> Thanks for your time, > >> > >> -Ross > >> -- > >> View this message in context: http://www.nabble.com/Validating-XML- > >> with-XSD-schema-in-memory-as-String-tp16723765p16723765.html > >> Sent from the Xerces - J - Users mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> 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] > > > > > > > > -- > View this message in context: http://www.nabble.com/Validating-XML- > with-XSD-schema-in-memory-as-String-tp16723765p16741425.html > Sent from the Xerces - J - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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]