The following issue has been updated:

    Updater: Serge Knystautas (mailto:[EMAIL PROTECTED])
       Date: Mon, 12 Apr 2004 2:14 PM
    Changes:
             Attachment changed from validation.zip
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/XERCERJ-118?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCERJ-118

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCERJ-118
    Summary: Fail to validate schema using the schema for schema
       Type: Bug

     Status: Resolved
 Resolution: FIXED

    Project: Xerces2-J

   Assignee: Xerces-J Developers Mailing List
   Reporter: Achille Fokoue

    Created: Mon, 14 Jan 2002 1:04 PM
    Updated: Mon, 12 Apr 2004 2:14 PM
Environment: Operating System: Windows NT/2K
Platform: PC

Description:
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]);
        }
}


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to