This example is a subset of an example found on
http://www.xml.com/pub/a/2002/11/13/normalizing.html#CarTable.
I removed a lot of tags and changed the realtor value to make it invalid but
when I validate it, no error are found.

Thanks a lot.
Patrick


Here is the XML file:

<?xml version="1.0" encoding="UTF-8"?>
<HousingUnitList xmlns="http://www.mybigrealtyco.com/WS/Housing";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.mybigrealtyco.com/WS/Housing Housing3.xsd">
  <HousingUnit unitID="JP0001">
    <amenities>
      <amenity>Off-street parking</amenity>
      <amenity>Washer/dryer</amenity>
      <amenity>Back yard (shared)</amenity>
    </amenities>
    <realtor xmlns:h="http://www.mybigrealtyco.com/WS/Housing";>Judy
Trueblood Bad Name</realtor>
  </HousingUnit>
  <RealtorList xmlns:h="http://www.mybigrealtyco.com/WS/Housing";>
    <Realtor>
                <contact>
      <name>Judy Trueblood</name>
    </contact></Realtor>
  </RealtorList></HousingUnitList>


Here is the schema:

<?xml version="1.0" encoding="UTF-8" ?>
<schema version="1.0" xmlns="http://www.w3.org/2001/XMLSchema";
xmlns:h="http://www.mybigrealtyco.com/WS/Housing";
targetNamespace="http://www.mybigrealtyco.com/WS/Housing";
elementFormDefault="qualified">
        <complexType name="BusinessEntity">
                <sequence>
                        <element name="name" type="string" />
                </sequence>
        </complexType>
        <complexType name="HousingUnit">
                <sequence>
                        <element name="amenities" minOccurs="0">
                                <complexType>
                                        <sequence>
                                                <element name="amenity" type="string" 
minOccurs="0"
maxOccurs="unbounded" />
                                        </sequence>
                                </complexType>
                        </element>
                        <element name="realtor" type="string" />
                </sequence>
                <attribute name="unitID" type="NCName" />
        </complexType>
        <complexType name="Realtor">
                <sequence>
                        <element name="contact" type="h:BusinessEntity" />
                </sequence>
        </complexType>
        <element name="HousingUnitList">
                <complexType>
                        <sequence>
                                <element name="HousingUnit" type="h:HousingUnit" 
minOccurs="0"
maxOccurs="unbounded" />
                                <element name="RealtorList">
                                        <complexType>
                                                <sequence>
                                                        <element name="Realtor" 
type="h:Realtor" minOccurs="0"
maxOccurs="unbounded" />
                                                </sequence>
                                        </complexType>
                                        <key name="RealtorKey">
                                                <selector xpath="./Realtor" />
                                                <field xpath="name" />
                                        </key>
                                </element>
                        </sequence>
                </complexType>
                <key name="UnitIDKey">
                        <selector xpath="Unit" />
                        <field xpath="@unitID" />
                </key>
                <keyref name="HousingUnitToRealtor" refer="h:RealtorKey">
                        <selector xpath="./Unit" />
                        <field xpath="realtor" />
                </keyref>
        </element>
</schema>



> -----Original Message-----
> From: Neil Graham [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 11, 2003 10:58 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Is Xerces able to validate key and keyref
>
>
>
>
>
>
> Hi Patrick,
>
> Yes, Xerces-C supports schema identity constraints.  There
> are a few ways
> in which beginning users go wrong when using schema identity
> constraints;
> the most common is that they think default namespace applies to XPath
> expressions when it doesn't.  In order to give you any more useful
> feedback, you'd have to post a (small) instance/schema pair
> that Xerces
> says is valid but which you think should be invalid.
>
> Cheers,
> Neil
> Neil Graham
> XML Parser Development
> IBM Toronto Lab
> Phone:  905-413-3519, T/L 969-3519
> E-mail:  [EMAIL PROTECTED]
>
>
>
>
>
>
>
>                       "Patrick
>
>
>                       Blanchette"              To:
> <[EMAIL PROTECTED]>
>
>                       <[EMAIL PROTECTED]        cc:
>
>
>                       vio.com>                 Subject:  RE:
> Is Xerces able to validate key and keyref
>
>
>
>
>                       09/11/2003 10:53
>
>
>                       AM
>
>
>                       Please respond to
>
>
>                       xerces-c-dev
>
>
>
>
>
>
>
>
>
>
>
>
> Ok,
> Looks like that there is a lot of code about identity constraints in
> xerces.
> What is the purpose of this code?
>
> Would there by any advantage of using key-keyref in my schema
> when parsing
> with xerces?
>
> Thanks
> Patrick
>
> > -----Original Message-----
> > From: Erik Rydgren [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 11, 2003 10:36 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: RE: Is Xerces able to validate key and keyref
> >
> >
> > The key integrity check is only performed at parse time during
> > validation.
> > There is no support for the functionality that you request. Sorry.
> >
> > Regards
> > Erik Rydgren
> > Mandarin financial solutions
> > Sweden
> >
> >
> > > -----Original Message-----
> > > From: Patrick Blanchette [mailto:[EMAIL PROTECTED]
> > > Sent: den 11 september 2003 15:58
> > > To: [EMAIL PROTECTED]
> > > Subject: Is Xerces able to validate key and keyref
> > >
> > > Hi,
> > >   I  want to validate that a key refered by a keyref really exist.
> > I
> > > create
> > > a schema that establish a relation between 2 XML nodes using
> > key-keyref.
> > > I
> > > create an XML file that respect the schema, the xml is validated
> > > successfully.  My problem is that it seems that there is no
> > integrity
> > > validation.  I could remove data refered by another node without
> > errors or
> > > warnings.
> > >
> > >   Does Xerces support integrity validation?  If it does, how could
> > I
> > > activate
> > > it?
> > >
> > >   I tried it using xerces-c-2.3.0
> > >
> > > thanks,
> > > Patrick
> > >
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> #### winmail.dat has been removed from this note on September
> 11 2003 by
> Neil Graham
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to