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 Stefan Eder <st...@ebuconnect.de> on 2007/04/18 15:54:33 UTC

Strange problem related to Schema validation

Hi All,
Currently I am encountering a pretty strange problem.
     <xddl:column-ref name="column1"/>
brings me: The element type "xddl:column-ref" must be terminated by the
matching end-tag "</xddl:column-ref>".
     <xddl:column-ref name="column">
     </xddl:column-ref>
works fine.

Related schema spippet:
     <xs:element name="column-ref">
         <xs:complexType>
             <xs:attribute name="name" type="xs:string" use="required"/>
         </xs:complexType>
     </xs:element>

Product: Xerces2 Java Parser 2.8.1
Using org.apache.xerces.parsers.XMLGrammarCachingConfiguration, one
parent for global configuration, one child to be able to supply a task
specific error reporter.
Explicit feature settings:
NAMESPACES_FEATURE                    true
SCHEMA_VALIDATION_FEATURE:            true
DYNAMIC_VALIDATION_FEATURE:           true
HONOUR_ALL_SCHEMALOCATIONS_FEATURE:   true
XINCLUDE_FEATURE:                     true
XINCLUDE_FIXUP_BASE_URIS_FEATURE:     true
XINCLUDE_FIXUP_LANGUAGE_FEATURE:      true

Creating parent XMLGrammarCachingConfiguration with
org.apache.xerces.util.XMLGrammarPoolImpl and
org.apache.xerces.util.SymbolTable.
Supplying own property for ENTITY_RESOLVER_PROPERTY (parent) inherited
from org.apache.xerces.xni.parser.XMLEntityResolver.
Supplying own property for ERROR_REPORTER_PROPERTY (child) inherited
from org.apache.xerces.impl.XMLErrorReporter.
Both components are working as expected.

Any ideas/hints/suggestions?
Thanks, Stefan



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


Re: Strange problem related to Schema validation

Posted by Stefan Eder <st...@ebuconnect.de>.
Hi Michael,
WST (Web Standard Tools) is a sub project of WTP (Web Tools Platform), 
which is a sub project of Eclipse.
WST provides users with some good structured editing capabilities and 
this includes editing of XML files.
In cases where a grammar (either DTD or Schema) is specified, it 
supports the user also with nice things like "validation as you type" 
and code completion/suggestion.
Unfortunately it does not yet support XInclude, but I need it and so I 
am currently writing an extension that supports XInclude and that will 
become the base for a group of structured editors.
WST provides a mechanism that allows to plug in new validating 
components and the association between validating component and file is 
made by file name patterns, usually extensions.
So I have registered my validating component with the extension *.ixml, 
this is more or less just a test case right now.
If I now have two files with identical content, one named test.xml and 
the other named test.ixml and I validate both from within the Eclipse 
environment, test.xml is validated by the build-in validating component 
of WST and test.ixml is validated by my own validating component. This 
has nothing to with Xerces, but with the associations made by the framework.
This is the background.
I want to use XNI not only because of support for XInclude (JAXP would 
be sufficient), but also because I see some more advantages that are 
related to the flexible design of XNI. I want to cache the parsed 
grammars to improve speed and later I might wrap something around the 
XInclude components of XNI to enhance the user percepted response times 
by checking file modification timestamps of xincluded files and skip 
their revalidation if they haven't been touched since a recent 
validation run. Or I might put some own components into the pipeline 
that collect information during the validation process that can later be 
used i.e. for code suggestions.
I have had my validating component already working using JAXP, but then 
I read about XNI and thought this might be the better way to move on.
Now I am struggling with this weird effect, but I don't want to give up 
at this point and switch back to JAXP. At least not so fast.
Perhaps I should really give a priest a chance to fix this issue with 
some prayers, if it would not help, it would not harm either ;-)
And I am using Xerces directly. Perhaps the problem is related to the 
fact that there are different Xerces implementations in my environment. 
But then I would expect a class cast exception at some point and not 
what I actually get.
Thanks and regards.

