File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes How DO I Set XSDs in a web app for a Sax Parser? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How DO I Set XSDs in a web app for a Sax Parser? " Watch "How DO I Set XSDs in a web app for a Sax Parser? " New topic

How DO I Set XSDs in a web app for a Sax Parser?

Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Hi All-

I'm running into an xml validation issue calling a web service using HttpURLConnection in a servlet.
I get a good response, with a soap envelope, and I want to parse the xml.

I get a Malformed URL error (no protocol) due to missing schemas.

the response string ( a few field names changed to protect the innocent): the main point is to show the schemas involved

<soap:Envelope xmlns:soap="" xmlns:xsd="" xmlns:xsi=""><soap:Body xmlns:ns1=""><SubscribeResponse xmlns=""><SubscriptionReference xmlns=""><Address xmlns="">https://w02777/orion/soap?ServiceName=NotificationProducer</Address><ReferenceParameters xsi:type="ns:FooReferenceParametersType" xmlns:ns="" xmlns=""><SubscriptionId xmlns="">TCSN_foo_Subscriber_331DAA98-4DC7-11DF-836B-AE4F0AC5625E</SubscriptionId></ReferenceParameters></SubscriptionReference></SubscribeResponse></soap:Body></soap:Envelope>

my code:

String getSubscriptionIdFromResponse(String response) {
InputSource is = new InputSource(response);
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
SaxHandler handler = new SaxHandler();
parser.parse(is, handler);
return handler.subscriptionId;
} catch (Exception e) {
return "error occurred";


The xml is received as a repsonse:
I have the missing XSDs (the "docs oasis" ones and one application XSD).

My question: where do I put them so the parser will resolve them? web-inf doesn't work.
Also, do I have to resolve the xsi mapping with their new location?

any ideas?
I agree. Here's the link:
subject: How DO I Set XSDs in a web app for a Sax Parser?
It's not a secret anymore!