This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Validate XML from a string instead of a file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Validate XML from a string instead of a file?" Watch "Validate XML from a string instead of a file?" New topic
Author

Validate XML from a string instead of a file?

john nutter
Greenhorn

Joined: Feb 09, 2010
Posts: 1
I have XML that is saved in the java string format, and I need to validate it against an XSD file. I know how to do it using an XML FILE + XSD file, but how is it done with a String and an XSD file? thanks for the help
Baski Reddy
Greenhorn

Joined: Feb 09, 2010
Posts: 7
I am not sure what parse you want to use. But all the XML parsers API's will support "string" type as well. Below is just an example. You need to look at the API of the parser of you are using.


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Actually that's an example of how to parse XML from a file. To parse from a string using that same parser:
Ernesto Chicas
Greenhorn

Joined: Jan 13, 2010
Posts: 18

You can try this:


i think that xerces is requeried
 
Don't get me started about those stupid light bulbs.
 
subject: Validate XML from a string instead of a file?
 
Similar Threads
validating xml with xsd
How look at DOM element in XML (with backing Schema) and determine it's type, etc?
XML Schema Help
XML validation against XSD
how to validate xml document with xml schema in netbean and how to create simpleType in Netbean