Michael Glavassevich schrieb:
> Hi Stefan,
>
> Not being a user of WST, I'm not sure what "Xerces based" validation with 
> WST implies. Are you actually using Xerces directly or is there something 
> else calling into it? Perhaps WST is causing this failure. Xerces' 
> behaviour certainly isn't sensitive to file extensions.
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Stefan Eder <st...@ebuconnect.de> wrote on 04/18/2007 01:59:52 PM:
>
>> Hi Michael,
>> It is really weird and it is not a well-formedness error, or at 
>> least I cannot see it.
>> I can validate the identical content with an extension of *.xml 
>> without errors, but if I rename the file to *.ixml (that triggers 
>> the validation I am building with Xerces within my environment), I 
>> get this strange behavior. The working validation is also Xerces 
>> based (Eclipse/WST), but I want to get the advantages of grammar 
>> caching, xinclude etc.
>> And in fact, the working validation method does not allow the 
>> workaround for the buggy validation method like:
>>      <xddl:column-ref name="column">
>>      </xddl:column-ref>
>> Then I get the error: cvc-complex-type.2.1: Element 'xddl:column-
>> ref' must have no character or element information item [children], 
>> because the type's content type is empty. This is an error that 
>> makes sense to me.
>> It must be:
>>     <xddl:column-ref name="column"></xddl:column-ref>
>> or, what I want, simply:
>>     <xddl:column-ref name="column"/>
>> to pass the working validation without errors, but this doesn't work
>> for the buggy one.
>> I am already thinking about to call the nearest priest and ask him 
>> to hunt the devil out of my box ;-)
>> This is the complete file:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xddl:logical-group 
>>     xmlns:xddl="http://schemas.ebuconnect.com/xddl" 
>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>     xsi:schemaLocation="http://schemas.ebuconnect.com/xddl xddl.xsd"
>>     name="root">
>>     <xddl:logical-group name="sub1">
>>         <xddl:table name="table1">
>>             <xddl:column name="column1" type="varchar" size="20"/>
>>             <xddl:column name="column2" type="varchar" size="20"/>
>>             <xddl:primary-key name="pk_table1">
>>                 <xddl:column-ref name="column1"/>
>>                 <xddl:column-ref name="column2"/>
>>             </xddl:primary-key>
>>         </xddl:table>
>>     </xddl:logical-group>
>>     <xddl:logical-group name="sub2">
>>         <xddl:table name="table1">
>>             <xddl:column name="column1" type="varchar" size="20"/>
>>             <xddl:column name="column2" type="varchar" size="20"/>
>>             <xddl:primary-key name="pk_table1">
>>                 <xddl:column-ref name="column1"/>
>>             </xddl:primary-key>
>>             <xddl:foreign-key name="fk_table1">
>>                 <xddl:constraint-ref contstraint="pk_table1" 
>> table="/root/sub1/table1"/>
>>                 <xddl:column-ref name="column1"/>
>>                 <xddl:column-ref name="column2"/>
>>             </xddl:foreign-key>
>>         </xddl:table>
>>     </xddl:logical-group>
>> </xddl:logical-group>
>>
>> I have some key constraints within my Schema that enforce unique 
>> names of several elements. Not globally, but within the scope of 
>> their parent elements and some keyref constraints to ensure the 
>> existence of matching counterparts for some references on those 
> elements. 
>> Also I am using substitution group constructs like this:
>>     <xs:element name="constraint" abstract="true"/>
>>     <xs:element name="non-primary-key" substitutionGroup="xddl:
>> constraint" abstract="true"/>
>>     <xs:element name="index" substitutionGroup="xddl:non-primary-key">
>>     <!-- ... -->
>>     </xs:element>
>>     <xs:element name="unique" substitutionGroup="xddl:non-primary-key">
>>     <!-- ... -->
>>     </xs:element>
>>     <xs:element name="foreign-key" 
> substitutionGroup="xddl:non-primary-key">
>>     <!-- ... -->
>>     </xs:element>
>>     <xs:element name="table">
>>         <xs:complexType>
>>             <xs:sequence>
>>                 <xs:element ref="xddl:column" minOccurs="1" 
>> maxOccurs="unbounded"/>
>>                 <xs:element ref="xddl:primary-key" minOccurs="0" 
>> maxOccurs="1"/>
>>                 <xs:element ref="xddl:non-primary-key" minOccurs="0"
>> maxOccurs="unbounded"/>
>>             </xs:sequence>
>>             <xs:attribute name="name" type="xs:string" use="required"/>
>>             <!-- ... -->
>>             <xs:attributeGroup ref="xml:specialAttrs"/>
>>         </xs:complexType>
>>     <!-- ... -->
>>     </xs:element>
>>
>> But all in all the Schema is neither big nor complex, just work in 
>> progress (unfortunately not so much progress at the moment).
>> Thanks for your response, any further ideas/hints/suggestions will 
>> be very appreciated.
>> Regards, Stefan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>

