You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Joachim Achtzehnter <jo...@netacquire.com> on 2001/12/05 20:44:30 UTC

Testing Full Schema support in 1.6.0 candidate

Hi,

Was trying to test the full schema support in the 1.6.0 candidate using
saxprint.exe. I'm specifically interested in key/keyref support, but the
parser (run with -n -s -f) seems to ignore all my key and keyref
declarations. Other schema validation appears to work.

Does anybody have an example schema that uses key/keyref and is known to
work with 1.6.0?

Joachim

-- 
work:     joachima@netacquire.com   (http://www.netacquire.com)
private:  joachim@kraut.ca          (http://www.kraut.ca)



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


Re: Testing Full Schema support in 1.6.0 candidate

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Yes.

joachima@van4.netacquire.com wrote:

> Hi Khaled,
>
> You wrote:
> >
> > The fix is in CVS. I have attached the diff for your reference.
>
> Thanks a bundle. This appears to work now. Will these two bug fixes make
> it into the final 1.6.0 release?
>
> Joachim
>
> --
> work:     joachima@netacquire.com   (http://www.netacquire.com)
> private:  joachim@kraut.ca          (http://www.kraut.ca)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


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


Re: Schema support in 1.6.0 (unique/key)

Posted by Joachim Achtzehnter <jo...@netacquire.com>.
Hi Khaled,

You wrote:
>
> Here is the fix:

Thanks again! It now works (famous last words...).

Joachim

-- 
work:     joachima@netacquire.com   (http://www.netacquire.com)
private:  joachim@kraut.ca          (http://www.kraut.ca)


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


Re: Schema support in 1.6.0 (unique/key)

Posted by Khaled Noaman <kn...@ca.ibm.com>.
:-(

Here is the fix:

Index: TraverseSchema.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/schema/TraverseSchema.cpp,v
retrieving revision 1.73
diff -r1.73 TraverseSchema.cpp
3936c3936
<         fBuffer.append(xpathExpr + startIndex, chOffset + 1);
---
>         fBuffer.append(xpathExpr + startIndex, chOffset + 1 - startIndex);

Regards,
Khaled


joachima@van4.netacquire.com wrote:

> Dec 6, I wrote:
> >
> > Hi Khaled,
> >
> > You wrote:
> > >
> > > The fix is in CVS. I have attached the diff for your reference.
> >
> > Thanks a bundle. This appears to work now. Will these two bug fixes make
> > it into the final 1.6.0 release?
>
> Let me take this back. :-)
>
> Union support in schema "unique" or "key" selectors now works as long as
> there are at most two choices. It still doesn't work for the general case,
> for example something like this:
>
>    <xs:selector xpath="one|two|three|four" />
>
> In this case everything except "one" and "two" are being ignored.
>
> Below is an example that should fail the unique constraint because of the
> duplicated "bar1" value, but Xerces 1.6.0 doesn't detect this violation.
>
> Joachim
>
> --
> work:     joachima@netacquire.com   (http://www.netacquire.com)
> private:  joachim@kraut.ca          (http://www.kraut.ca)
>
> -- union.xml ------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <database xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>           xsi:noNamespaceSchemaLocation="union.xsd">
>
> <table1 key="foo1"/>
> <table1 key="bar1"/>
>
> <table2 key="foo2"/>
> <table2 key="bar2"/>
>
> <table3 key="foo3"/>
> <table3 key="bar1"/>  <!-- violates unique constraint -->
>
> </database>
> -------------------------------------------------------------------------
>
> -- union.xsd ------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
>  <xs:element name="database">
>   <xs:complexType>
>    <xs:sequence>
>
>      <xs:element name="table1" minOccurs="0" maxOccurs="unbounded">
>       <xs:complexType>
>        <xs:attribute name="key"/>
>       </xs:complexType>
>      </xs:element>
>
>      <xs:element name="table2" minOccurs="0" maxOccurs="unbounded">
>       <xs:complexType>
>        <xs:attribute name="key"/>
>       </xs:complexType>
>      </xs:element>
>
>      <xs:element name="table3" minOccurs="0" maxOccurs="unbounded">
>       <xs:complexType>
>        <xs:attribute name="key"/>
>       </xs:complexType>
>      </xs:element>
>
>    </xs:sequence>
>   </xs:complexType>
>
>   <xs:unique name="common_key">
>    <xs:selector xpath="table1|table2|table"/>
>    <xs:field xpath="@key"/>
>   </xs:unique>
>
>  </xs:element>
> </xs:schema>
> -------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


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


Re: Schema support in 1.6.0 (unique/key)

Posted by Joachim Achtzehnter <jo...@netacquire.com>.
Just a quick followup:

I wrote:
>
> Below is an example that should fail the unique constraint because of the
> duplicated "bar1" value, but Xerces 1.6.0 doesn't detect this violation.

The schema I provided included a small typo. Replace

   <xs:selector xpath="table1|table2|table"/>

by the intended:

   <xs:selector xpath="table1|table2|table3"/>

Note, the 3 was missing. Xerces 1.6.0 still doesn't detect the uniqueness
violation...

Joachim

-- 
work:     joachima@netacquire.com (http://www.netacquire.com)
private:  joachim@kraut.ca (http://www.kraut.ca)



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


Schema support in 1.6.0 (unique/key)

Posted by Joachim Achtzehnter <jo...@netacquire.com>.
Dec 6, I wrote:
>
> Hi Khaled,
>
> You wrote:
> >
> > The fix is in CVS. I have attached the diff for your reference.
>
> Thanks a bundle. This appears to work now. Will these two bug fixes make
> it into the final 1.6.0 release?

Let me take this back. :-)

Union support in schema "unique" or "key" selectors now works as long as
there are at most two choices. It still doesn't work for the general case,
for example something like this:

   <xs:selector xpath="one|two|three|four" />

In this case everything except "one" and "two" are being ignored.

Below is an example that should fail the unique constraint because of the
duplicated "bar1" value, but Xerces 1.6.0 doesn't detect this violation.

Joachim

-- 
work:     joachima@netacquire.com   (http://www.netacquire.com)
private:  joachim@kraut.ca          (http://www.kraut.ca)

-- union.xml ------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<database xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	  xsi:noNamespaceSchemaLocation="union.xsd">

<table1 key="foo1"/>
<table1 key="bar1"/>

<table2 key="foo2"/>
<table2 key="bar2"/>

<table3 key="foo3"/>
<table3 key="bar1"/>  <!-- violates unique constraint -->

</database>
-------------------------------------------------------------------------

-- union.xsd ------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <xs:element name="database">
  <xs:complexType>
   <xs:sequence>

     <xs:element name="table1" minOccurs="0" maxOccurs="unbounded">
      <xs:complexType>
       <xs:attribute name="key"/>
      </xs:complexType>
     </xs:element>

     <xs:element name="table2" minOccurs="0" maxOccurs="unbounded">
      <xs:complexType>
       <xs:attribute name="key"/>
      </xs:complexType>
     </xs:element>

     <xs:element name="table3" minOccurs="0" maxOccurs="unbounded">
      <xs:complexType>
       <xs:attribute name="key"/>
      </xs:complexType>
     </xs:element>

   </xs:sequence>
  </xs:complexType>

  <xs:unique name="common_key">
   <xs:selector xpath="table1|table2|table"/>
   <xs:field xpath="@key"/>
  </xs:unique>

 </xs:element>
</xs:schema>
-------------------------------------------------------------------------


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


Re: Testing Full Schema support in 1.6.0 candidate

Posted by Joachim Achtzehnter <jo...@netacquire.com>.
Hi Khaled,

You wrote:
>
> The fix is in CVS. I have attached the diff for your reference.

Thanks a bundle. This appears to work now. Will these two bug fixes make
it into the final 1.6.0 release?

Joachim

-- 
work:     joachima@netacquire.com   (http://www.netacquire.com)
private:  joachim@kraut.ca          (http://www.kraut.ca)


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


Re: Testing Full Schema support in 1.6.0 candidate

Posted by Khaled Noaman <kn...@ca.ibm.com>.
You're not off base. In your example, the union operator would force
uniqueness of the name attribute across both types of elements.
That's a bug.

The fix is in CVS. I have attached the diff for your reference.

Khaled

joachima@van4.netacquire.com wrote:

> Khaled Noaman wrote:
> >
> > There is a small fix that you need to apply to XUtil.cpp.
> > In XUtil::getNextSiblingElementNS and XUtil::getFirstChildElementNS replace
> > 'getNodeName()' with 'getLocalName()'.
> >
> > Would you please apply that fix, and test the parser again? If the parser is
> > still ignoring the identity constraints, would you please post an example to
> > the mailing list?
>
> Yes, this helps. Thanks.
>
> Another question: Does the union operator in a selector work? Take the
> following uniqueness constraint as an example:
>
>   <xs:unique name="element_key">
>    <xs:selector xpath="element_one|element_two" />
>    <xs:field xpath="@name" />
>   </xs:unique>
>
> My expectation was that this should enforce uniquenes of the name
> attribute across both types of elements. Instead, it seems that the
> element after the '|' is completely ignored, i.e. this behaves as if I had
> specified this:
>
>   <xs:unique name="element_key">
>    <xs:selector xpath="element_one" />
>    <xs:field xpath="@name" />
>   </xs:unique>
>
> Am I totally off-base here?
>
> Joachim
>
> --
> work:     joachima@netacquire.com   (http://www.netacquire.com)
> private:  joachim@kraut.ca          (http://www.kraut.ca)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

Re: Testing Full Schema support in 1.6.0 candidate

Posted by Joachim Achtzehnter <jo...@netacquire.com>.
Khaled Noaman wrote:
>
> There is a small fix that you need to apply to XUtil.cpp.
> In XUtil::getNextSiblingElementNS and XUtil::getFirstChildElementNS replace
> 'getNodeName()' with 'getLocalName()'.
>
> Would you please apply that fix, and test the parser again? If the parser is
> still ignoring the identity constraints, would you please post an example to
> the mailing list?

Yes, this helps. Thanks.

Another question: Does the union operator in a selector work? Take the
following uniqueness constraint as an example:

  <xs:unique name="element_key">
   <xs:selector xpath="element_one|element_two" />
   <xs:field xpath="@name" />
  </xs:unique>

My expectation was that this should enforce uniquenes of the name
attribute across both types of elements. Instead, it seems that the
element after the '|' is completely ignored, i.e. this behaves as if I had
specified this:

  <xs:unique name="element_key">
   <xs:selector xpath="element_one" />
   <xs:field xpath="@name" />
  </xs:unique>

Am I totally off-base here?

Joachim

-- 
work:     joachima@netacquire.com   (http://www.netacquire.com)
private:  joachim@kraut.ca          (http://www.kraut.ca)


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


Re: Testing Full Schema support in 1.6.0 candidate

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Hi Joachim,

There is a small fix that you need to apply to XUtil.cpp.
In XUtil::getNextSiblingElementNS and XUtil::getFirstChildElementNS replace
'getNodeName()' with 'getLocalName()'.

Would you please apply that fix, and test the parser again? If the parser is
still ignoring the identity constraints, would you please post an example to
the mailing list?

Thanks,
Khaled


joachima@van4.netacquire.com wrote:

> Hi,
>
> Was trying to test the full schema support in the 1.6.0 candidate using
> saxprint.exe. I'm specifically interested in key/keyref support, but the
> parser (run with -n -s -f) seems to ignore all my key and keyref
> declarations. Other schema validation appears to work.
>
> Does anybody have an example schema that uses key/keyref and is known to
> work with 1.6.0?
>
> Joachim
>
> --
> work:     joachima@netacquire.com   (http://www.netacquire.com)
> private:  joachim@kraut.ca          (http://www.kraut.ca)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


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