You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/01/14 22:04:04 UTC

DO NOT REPLY [Bug 5849] New: - Fail to validate schema using the schema for schema

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5849>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5849

Fail to validate schema using the schema for schema

           Summary: Fail to validate schema using the schema for schema
           Product: Xerces2-J
           Version: 2.0.0 [beta 4]
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: achille@us.ibm.com


Hi,

Xerces 2 [beta 4] fails to validate a schema document using the schema for 
schemas. 

Testcase:

<?xml version="1.0"?>
<xs:schema version="1.0" 
       xmlns:xs="http://www.w3.org/2001/XMLSchema" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.w3.org/2001/XMLSchema 
 			   http://www.w3.org/2001/XMLSchema.xsd">
	<xs:element name="e1"/>
	<xs:complexType name="t1"/>
	<xs:simpleType name="t2"/>
</xs:schema>
 
Xerces output :

error ::cvc-elt.1: Cannot find the declaration of element 'xs:schema'. at 5,52
error ::cvc-elt.1: Cannot find the declaration of element 'xs:element'. at 6,25
error ::cvc-elt.1: Cannot find the declaration of element 'xs:complexType'. at 
7,29
error ::cvc-elt.1: Cannot find the declaration of element 'xs:simpleType'. at 
8,28


Program code :

package tests;
import javax.xml.parsers.SAXParserFactory;   
import javax.xml.parsers.SAXParser;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

public class XercesTest {
	
	protected static class DefaultErrorHandler implements 
org.xml.sax.ErrorHandler {
		public void error(org.xml.sax.SAXParseException exception) 
throws org.xml.sax.SAXException {
				System.out.println
("error ::"+exception.getMessage()+ " at "+exception.getLineNumber()
+","+exception.getColumnNumber());
		}
	
		public void fatalError(org.xml.sax.SAXParseException exception) 
throws org.xml.sax.SAXException {
			System.out.println("FatalError :: "+exception.getMessage
()+ " at "+exception.getLineNumber()+","+exception.getColumnNumber());
		}

		public void warning(org.xml.sax.SAXParseException exception) 
throws org.xml.sax.SAXException {
			System.out.println("Warning :: "+exception.getMessage()
+ " at "+exception.getLineNumber()+","+exception.getColumnNumber());
	
		}
	
	}
	public static void main(String[] args) throws Exception {
		
		SAXParser parser = SAXParserFactory.newInstance().newSAXParser
();
 		XMLReader reader = parser.getXMLReader();
		reader.setFeature
("http://xml.org/sax/features/namespaces",true);
		reader.setFeature("http://xml.org/sax/features/namespace-
prefixes",true);
		reader.setFeature("http://apache.org/xml/features/continue-
after-fatal-error",false);
		reader.setFeature
("http://xml.org/sax/features/validation",true);
		reader.setFeature
("http://apache.org/xml/features/validation/schema",true);
		reader.setProperty
("http://apache.org/xml/properties/schema/external-schemaLocation",
					
	"http://www.w3.org/2001/XMLSchema 
http://www.w3.org/2001/XMLSchema.xsd");
		reader.setErrorHandler(new DefaultErrorHandler());
		
		reader.parse(args[0]);
	}
}

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org