Re: Strange problem related to Schema validation

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Stefan,

Not being a user of WST, I'm not sure what "Xerces based" validation with 
WST implies. Are you actually using Xerces directly or is there something 
else calling into it? Perhaps WST is causing this failure. Xerces' 
behaviour certainly isn't sensitive to file extensions.

Thanks.

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

Stefan Eder <st...@ebuconnect.de> wrote on 04/18/2007 01:59:52 PM:

> Hi Michael,
> It is really weird and it is not a well-formedness error, or at 
> least I cannot see it.
> I can validate the identical content with an extension of *.xml 
> without errors, but if I rename the file to *.ixml (that triggers 
> the validation I am building with Xerces within my environment), I 
> get this strange behavior. The working validation is also Xerces 
> based (Eclipse/WST), but I want to get the advantages of grammar 
> caching, xinclude etc.
> And in fact, the working validation method does not allow the 
> workaround for the buggy validation method like:
>      <xddl:column-ref name="column">
>      </xddl:column-ref>
> Then I get the error: cvc-complex-type.2.1: Element 'xddl:column-
> ref' must have no character or element information item [children], 
> because the type's content type is empty. This is an error that 
> makes sense to me.
> It must be:
>     <xddl:column-ref name="column"></xddl:column-ref>
> or, what I want, simply:
>     <xddl:column-ref name="column"/>
> to pass the working validation without errors, but this doesn't work
> for the buggy one.
> I am already thinking about to call the nearest priest and ask him 
> to hunt the devil out of my box ;-)
> This is the complete file:
> <?xml version="1.0" encoding="UTF-8"?>
> <xddl:logical-group 
>     xmlns:xddl="http://schemas.ebuconnect.com/xddl" 
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>     xsi:schemaLocation="http://schemas.ebuconnect.com/xddl xddl.xsd"
>     name="root">
>     <xddl:logical-group name="sub1">
>         <xddl:table name="table1">
>             <xddl:column name="column1" type="varchar" size="20"/>
>             <xddl:column name="column2" type="varchar" size="20"/>
>             <xddl:primary-key name="pk_table1">
>                 <xddl:column-ref name="column1"/>
>                 <xddl:column-ref name="column2"/>
>             </xddl:primary-key>
>         </xddl:table>
>     </xddl:logical-group>
>     <xddl:logical-group name="sub2">
>         <xddl:table name="table1">
>             <xddl:column name="column1" type="varchar" size="20"/>
>             <xddl:column name="column2" type="varchar" size="20"/>
>             <xddl:primary-key name="pk_table1">
>                 <xddl:column-ref name="column1"/>
>             </xddl:primary-key>
>             <xddl:foreign-key name="fk_table1">
>                 <xddl:constraint-ref contstraint="pk_table1" 
> table="/root/sub1/table1"/>
>                 <xddl:column-ref name="column1"/>
>                 <xddl:column-ref name="column2"/>
>             </xddl:foreign-key>
>         </xddl:table>
>     </xddl:logical-group>
> </xddl:logical-group>
> 
> I have some key constraints within my Schema that enforce unique 
> names of several elements. Not globally, but within the scope of 
> their parent elements and some keyref constraints to ensure the 
> existence of matching counterparts for some references on those 
elements. 
> Also I am using substitution group constructs like this:
>     <xs:element name="constraint" abstract="true"/>
>     <xs:element name="non-primary-key" substitutionGroup="xddl:
> constraint" abstract="true"/>
>     <xs:element name="index" substitutionGroup="xddl:non-primary-key">
>     <!-- ... -->
>     </xs:element>
>     <xs:element name="unique" substitutionGroup="xddl:non-primary-key">
>     <!-- ... -->
>     </xs:element>
>     <xs:element name="foreign-key" 
substitutionGroup="xddl:non-primary-key">
>     <!-- ... -->
>     </xs:element>
>     <xs:element name="table">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element ref="xddl:column" minOccurs="1" 
> maxOccurs="unbounded"/>
>                 <xs:element ref="xddl:primary-key" minOccurs="0" 
> maxOccurs="1"/>
>                 <xs:element ref="xddl:non-primary-key" minOccurs="0"
> maxOccurs="unbounded"/>
>             </xs:sequence>
>             <xs:attribute name="name" type="xs:string" use="required"/>
>             <!-- ... -->
>             <xs:attributeGroup ref="xml:specialAttrs"/>
>         </xs:complexType>
>     <!-- ... -->
>     </xs:element>
> 
> But all in all the Schema is neither big nor complex, just work in 
> progress (unfortunately not so much progress at the moment).
> Thanks for your response, any further ideas/hints/suggestions will 
> be very appreciated.
> Regards, Stefan


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


