You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by xe...@cefn.com on 2007/02/01 18:04:28 UTC

Xerces Problem - Compound Schemas - Name Resolution Error

I'm getting a very weird error when using Xerces to parse an XSD  
document (Xerces as embedded in Oxygen 8.1).

"E src-resolve: Cannot resolve the name 'xhtml:head_fn3dktizrknc9pi'  
to a(n) 'type definition' component."

The full document is shown below as it's very simple. If anyone can  
make out what's wrong with it, or make a modification to it which  
will make it acceptable to the parser, or even point me to a useful  
resource for extra knowledge I need to have to address these errors,  
I would be very grateful.

I've tried every possible variant of various irrelevant namespace and  
targetnamespace properties in response to a series of other silly  
conformance errors raised. I get the fewest errors of all with this  
configuration - only one error, but it's completely meaningless to me.

I know W3C standards aren't parsimonious and rarely have smart  
defaults, but I've spent a long time on this - like 3 hours plus over  
a period of a fortnight trying every possible combination of  
targetNamespace, with imports, with schema locations, without schema  
locations. What I'm trying to achieve is unbelievably  
straightforward. God help me if I try to use XSD for anything major.

The document is attempting to combine XHTML and XFORMS components  
into an XHTML variant which permits XFORMS 'model' elements to sit in  
the 'head' element of the XHTML. After this works, I'll also add  
XFORMS 'group' elements into the 'body' element of XHTML. In that way  
I hope to generate an XSD which allows me to edit XHTML+XFORMS  
combined documents in a validating XML editor. As I understand it,  
this schema definition and recombination is exactly what XSD is  
intended to do.

I guess it's got to be just right. I'm sure there's some kind of  
error, but the error reports I'm getting don't help me get to the  
bottom of it at all. All help gratefully received.

Cefn
http://cefn.com

 >>>>>>>>>

"E src-resolve: Cannot resolve the name 'xhtml:head_fn3dktizrknc9pi'  
to a(n) 'type definition' component."

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
     targetNamespace="http://www.w3.org/1999/xhtml"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
     xmlns:xhtml="http://www.w3.org/1999/xhtml"
     xmlns:xforms="http://www.w3.org/2002/xforms"
     xsi:schemaLocation="http://www.w3.org/1999/xhtml http:// 
www.w3.org/2002/08/xhtml/xhtml1-strict.xsd http://www.w3.org/2002/ 
xforms http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd" >

     <xs:redefine schemaLocation="http://www.w3.org/2002/08/xhtml/ 
xhtml1-strict.xsd" >
         <xs:complexType name="head">
             <xs:complexContent>
                 <xs:extension base="xhtml:head">
                     <xs:sequence>
                         <xs:element ref="xforms:model"/>
                     </xs:sequence>
                 </xs:extension>
             </xs:complexContent>
         </xs:complexType>
     </xs:redefine>

</xs:schema>

Re: Xerces Problem - Compound Schemas - Name Resolution Error

Posted by George Cristian Bina <ge...@sync.ro>.
Hello Cefn,

You are trying to redefine a complex type with the name head from the 
XHTML schema but there is no such complex type in that schema, there is 
only an element with the name head.
If you look at the head element definition you see that it contains 
references to the head.misc group and therefore a possible approach will 
be to redefine that group to allow the xforms:model element. Note that 
xsi:schemaLocation does not have an effect on XML Schema documents, you 
need to use import in order to be able to make references to components 
from another namespace. You can find a valid schema below.


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
   targetNamespace="http://www.w3.org/1999/xhtml"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
   xmlns:xhtml="http://www.w3.org/1999/xhtml"
   xmlns:xforms="http://www.w3.org/2002/xforms">

   <xs:import namespace="http://www.w3.org/2002/xforms" 
schemaLocation="http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd"/>

   <xs:redefine 
schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd" >
     <xs:group name="head.misc">
        <xs:choice>
          <xs:group ref="xhtml:head.misc"/>
          <xs:element ref="xforms:model"/>
        </xs:choice>
     </xs:group>
   </xs:redefine>
</xs:schema>

