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 Jim Cole <gr...@yggdrasill.net> on 2002/04/02 02:16:26 UTC
Problems using
Hi - I am having troubles with the use of the 'unique' element.
An example of the manner in which I am attempting to use it is
listed below. The SAX2Count example run with the -f and -p does
not report an error when the eid attributes are not unique.
If I get rid of the targetNamespace and make the corresponding
changes to the sample schema and document, then 'unique' works as
I would expect. Any idea where I am going wrong? I tried to read
through the appropriate sections of the spec, but I don't see any
obvious problems. I seem to be running into similar problems with
the use of key/keyref.
--- SCHEMA ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<schema targetNamespace="http://www.example.com/Per"
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:per="http://www.example.com/Per">
<element name="personnel">
<complexType>
<sequence>
<element ref="per:person" minOccurs='1'
maxOccurs='unbounded'/>
</sequence>
</complexType>
<unique name="unique1">
<selector xpath="per:person"/>
<field xpath="@eid"/>
</unique>
</element>
<element name="person">
<complexType>
<attribute name="eid" type="string" use="required"/>
<attribute name="name" type="string" use="required"/>
</complexType>
</element>
</schema>
---- SAMPLE DOC ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<personnel xmlns="http://www.example.com/Per"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.com/Per
tns.xsd">
<person eid="1" name="Bill"/>
<person eid="2" name="Paul"/>
<person eid="4" name="Joe"/>
<person eid="4" name="Paul"/>
</personnel>
Regards,
Jim
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Problems using
Posted by Jim Cole <gr...@yggdrasill.net>.
Hi - Using the 20020404172017 snapshot, I am now seeing the
behavior that I expected. Thanks so much!
Jim Cole
Khaled Noaman's bits of Tue, 2 Apr 2002 translated to:
>Hi Jim,
>
>We have put a fix in CVS. Would you please download the latest
>code and try again? FYI, here is the diff:
>
>RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/QName.cpp,v
>retrieving revision 1.1.1.1
>diff -r1.1.1.1 QName.cpp
>417,419c417,421
>< return (XMLString::compareString(fPrefix, qname.getPrefix())==0) &&
>< (XMLString::compareString(fLocalPart, qname.getLocalPart())==0)
>&&
>< (fURIId == qname.getURI());
>---
>> if (fURIId == 0) // null URI
>> return
>(XMLString::compareString(getRawName(),qname.getRawName())==0);
>>
>> return ((fURIId == qname.getURI()) &&
>> (XMLString::compareString(fLocalPart,
>qname.getLocalPart())==0));
>
>Regards,
>Khaled
>
>Jim Cole wrote:
>
>> Hi - I am having troubles with the use of the 'unique' element.
>> An example of the manner in which I am attempting to use it is
>> listed below. The SAX2Count example run with the -f and -p does
>> not report an error when the eid attributes are not unique.
>>
>> If I get rid of the targetNamespace and make the corresponding
>> changes to the sample schema and document, then 'unique' works as
>> I would expect. Any idea where I am going wrong? I tried to read
>> through the appropriate sections of the spec, but I don't see any
>> obvious problems. I seem to be running into similar problems with
>> the use of key/keyref.
>>
>> --- SCHEMA ---
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <schema targetNamespace="http://www.example.com/Per"
>> xmlns='http://www.w3.org/2001/XMLSchema'
>> xmlns:per="http://www.example.com/Per">
>>
>> <element name="personnel">
>> <complexType>
>> <sequence>
>> <element ref="per:person" minOccurs='1'
>> maxOccurs='unbounded'/>
>> </sequence>
>> </complexType>
>>
>> <unique name="unique1">
>> <selector xpath="per:person"/>
>> <field xpath="@eid"/>
>> </unique>
>> </element>
>>
>> <element name="person">
>> <complexType>
>> <attribute name="eid" type="string" use="required"/>
>> <attribute name="name" type="string" use="required"/>
>> </complexType>
>> </element>
>> </schema>
>> ---- SAMPLE DOC ---
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>
>> <personnel xmlns="http://www.example.com/Per"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://www.example.com/Per
>> tns.xsd">
>> <person eid="1" name="Bill"/>
>> <person eid="2" name="Paul"/>
>> <person eid="4" name="Joe"/>
>> <person eid="4" name="Paul"/>
>> </personnel>
>>
>> Regards,
>>
>> Jim
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Problems using
Posted by Khaled Noaman <kn...@ca.ibm.com>.
Hi Jim,
We have put a fix in CVS. Would you please download the latest
code and try again? FYI, here is the diff:
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/QName.cpp,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 QName.cpp
417,419c417,421
< return (XMLString::compareString(fPrefix, qname.getPrefix())==0) &&
< (XMLString::compareString(fLocalPart, qname.getLocalPart())==0)
&&
< (fURIId == qname.getURI());
---
> if (fURIId == 0) // null URI
> return
(XMLString::compareString(getRawName(),qname.getRawName())==0);
>
> return ((fURIId == qname.getURI()) &&
> (XMLString::compareString(fLocalPart,
qname.getLocalPart())==0));
Regards,
Khaled
Jim Cole wrote:
> Hi - I am having troubles with the use of the 'unique' element.
> An example of the manner in which I am attempting to use it is
> listed below. The SAX2Count example run with the -f and -p does
> not report an error when the eid attributes are not unique.
>
> If I get rid of the targetNamespace and make the corresponding
> changes to the sample schema and document, then 'unique' works as
> I would expect. Any idea where I am going wrong? I tried to read
> through the appropriate sections of the spec, but I don't see any
> obvious problems. I seem to be running into similar problems with
> the use of key/keyref.
>
> --- SCHEMA ---
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <schema targetNamespace="http://www.example.com/Per"
> xmlns='http://www.w3.org/2001/XMLSchema'
> xmlns:per="http://www.example.com/Per">
>
> <element name="personnel">
> <complexType>
> <sequence>
> <element ref="per:person" minOccurs='1'
> maxOccurs='unbounded'/>
> </sequence>
> </complexType>
>
> <unique name="unique1">
> <selector xpath="per:person"/>
> <field xpath="@eid"/>
> </unique>
> </element>
>
> <element name="person">
> <complexType>
> <attribute name="eid" type="string" use="required"/>
> <attribute name="name" type="string" use="required"/>
> </complexType>
> </element>
> </schema>
> ---- SAMPLE DOC ---
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <personnel xmlns="http://www.example.com/Per"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.example.com/Per
> tns.xsd">
> <person eid="1" name="Bill"/>
> <person eid="2" name="Paul"/>
> <person eid="4" name="Joe"/>
> <person eid="4" name="Paul"/>
> </personnel>
>
> Regards,
>
> Jim
>
> ---------------------------------------------------------------------
> 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