Michael

Thank you for your reply. Unfortunately there is no "OpenDNS" showing up
anywhere in my XML or source code files. It is quite bizarre. The fact that
I can get the XML to validate with the XMLValidator from Spring tells me
that the XML is valid and that I can use the remote locations of xmime and
xop-include schemas and it works. I have copied these version locally so
that I know they have the same content. 

I am attaching a copy of the stack trace that I receive. I could not find
information about the URL in the SAXParseException message- that would be
very useful if I could get that information.

Regards
Brenda

Michael Glavassevich-3 wrote:
> 
> 
> Hi Brenda,
> 
> The error message you're getting complains about "OpenDNS" appearing in
> some document yet doesn't appear in any of the data you've shown. Such
> text
> doesn't just appear magically. There's some other document involved here
> that you haven't posted. It would help if you could make a connection
> between the error message you're getting and the input that you're feeding
> to Xerces and may also be useful to show us the stack trace rather than
> just mentioning that there was one. There should be information about the
> document's location (URL) in the SAXParseException in case you're not sure
> where to look for it.
> 
> Thanks.
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrgla...@ca.ibm.com
> E-mail: mrgla...@apache.org
> 
> Brenda Coulson <bren...@dystech.com> wrote on 10/19/2009 12:10:54 PM:
> 
>> Ok - I have been struggling with this for over two weeks now and am
>> about to pull out my hair. I have scrubbed discussion groups,
>> websites for help but alas I come up with nothing. I am trying to
>> validate an XML file against the XSD schema and running into some
>> problems. The XML I would like to validate is the payload of a web
>> service SOAP message. I am using the SAXParserFactory to generate my
>> parser and I am doing the following in my code to set up the parser:
>>
>> System.setProperty("javax.xml.validation.SchemaFactory:http://www.
>> w3.org/2001/XMLSchema",
> "org.apache.xerces.jaxp.validation.XMLSchemaFactory");
>>
>> SAXParserFactory parserFactory = SAXParserFactory.newInstance();
>> parserFactory.setNamespaceAware(true);
>> parserFactory.setValidating(false);
>> parserFactory.setFeature
> ("http://apache.org/xml/features/validation/schema
>> ", true); parserFactory.setFeature
> ("http://xml.org/sax/features/validation
>> ", true);
>>
>> SchemaFactory schemaFactory =  SchemaFactory.newInstance("http:
>> //www.w3.org/2001/XMLSchema");
>> StreamSource soapSchemaSource = new StreamSource(new
>> ClassPathResource(soapSchemaVersion).getInputStream());
>> soapSchemaSource.setSystemId
> ("http://schemas.xmlsoap.org/soap/envelope/";);
>>
>> StreamSource schemaSource = new StreamSource(new
>> ClassPathResource("arm-internal.xsd").getInputStream());));
>> schemaSource.setSystemId("http://service.arm.hud.gov/";);
>>
>> parserFactory.setSchema(schemaFactory.newSchema(new Source[]
>> {schemaSource, soapSchemaSource}));
>>
>> XMLReader reader = parserFactory.newSAXParser().getXMLReader();
>> ArmHandler handler = new ArmHandler();
>> reader.setErrorHandler(handler);
>> reader.parse(new InputSource(payload));
>>
>> I get no errors setting up my schema but yet when I try to parse a
>> XML file using the schema specified in newSchema, I get the
>> following exception:
>>
>> "org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace
>> characters are not allowed in schema elements other than 'xs:
>> appinfo' and 'xs:documentation'. Saw 'OpenDNS'"
>>
>> It is followed by a stack trace.
>> My schema actually imports 2 external schemas and when I specify
>> their schema location as a URL, not a local file, it works but i can
>> not rely on that because I do not have access to the internet.
>>
>> I can attach my XML and XSD files but there is no place to do so. I
>> will add them at the end.
>>
>> Here are my questions/issues:
>>
>> 1. How do I solve the problem above from happening other than
>> relying on the internet to find the schema.
>> 2. When I do modify my XML file, the above exception is corrected
>> but then I get an error saying it can not resolve the soapenv namespace.
>> 3. Ultimately what I am interested in is getting the parser to
>> validate my XML correctly. It is intentionally flawed - there is a
>> bug in our system I am trying to correct. We were previously using
>> XMLValidator (from Spring) but it has no ability to
>> configure/customize so I switched to use the SAXParser. Ultimately,
>> I need the validator to complain when an element is missing. In my
>> XML below, I am missing the required element of referenceId but the
>> parser does not complain about it. Incidentally, it does not matter
>> if I supply the namespace or not in my XML file since I am
>> specifying the XSD in the application code in terms of it validating
>> the XML correctly.
>>
>> Thank you so much
>> Brenda
> 
http://www.nabble.com/file/p25978879/SAXParseException.txt
SAXParseException.txt 
-- 
View this message in context: 
http://www.nabble.com/SAXParser-Problem-tp25961802p25978879.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to