I hope this helps you:

InputSource is = null;
String xmlString = "<a>hello</a>";
// parse the document
try{
        is = new InputSource(new CharArrayReader(xmlString.toCharArray()));
        parser.parse(is);
}
catch(...){...}

I don't know how to set a dtd/schema cached into a string... but I'm interested 
in!

-----Original Message-----
From: Swanson, Brion [mailto:[EMAIL PROTECTED]
Sent: Friday, September 20, 2002 2:47 PM
To: '[EMAIL PROTECTED]'
Subject: Using a String to validate XML


I apologize if this question has already been asked, but the archive appears
to be down for an upgrade (since yesterday).

Is there a way in Xerces to use a Java object, such as a StringBuffer or a
String, to validate an incoming XML document?  In other words, if I read in
a DTD or schema and preserve it in object form (cache it), can I tell Xerces
to look at this object when validating an XML document?  If so, how do I go
about doing that?

I know I can have Xerces parse a Java object using the InputSource(String s)
constructor (given I stringify the Java object and that string is
well-formed XML), but I have a need to do a similar Java object-based
validation instead of accessing an external file each and every time I need
to validate a parse.

The only documentation I've been able to find talks about setting the public
and system IDs, but I don't if and how to set the public/system ID to a Java
object.  My intuition tells me that I can't, but I wanted to ask those more
knowledgeable.

Thank you for your help in advance!

Cheers!
Brion

--------------
Brion Swanson - West Group / Rochester, NY
mailto:[EMAIL PROTECTED]


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



====================================================================
CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to [EMAIL PROTECTED] Thank you
====================================================================

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

Reply via email to