[jdom-interest] Schema validation doesn't work

Sanjay Malunjkar smalunjk at cisco.com
Thu Dec 5 10:30:56 PST 2002


I am not very experienced with JDOM.
Why do I get the following exception with the sample code that's at the end 
of this message?
I must be missing something simple here.

I am using jdom-beta8.
Xerces 2.2.1

Thanks,
sanjay

java.lang.NoSuchMethodError

	at org.apache.xerces.util.DOMUtil.getLocalName(Unknown Source)

	at 
org.apache.xerces.impl.xs.traversers.XSAttributeChecker.resolveNamespace(Unknown 
Source)

	at 
org.apache.xerces.impl.xs.traversers.XSAttributeChecker.checkAttributes(Unknown 
Source)

	at 
org.apache.xerces.impl.xs.traversers.XSAttributeChecker.checkAttributes(Unknown 
Source)

	at org.apache.xerces.impl.xs.traversers.XSDocumentInfo.<init>(Unknown Source)

	at org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(Unknown 
Source)

	at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)

	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)

	at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown 
Source)

	at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown 
Source)

	at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)

	at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source)

	at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown 
Source)

	at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown 
Source)

	at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)

	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354)

	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:707)

	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:689)

	at com.cisco.legal.cna.test.ParserTest.<init>(ParserTest.java:26)

	at com.cisco.legal.cna.test.ParserTest.main(ParserTest.java:33)

Exception in thread "main"
import java.io.File;
import org.jdom.input.SAXBuilder;


Sample code:

public class ParserTest implements Constants {

     public ParserTest() {

				try {
						System.setProperty("javax.xml.parsers.SAXParserFactory",
								"org.apache.xerces.jaxp.SAXParserFactoryImpl");
						SAXBuilder builder = new SAXBuilder(SAX2Parser, true);
						builder.setFeature(
							"http://apache.org/xml/features/validation/schema", true);

						builder.setProperty(
							"http://apache.org/xml/properties/schema/external-schemaLocation",
							"http://www.w3.org/2001/12/soap-envelope soap-envelope.xsd" + " " +
							"http://localhost:8080/cna/xml/NonRealTimeRequest.xsd 
NonRealTimeRequest.xsd");

						builder.build(new File("sanjay.xml"));
				} catch (Exception e) {
								e.printStackTrace();
				}
     }

     public static void main(String argv[])
     {
         new ParserTest("");
     }

}



More information about the jdom-interest mailing list