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]