For compound documents that contain elements from different namespaces 
there is an ISO standard that defines NVDL - Namespace-based Validation 
and Dispatching Language. That allows to specify basically that sections 
from a document should be validated with different schemas. We made 
available an open source implementation of NVDL on top of Jing that 
supports as schemas XML Schema, Relax NG and Schematron, see
http://www.oxygenxml.com/onvdl.html
oXygen includes oNVDL and in the oXygen samples you can find an NVDL 
script for exactly XHTML with XForms and a sample XHTML+XForms file that 
you can edit with content completion and continuous validation in oXygen 
based on the sample NVDL script that combines XHTML and XForms.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

xerces.apache.org@cefn.com wrote:
> I'm getting a very weird error when using Xerces to parse an XSD 
> document (Xerces as embedded in Oxygen 8.1).
> 
> "E src-resolve: Cannot resolve the name 'xhtml:head_fn3dktizrknc9pi' to 
> a(n) 'type definition' component."
> 
> The full document is shown below as it's very simple. If anyone can make 
> out what's wrong with it, or make a modification to it which will make 
> it acceptable to the parser, or even point me to a useful resource for 
> extra knowledge I need to have to address these errors, I would be very 
> grateful.
> 
> I've tried every possible variant of various irrelevant namespace and 
> targetnamespace properties in response to a series of other silly 
> conformance errors raised. I get the fewest errors of all with this 
> configuration - only one error, but it's completely meaningless to me.
> 
> I know W3C standards aren't parsimonious and rarely have smart defaults, 
> but I've spent a long time on this - like 3 hours plus over a period of 
> a fortnight trying every possible combination of targetNamespace, with 
> imports, with schema locations, without schema locations. What I'm 
> trying to achieve is unbelievably straightforward. God help me if I try 
> to use XSD for anything major.
> 
> The document is attempting to combine XHTML and XFORMS components into 
> an XHTML variant which permits XFORMS 'model' elements to sit in the 
> 'head' element of the XHTML. After this works, I'll also add XFORMS 
> 'group' elements into the 'body' element of XHTML. In that way I hope to 
> generate an XSD which allows me to edit XHTML+XFORMS combined documents 
> in a validating XML editor. As I understand it, this schema definition 
> and recombination is exactly what XSD is intended to do.
> 
> I guess it's got to be just right. I'm sure there's some kind of error, 
> but the error reports I'm getting don't help me get to the bottom of it 
> at all. All help gratefully received.
> 
> Cefn
> http://cefn.com
> 
>  >>>>>>>>>
> 
> "E src-resolve: Cannot resolve the name 'xhtml:head_fn3dktizrknc9pi' to 
> a(n) 'type definition' component."
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema
>     targetNamespace="http://www.w3.org/1999/xhtml"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
>     xmlns:xhtml="http://www.w3.org/1999/xhtml"
>     xmlns:xforms="http://www.w3.org/2002/xforms"
>     xsi:schemaLocation="http://www.w3.org/1999/xhtml 
> http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd 
> http://www.w3.org/2002/xforms 
> http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd" >
> 
>     <xs:redefine 
> schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd" >
>         <xs:complexType name="head">
>             <xs:complexContent>
>                 <xs:extension base="xhtml:head">
>                     <xs:sequence>
>                         <xs:element ref="xforms:model"/>
>                     </xs:sequence>
>                 </xs:extension>
>             </xs:complexContent>
>         </xs:complexType>
>     </xs:redefine>
> 
> </xs:schema>

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


Re: Xerces Problem - Compound Schemas - Name Resolution Error

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
The DOM shouldn't have been modified. The schema loader has a bug where it 
mutates the DOM in order to rename the original component which is being 
redefined. This was actually fine before JAXP 1.3 came along. Back then 
the DOM was always built by the schema loader so it didn't matter whether 
we trashed it. It's not easy to fix. The "xhtml:head_fn3dktizrknc9pi" name 
should only appear in the XSModel.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Dick Deneer <di...@donkeydevelopment.com> wrote on 02/01/2007 
05:09:50 PM:

> When I parse your XSD into a DOM, validate it, and serialize it back
> to XML I get the following modified XML:
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="http://www.w3.org/1999/xhtml"
>     xmlns:xforms="http://www.w3.org/2002/xforms"
>     xmlns:xhtml="http://www.w3.org/1999/xhtml"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance" 
xsi:schemaLocation="
> http://www.w3.org/1999/xhtml 
http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd
> http://www.w3.org/2002/xforms http://www.w3.
> org/MarkUp/Forms/2002/XForms-Schema.xsd">
>     <xs:redefine schemaLocation="http://www.w3.
> org/2002/08/xhtml/xhtml1-strict.xsd">
>         <xs:complexType name="head">
>             <xs:complexContent>
>                 <xs:extension base="xhtml:head_fn3dktizrknc9pi">
>                     <xs:sequence>
>                         <xs:element ref="xforms:model"/>
>                     </xs:sequence>
>                 </xs:extension>
>             </xs:complexContent>
>         </xs:complexType>
>     </xs:redefine>
> </xs:schema>
> 
> Xerces (2.9.0) gives the following two errors:
> [10:65]: src-redefine.5.b.d: 'extension' does not have a 'base' 
> attribute that refers to the redefined element, 'http://www.w3.
> org/1999/xhtml,head'. <complexType> children of <redefine> elements 
> must have <extension> or <restriction> descendants, with 'base' 
> attributes that refer to themselves.
> 
> [10:65]: src-resolve: Cannot resolve the name 'xhtml:
> head_fn3dktizrknc9pi' to a(n) 'type definition' component.
> 
> Maybe this "extra" message heps to clearify your problem.
> 
> Regards
> Dick Deneer
> 
> Op 1-feb-2007, om 18:04 heeft xerces.apache.org@cefn.com het 
> volgende geschreven:
> 
> I'm getting a very weird error when using Xerces to parse an XSD 
> document (Xerces as embedded in Oxygen 8.1).
> 
> "E src-resolve: Cannot resolve the name 'xhtml:head_fn3dktizrknc9pi'
> to a(n) 'type definition' component."
> 
> The full document is shown below as it's very simple. If anyone can 
> make out what's wrong with it, or make a modification to it which 
> will make it acceptable to the parser, or even point me to a useful 
> resource for extra knowledge I need to have to address these errors,
> I would be very grateful.
> 
> I've tried every possible variant of various irrelevant namespace 
> and targetnamespace properties in response to a series of other 
> silly conformance errors raised. I get the fewest errors of all with
> this configuration - only one error, but it's completely meaningless to 
me.
> 
> I know W3C standards aren't parsimonious and rarely have smart 
> defaults, but I've spent a long time on this - like 3 hours plus 
> over a period of a fortnight trying every possible combination of 
> targetNamespace, with imports, with schema locations, without schema
> locations. What I'm trying to achieve is unbelievably 
> straightforward. God help me if I try to use XSD for anything major.
> 
> The document is attempting to combine XHTML and XFORMS components 
> into an XHTML variant which permits XFORMS 'model' elements to sit 
> in the 'head' element of the XHTML. After this works, I'll also add 
> XFORMS 'group' elements into the 'body' element of XHTML. In that 
> way I hope to generate an XSD which allows me to edit XHTML+XFORMS 
> combined documents in a validating XML editor. As I understand it, 
> this schema definition and recombination is exactly what XSD is 
> intended to do.
> 
> I guess it's got to be just right. I'm sure there's some kind of 
> error, but the error reports I'm getting don't help me get to the 
> bottom of it at all. All help gratefully received.
> 
> Cefn
> http://cefn.com
> 
> >>>>>>>>>
> 
> "E src-resolve: Cannot resolve the name 'xhtml:head_fn3dktizrknc9pi'
> to a(n) 'type definition' component."
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema 
>     targetNamespace="http://www.w3.org/1999/xhtml"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>     xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
>     xmlns:xhtml="http://www.w3.org/1999/xhtml"
>     xmlns:xforms="http://www.w3.org/2002/xforms"
>     xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.
> org/2002/08/xhtml/xhtml1-strict.xsd http://www.w3.org/2002/xforms 
> http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd" >
> 
>     <xs:redefine schemaLocation="http://www.w3.
> org/2002/08/xhtml/xhtml1-strict.xsd" >
>         <xs:complexType name="head">
>             <xs:complexContent>
>                 <xs:extension base="xhtml:head">
>                     <xs:sequence>
>                         <xs:element ref="xforms:model"/>
>                     </xs:sequence>
>                 </xs:extension>
>             </xs:complexContent>
>         </xs:complexType>
>     </xs:redefine>
>     
> </xs:schema>

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


Re: Xerces Problem - Compound Schemas - Name Resolution Error

Posted by Dick Deneer <di...@donkeydevelopment.com>.
When I parse your XSD into a DOM, validate it, and serialize it back  
to XML I get the following modified XML:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.w3.org/1999/xhtml"
     xmlns:xforms="http://www.w3.org/2002/xforms"
     xmlns:xhtml="http://www.w3.org/1999/xhtml"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"  
xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/ 
2002/08/xhtml/xhtml1-strict.xsd http://www.w3.org/2002/xforms http:// 
www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd">
     <xs:redefine schemaLocation="http://www.w3.org/2002/08/xhtml/ 
xhtml1-strict.xsd">
         <xs:complexType name="head">
             <xs:complexContent>
                 <xs:extension base="xhtml:head_fn3dktizrknc9pi">
                     <xs:sequence>
                         <xs:element ref="xforms:model"/>
                     </xs:sequence>
                 </xs:extension>
             </xs:complexContent>
         </xs:complexType>
     </xs:redefine>
</xs:schema>

Xerces (2.9.0) gives the following two errors:
[10:65]: src-redefine.5.b.d: 'extension' does not have a 'base'  
attribute that refers to the redefined element, 'http://www.w3.org/ 
1999/xhtml,head'. <complexType> children of <redefine> elements must  
have <extension> or <restriction> descendants, with 'base' attributes  
that refer to themselves.

[10:65]: src-resolve: Cannot resolve the name  
'xhtml:head_fn3dktizrknc9pi' to a(n) 'type definition' component.

Maybe this "extra" message heps to clearify your problem.

Regards
Dick Deneer



Op 1-feb-2007, om 18:04 heeft xerces.apache.org@cefn.com het volgende  
geschreven:

> I'm getting a very weird error when using Xerces to parse an XSD  
> document (Xerces as embedded in Oxygen 8.1).
>
> "E src-resolve: Cannot resolve the name  
> 'xhtml:head_fn3dktizrknc9pi' to a(n) 'type definition' component."
>
> The full document is shown below as it's very simple. If anyone can  
> make out what's wrong with it, or make a modification to it which  
> will make it acceptable to the parser, or even point me to a useful  
> resource for extra knowledge I need to have to address these  
> errors, I would be very grateful.
>
> I've tried every possible variant of various irrelevant namespace  
> and targetnamespace properties in response to a series of other  
> silly conformance errors raised. I get the fewest errors of all  
> with this configuration - only one error, but it's completely  
> meaningless to me.
>
> I know W3C standards aren't parsimonious and rarely have smart  
> defaults, but I've spent a long time on this - like 3 hours plus  
> over a period of a fortnight trying every possible combination of  
> targetNamespace, with imports, with schema locations, without  
> schema locations. What I'm trying to achieve is unbelievably  
> straightforward. God help me if I try to use XSD for anything major.
>
> The document is attempting to combine XHTML and XFORMS components  
> into an XHTML variant which permits XFORMS 'model' elements to sit  
> in the 'head' element of the XHTML. After this works, I'll also add  
> XFORMS 'group' elements into the 'body' element of XHTML. In that  
> way I hope to generate an XSD which allows me to edit XHTML+XFORMS  
> combined documents in a validating XML editor. As I understand it,  
> this schema definition and recombination is exactly what XSD is  
> intended to do.
>
> I guess it's got to be just right. I'm sure there's some kind of  
> error, but the error reports I'm getting don't help me get to the  
> bottom of it at all. All help gratefully received.
>
> Cefn
> http://cefn.com
>
> >>>>>>>>>
>
> "E src-resolve: Cannot resolve the name  
> 'xhtml:head_fn3dktizrknc9pi' to a(n) 'type definition' component."
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema
>     targetNamespace="http://www.w3.org/1999/xhtml"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
>     xmlns:xhtml="http://www.w3.org/1999/xhtml"
>     xmlns:xforms="http://www.w3.org/2002/xforms"
>     xsi:schemaLocation="http://www.w3.org/1999/xhtml http:// 
> www.w3.org/2002/08/xhtml/xhtml1-strict.xsd http://www.w3.org/2002/ 
> xforms http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd" >
>
>     <xs:redefine schemaLocation="http://www.w3.org/2002/08/xhtml/ 
> xhtml1-strict.xsd" >
>         <xs:complexType name="head">
>             <xs:complexContent>
>                 <xs:extension base="xhtml:head">
>                     <xs:sequence>
>                         <xs:element ref="xforms:model"/>
>                     </xs:sequence>
>                 </xs:extension>
>             </xs:complexContent>
>         </xs:complexType>
>     </xs:redefine>
>
> </xs:schema>