Re: Validating a DOM

2005-01-21 Thread Curtiss Howard
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
[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Validating a DOM

2005-01-21 Thread Bob Foster
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
[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Validating a DOM

2005-01-21 Thread Michael Glavassevich
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

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]