Re: Strange problem related to Schema validation

Posted by Stefan Eder <st...@ebuconnect.de>.
Hi Michael,
It is really weird and it is not a well-formedness error, or at least I 
cannot see it.
I can validate the identical content with an extension of *.xml without 
errors, but if I rename the file to *.ixml (that triggers the validation 
I am building with Xerces within my environment), I get this strange 
behavior. The working validation is also Xerces based (Eclipse/WST), but 
I want to get the advantages of grammar caching, xinclude etc.
And in fact, the working validation method does not allow the workaround 
for the buggy validation method like:
     <xddl:column-ref name="column">
     </xddl:column-ref>
Then I get the error: cvc-complex-type.2.1: Element 'xddl:column-ref' 
must have no character or element information item [children], because 
the type's content type is empty. This is an error that makes sense to me.
It must be:
    <xddl:column-ref name="column"></xddl:column-ref>
or, what I want, simply:
    <xddl:column-ref name="column"/>
to pass the working validation without errors, but this doesn't work for 
the buggy one.
I am already thinking about to call the nearest priest and ask him to 
hunt the devil out of my box ;-)
This is the complete file:
<?xml version="1.0" encoding="UTF-8"?>
<xddl:logical-group
    xmlns:xddl="http://schemas.ebuconnect.com/xddl"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://schemas.ebuconnect.com/xddl xddl.xsd"
    name="root">
    <xddl:logical-group name="sub1">
        <xddl:table name="table1">
            <xddl:column name="column1" type="varchar" size="20"/>
            <xddl:column name="column2" type="varchar" size="20"/>
            <xddl:primary-key name="pk_table1">
                <xddl:column-ref name="column1"/>
                <xddl:column-ref name="column2"/>
            </xddl:primary-key>
        </xddl:table>
    </xddl:logical-group>
    <xddl:logical-group name="sub2">
        <xddl:table name="table1">
            <xddl:column name="column1" type="varchar" size="20"/>
            <xddl:column name="column2" type="varchar" size="20"/>
            <xddl:primary-key name="pk_table1">
                <xddl:column-ref name="column1"/>
            </xddl:primary-key>
            <xddl:foreign-key name="fk_table1">
                <xddl:constraint-ref contstraint="pk_table1" 
table="/root/sub1/table1"/>
                <xddl:column-ref name="column1"/>
                <xddl:column-ref name="column2"/>
            </xddl:foreign-key>
        </xddl:table>
    </xddl:logical-group>
</xddl:logical-group>

I have some key constraints within my Schema that enforce unique names 
of several elements. Not globally, but within the scope of their parent 
elements and some keyref constraints to ensure the existence of matching 
counterparts for some references on those elements.
Also I am using substitution group constructs like this:
    <xs:element name="constraint" abstract="true"/>
    <xs:element name="non-primary-key" 
substitutionGroup="xddl:constraint" abstract="true"/>
    <xs:element name="index" substitutionGroup="xddl:non-primary-key">
    <!-- ... -->
    </xs:element>
    <xs:element name="unique" substitutionGroup="xddl:non-primary-key">
    <!-- ... -->
    </xs:element>
    <xs:element name="foreign-key" substitutionGroup="xddl:non-primary-key">
    <!-- ... -->
    </xs:element>
    <xs:element name="table">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="xddl:column" minOccurs="1" 
maxOccurs="unbounded"/>
                <xs:element ref="xddl:primary-key" minOccurs="0" 
maxOccurs="1"/>
                <xs:element ref="xddl:non-primary-key" minOccurs="0" 
maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <!-- ... -->
            <xs:attributeGroup ref="xml:specialAttrs"/>
        </xs:complexType>
    <!-- ... -->
    </xs:element>

But all in all the Schema is neither big nor complex, just work in 
progress (unfortunately not so much progress at the moment).
Thanks for your response, any further ideas/hints/suggestions will be 
very appreciated.
Regards, Stefan

