• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JAXP1.2 for XML parsing

 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using JAXP1.2 for validating my schema file..inspite of following all installation instructions I still get the following message during parsing
"Parser doesn't support XMLSchema"
Here is my code
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);

SAXParser saxParser = spf.newSAXParser();
try
{

saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
}
catch (SAXNotRecognizedException x)
{
throw new RuntimeException( "Parser doesn't support XML Schema. " );
System.exit(1);
}
saxParser.setProperty(JAXP_SCHEMA_SOURCE, inputFile);
// Validate
XMLReader xmlReader = saxParser.getXMLReader();
ErrorChecker errorChecker = new ErrorChecker( verboseErrors );
xmlReader.setErrorHandler( errorChecker );
// Validate
xmlReader.parse( new InputSource(inputFile ) );
I appreciate any help..
Thanks
Roopa
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roopa,
Could you tell us which parser you are using and which version? Is it the one that comes by default with the 1.4 SDK or you are specifying another one?
Actually, you may use the Xerces parser which is JAXP1.2 compliant.
Cheers
[ December 05, 2002: Message edited by: Beno�t d'Oncieu ]
 
Roopa Bagur
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the sax parser that comes with JAXP1.2..I have put all the 1.2 jars into JAVA_HOME\lib\endorsed directory...which is supposed to over ride other default versions of the jars.

Originally posted by Beno�t d'Oncieu:
Hi Roopa,
Could you tell us which parser you are using and which version? Is it the one that comes by default with the 1.4 SDK or you are specifying another one?
Actually, you may use the Xerces parser which is JAXP1.2 compliant.
Cheers
[ December 05, 2002: Message edited by: Beno�t d'Oncieu ]

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Roopa,
Could you change the following lines:

by:

and give us the exact exception that was thrown.
Cheers
 
Roopa Bagur
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I fixed the problem... The reason for the error message was I had a copy of JRE in my programFiles folder which did not have the endorsed directory...

DO you know of any website that has some common schema validation error messages & their resolutions?.. 'coz now I am stepping into some validations errors which I'll have to fix.
Thanks & I appreciate ur help,
Roopa

Originally posted by Beno�t d'Oncieu:
Roopa,
Could you change the following lines:

by:

and give us the exact exception that was thrown.
Cheers

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roopa,
I actually don't know any site that would give you common validation errors with a way to correct the problem, but feel free to use the forum (and Google newsgroups) to search or ask.
Good luck
 
I was born with webbed fish toes. This tiny ad is my only friend:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic