dcsimg
Zerces 1.4.4, JAXP, schema - can't validate
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Orna_Vel
Posted On:   Tuesday, November 27, 2001 07:01 AM

I have a code like: System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); myFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance(); myFactory.setValidating(true); // get DocumentBuilder instance myBuilder = (javax.xml.parsers.DocumentBuilder) myFactory.newDocumentBuilder(); // Set a SAX ErrorHandler MyErrorHandler myErrorHandlerImpl = new MyErrorHandler(); myBuilder.setErrorHandler(myErrorHandlerImpl); myDoc = myBuilder.parse(new File(fName)); And I keep getting parse errors: "Element type "model" must be declared"   More>>

I have a code like:

			

System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");

myFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();

myFactory.setValidating(true);

// get DocumentBuilder instance
myBuilder = (javax.xml.parsers.DocumentBuilder) myFactory.newDocumentBuilder();

// Set a SAX ErrorHandler
MyErrorHandler myErrorHandlerImpl = new MyErrorHandler();
myBuilder.setErrorHandler(myErrorHandlerImpl);

myDoc = myBuilder.parse(new File(fName));


And I keep getting parse errors: "Element type "model" must be declared"

Where my xml file is:
			

<?xml version="1.0" encoding="UTF-8"?>





....


And schema file:
			

<?xml version="1.0" encoding="UTF-8"?>



...


Does somebody know how to solve it? Thanks.    <<Less

Re: Zerces 1.4.4, JAXP, schema - can't validate

Posted By:   Gordon_Murphy  
Posted On:   Tuesday, November 27, 2001 08:02 PM

It sounds to me like it *is* validating your file against the schema. What is happening is that your file is *wrong*, at least according to the schema you have written. Did you declare an for model? That would be my guess. It is hard to tell you if that is the real problem, as you haven't posted the whole schema. But, most likely, that is it.
About | Sitemap | Contact