Hi i am new to
java & XML & SAX Parser.. i need Urgent Help
How should i validate the XML. I have a XSD (schema ) and i am using the SAX parser.
Please some one point me a good link or sample code to validate the XML against the XSD.
The following is the portion of code written to call the SAX parser
----
RequestHandler rh = new RequestHandler(); -> I mentioned this class below
TextMessage textMessage = (TextMessage) msg; --> "msg" has XML file
String txt = textMessage.getText();
try {
SAXParserFactory fact = SAXParserFactory.newInstance();
SAXParser sp = fact.newSAXParser();
InputSource inSource = new InputSource();
inSource.setCharacterStream(new StringReader(txt));
sp.parse(inSource, rh);
}
--
The following class i am using to parse the XML .. this has all methods like startDocument,startElelment,endElelment,characters .. etc., etc., etc.,
public class RequestHandler extends DefaultHandler {
}
--
Please some one let me know how to validate .. i have XSD's which was given by another team .. i do not know how to validate XML against XSD (schema) using SAX parser