Michael Glavassevich schrieb:
> Hi Stefan,
>
> Stefan Eder <st...@ebuconnect.de> wrote on 04/18/2007 09:54:33 AM:
>
>> Hi All,
>> Currently I am encountering a pretty strange problem.
>>      <xddl:column-ref name="column1"/>
>> brings me: The element type "xddl:column-ref" must be terminated by the
>> matching end-tag "</xddl:column-ref>".
>
> This is a well-formedness error; has nothing to do with schema validation. 
> Presumably you're actually missing an end-tag somewhere. Can you post the 
> entire document?
>
>>      <xddl:column-ref name="column">
>>      </xddl:column-ref>
>> works fine.
>
> Are you sure this is the only thing you changed?
>
>> Related schema spippet:
>>      <xs:element name="column-ref">
>>          <xs:complexType>
>>              <xs:attribute name="name" type="xs:string" use="required"/>
>>          </xs:complexType>
>>      </xs:element>
>>
>> Product: Xerces2 Java Parser 2.8.1
>> Using org.apache.xerces.parsers.XMLGrammarCachingConfiguration, one
>> parent for global configuration, one child to be able to supply a task
>> specific error reporter.
>> Explicit feature settings:
>> NAMESPACES_FEATURE                    true
>> SCHEMA_VALIDATION_FEATURE:            true
>> DYNAMIC_VALIDATION_FEATURE:           true
>> HONOUR_ALL_SCHEMALOCATIONS_FEATURE:   true
>> XINCLUDE_FEATURE:                     true
>> XINCLUDE_FIXUP_BASE_URIS_FEATURE:     true
>> XINCLUDE_FIXUP_LANGUAGE_FEATURE:      true
>>
>> Creating parent XMLGrammarCachingConfiguration with
>> org.apache.xerces.util.XMLGrammarPoolImpl and
>> org.apache.xerces.util.SymbolTable.
>> Supplying own property for ENTITY_RESOLVER_PROPERTY (parent) inherited
>> from org.apache.xerces.xni.parser.XMLEntityResolver.
>> Supplying own property for ERROR_REPORTER_PROPERTY (child) inherited
>> from org.apache.xerces.impl.XMLErrorReporter.
>> Both components are working as expected.
>>
>> Any ideas/hints/suggestions?
>> Thanks, Stefan
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>

Re: Strange problem related to Schema validation

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Stefan,

Stefan Eder <st...@ebuconnect.de> wrote on 04/18/2007 09:54:33 AM:

> Hi All,
> Currently I am encountering a pretty strange problem.
>      <xddl:column-ref name="column1"/>
> brings me: The element type "xddl:column-ref" must be terminated by the
> matching end-tag "</xddl:column-ref>".

This is a well-formedness error; has nothing to do with schema validation. 
Presumably you're actually missing an end-tag somewhere. Can you post the 
entire document?

>      <xddl:column-ref name="column">
>      </xddl:column-ref>
> works fine.

Are you sure this is the only thing you changed?

> Related schema spippet:
>      <xs:element name="column-ref">
>          <xs:complexType>
>              <xs:attribute name="name" type="xs:string" use="required"/>
>          </xs:complexType>
>      </xs:element>
> 
> Product: Xerces2 Java Parser 2.8.1
> Using org.apache.xerces.parsers.XMLGrammarCachingConfiguration, one
> parent for global configuration, one child to be able to supply a task
> specific error reporter.
> Explicit feature settings:
> NAMESPACES_FEATURE                    true
> SCHEMA_VALIDATION_FEATURE:            true
> DYNAMIC_VALIDATION_FEATURE:           true
> HONOUR_ALL_SCHEMALOCATIONS_FEATURE:   true
> XINCLUDE_FEATURE:                     true
> XINCLUDE_FIXUP_BASE_URIS_FEATURE:     true
> XINCLUDE_FIXUP_LANGUAGE_FEATURE:      true
> 
> Creating parent XMLGrammarCachingConfiguration with
> org.apache.xerces.util.XMLGrammarPoolImpl and
> org.apache.xerces.util.SymbolTable.
> Supplying own property for ENTITY_RESOLVER_PROPERTY (parent) inherited
> from org.apache.xerces.xni.parser.XMLEntityResolver.
> Supplying own property for ERROR_REPORTER_PROPERTY (child) inherited
> from org.apache.xerces.impl.XMLErrorReporter.
> Both components are working as expected.
> 
> Any ideas/hints/suggestions?
> Thanks, Stefan
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Thanks.

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

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