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 Travis Stevens <Tr...@noaa.gov> on 2005/01/20 19:56:34 UTC
Validating a DOM
I am trying to validate a DOM with a schema. I am currently looking at
the DOMParser class, but this seems to require an InputSource which
means converting the DOM into a String. Any suggestions on validating a
DOM directly?
-Trav
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validating a DOM
Posted by Bob Foster <bo...@objfac.com>.
Using ByteArrayInputStream wouldn't be a good idea. A String is not a
byte array, it's a char array. You certainly don't want to convert the
String to bytes and then reconvert it to chars, giving yourself an
opportunity to get the charset wrong.
What you want to do is create a StringReader.
Bob Foster
Curtiss Howard wrote:
> By "converting the DOM into a String" I assume you mean the schema
> DOM? If so, I believe that yes, you must serialize the DOM into a
> String. Actually, to be more specific, you have to serialize the DOM
> into a String and THEN create an InputStream out of that String (most
> implementations I've seen use ByteArrayInputStream). The InputSource
> constructor that takes a String assumes that the String points to a
> URI where the document can be loaded AFAIK.
>
> Curtiss Howard
>
>
> On Thu, 20 Jan 2005 11:56:34 -0700, Travis Stevens
> <Tr...@noaa.gov> wrote:
>
>>I am trying to validate a DOM with a schema. I am currently looking at
>>the DOMParser class, but this seems to require an InputSource which
>>means converting the DOM into a String. Any suggestions on validating a
>>DOM directly?
>>
>>-Trav
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validating a DOM
Posted by Curtiss Howard <cu...@gmail.com>.
By "converting the DOM into a String" I assume you mean the schema
DOM? If so, I believe that yes, you must serialize the DOM into a
String. Actually, to be more specific, you have to serialize the DOM
into a String and THEN create an InputStream out of that String (most
implementations I've seen use ByteArrayInputStream). The InputSource
constructor that takes a String assumes that the String points to a
URI where the document can be loaded AFAIK.
Curtiss Howard
On Thu, 20 Jan 2005 11:56:34 -0700, Travis Stevens
<Tr...@noaa.gov> wrote:
> I am trying to validate a DOM with a schema. I am currently looking at
> the DOMParser class, but this seems to require an InputSource which
> means converting the DOM into a String. Any suggestions on validating a
> DOM directly?
>
> -Trav
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validating a DOM
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
DOM Level 3 provides a method for validating a document in memory. This
FAQ [1] describes how to do it.
[1] http://xml.apache.org/xerces2-j/faq-dom.html#faq-9
"Travis Stevens" <Tr...@noaa.gov> wrote on 01/20/2005 01:56:34
PM:
> I am trying to validate a DOM with a schema. I am currently looking at
> the DOMParser class, but this seems to require an InputSource which
> means converting the DOM into a String. Any suggestions on validating a
> DOM directly?
>
> -Trav
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org