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 xin wang <xv...@yahoo.com> on 2001/11/17 05:02:14 UTC
validate instance doc against schema
I am trying to use DOMCount or similar programs in
bin/
that come with the 1.5.2 binary distribution to
validate an xml doc against its schema. It seems to
work except when I try to force an id of an element to
be unique. I don't get error messages even when there
are duplicates. I have not tried the key/keyref
feature
yet.
Can anyone help please?
Thanks.
victoria
__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: validate instance doc against schema
Posted by xin wang <xv...@yahoo.com>.
Yes. My command line is
%DOMCount -v=always -n -s -f the_xml_file_name
I expect an error because both id attributes are "1"
when it is required to be unique in the schema.
Am I missing something obvious?
victoria
The schema is
<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root" type="root">
<xs:key name="element1_id">
<xs:selector xpath="element1"/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
<xs:element name="element1" type="element1"/>
<xs:complexType name="root">
<xs:sequence>
<xs:element ref="element1" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="element1">
<xs:all>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="investigator" type="xs:string"/>
<xs:element name="comments" type="xs:string"/>
</xs:all>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
The xml file is:
<?xml version="1.0"?>
<root
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="study.xsd">
<element1 id="1">
<name>abcd</name>
<description>abcd</description>
<comments>abcd</comments>
<investigator>abcd</investigator>
</element1>
<element1 id="1">
<name>bcde</name>
<description>bcde</description>
<comments>bcde</comments>
<investigator>bcde</investigator>
</element1>
</root>
--- Tinny Ng <tn...@ca.ibm.com> wrote:
> Have you turned on
> "setValidationSchemaFullChecking", i.e. option "-f"
> in
> DOMCount? See
>
http://xml.apache.org/xerces-c/apiDocs/class_DOMParser.html#a31
> for
> description of setValidationSchemaFullChecking.
>
> Tinny
>
> xin wang wrote:
>
> > I am trying to use DOMCount or similar programs in
> > bin/
> > that come with the 1.5.2 binary distribution to
> > validate an xml doc against its schema. It seems
> to
> > work except when I try to force an id of an
> element to
> > be unique. I don't get error messages even when
> there
> > are duplicates. I have not tried the key/keyref
> > feature
> > yet.
> >
> > Can anyone help please?
> >
> > Thanks.
> >
> > victoria
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Find the one for you at Yahoo! Personals
> > http://personals.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > 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
>
__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: validate instance doc against schema
Posted by Tinny Ng <tn...@ca.ibm.com>.
Have you turned on "setValidationSchemaFullChecking", i.e. option "-f" in
DOMCount? See
http://xml.apache.org/xerces-c/apiDocs/class_DOMParser.html#a31 for
description of setValidationSchemaFullChecking.
Tinny
xin wang wrote:
> I am trying to use DOMCount or similar programs in
> bin/
> that come with the 1.5.2 binary distribution to
> validate an xml doc against its schema. It seems to
> work except when I try to force an id of an element to
> be unique. I don't get error messages even when there
> are duplicates. I have not tried the key/keyref
> feature
> yet.
>
> Can anyone help please?
>
> Thanks.
>
> victoria
>
> __________________________________________________
> Do You Yahoo!?
> Find the one for you at Yahoo! Personals
> http://personals.yahoo.com
>
> ---------------------------------------------------------------------
> 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