[ 
http://issues.apache.org/jira/browse/XERCESJ-1161?page=comments#action_12412339 
] 

Steven Grossman commented on XERCESJ-1161:
------------------------------------------

moved to correct component - XERCESJ-1163 

> "Validation error: cvc-elt.1: Cannot find the declaration of element "
> ----------------------------------------------------------------------
>
>          Key: XERCESJ-1161
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1161
>      Project: Xerces2-J
>         Type: Bug

>   Components: XML Schema API
>     Versions: 2.7.1
>  Environment: OS X, Java 1.5.0
>     Reporter: Steven Grossman

>
> I'm trying to make use of the newish javax.xml.validation APIs. I can get 
> them to work with the Xerces built in to Java 1.5 but not with Xerces 2.7.1. 
> I've got a project still on Java 1.4, so I need to get a non-bundled Xerces 
> working.
> I'm testing with the sample code available from 
> <http://www-128.ibm.com/developerworks/xml/library/x-jaxp/>
> [EMAIL PROTECTED] /tmp]$ java -version
> java version "1.5.0_05"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-83)
> Java HotSpot(TM) Client VM (build 1.5.0_05-48, mixed mode, sharing)
> $ curl -O 
> ftp://www6.software.ibm.com/software/developer/library/x-jaxp-all-about.zip
> $ unzip x-jaxp-all-about.zip
> $ javac TestDOMValidation.java
> Xerces 2.7.1's SchemaFactory implementation errors out:
> java \
>     -classpath $HOME/.maven/repository/xerces/jars/xercesImpl-2.7.1.jar:. \
>     -Djaxp.debug=true \
>     
> -Djavax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory
>  \
>     TestDOMValidation simple.xml simple.xsd
> JAXP: find factoryId =javax.xml.parsers.DocumentBuilderFactory
> JAXP: found jar 
> resource=META-INF/services/javax.xml.parsers.DocumentBuilderFactory using 
> ClassLoader: [EMAIL PROTECTED]
> JAXP: found in resource, 
> value=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
> JAXP: created new instance of class 
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl using ClassLoader: [EMAIL 
> PROTECTED]
> JAXP: using thread context class loader ([EMAIL PROTECTED]) for search
> JAXP: Looking up system property 
> 'javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema'
> JAXP: The value is 'org.apache.xerces.jaxp.validation.XMLSchemaFactory'
> JAXP: instanciating org.apache.xerces.jaxp.validation.XMLSchemaFactory
> JAXP: loaded it from 
> jar:file:/Users/slamb/.maven/repository/xerces/jars/xercesImpl-2.7.1.jar!/org/apache/xerces/jaxp/validation/XMLSchemaFactory.class
> JAXP: factory 'org.apache.xerces.jaxp.validation.XMLSchemaFactory' was found 
> for http://www.w3.org/2001/XMLSchema
> Validation error: cvc-elt.1: Cannot find the declaration of element 
> 'phonebook'.
> but the one built in to Java 1.5 works correctly:
> $ java -Djaxp.debug=true TestDOMValidation simple.xml simple.xsd
> JAXP: find factoryId =javax.xml.parsers.DocumentBuilderFactory
> JAXP: loaded from fallback value: 
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
> JAXP: created new instance of class 
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl using 
> ClassLoader: [EMAIL PROTECTED]
> JAXP: using thread context class loader ([EMAIL PROTECTED]) for search
> JAXP: Looking up system property 
> 'javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema'
> JAXP: The property is undefined.
> JAXP: found null in $java.home/jaxp.properties
> JAXP: no META-INF/services/javax.xml.validation.SchemaFactory file was found
> JAXP: attempting to use the platform default XML Schema validator
> JAXP: instanciating 
> com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl
> JAXP: loaded it from 
> jar:file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar!/com/sun/org/apache/xerces/internal/jaxp/validation/xs/SchemaFactoryImpl.class
> JAXP: factory 
> 'com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl' was 
> found for http://www.w3.org/2001/XMLSchema
> JAXP: find factoryId =javax.xml.transform.TransformerFactory
> JAXP: loaded from fallback value: 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
> JAXP: created new instance of class 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl using 
> ClassLoader: [EMAIL PROTECTED]
> Document validates fine.
> xmllint also works fine with these files:
> $ xmllint --schema simple.xsd simple.xml
> [...]
> simple.xml validates

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to