You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Züblin Thomas <th...@bmdwireless.com> on 2004/05/04 17:45:12 UTC

Input Stream as External Schema ?

Hi all,
i'd like to use xerces to create my dom. The thing is, i have a schema as a
byte Array, that i 
want to use for validation. How can i tell xerces to use that byte Array as
the schema to use for validation? i'm currently
working with the crimson parser and with this parser it works by telling the
DocumentBuilderFactory to
setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",schemaBy
teArrayInputStream)

see http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPDOM9.html
(section 'Associating a Document with a Schema') for details on this

As far as i know i can define external Schemas to use in xerces like this:
reader.setProperty("http://apache.org/xml/properties/schema/external-noNames
paceSchemaLocation",String value) 

I have to pass a String with the location of the xsd file. This is (as far
as i know) 
not possible in my case, since i received the Schema as a Byte Array over
the network and i don't want to store it locally. So i don't
have a location to pass, all i can pass is an InputStream.
Anyone has any ideas how to do that, or is it impossible?
Cheers,
tom 


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Input Stream as External Schema ?

Posted by Neil Delima <nd...@ca.ibm.com>.




Züblin Thomas <th...@bmdwireless.com> wrote on 05/04/2004 11:45:12
AM:

> i'd like to use xerces to create my dom. The thing is, i have a schema as
a
> byte Array, that i
> want to use for validation. How can i tell xerces to use that byte Array
as
> the schema to use for validation? i'm currently
> working with the crimson parser and with this parser it works by telling
the
> DocumentBuilderFactory to
>
setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",schemaBy

> teArrayInputStream)

Xerces implements JAXP 1.2 so you should be able to use a byte Array as the
schema in a similar way.  Make sure your classpath is set correctly and if
you're on a 1.4 JDK use the endorsed standards override mechanism[1] to
load the correct xml jars.

[1]http://java.sun.com/j2se/1.4.2/docs/guide/standards/index.html
[2]http://xml.apache.org/xalan-j/faq.html#faq-N100CC


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org