type xs xml,xerces idref problem,xs xml,element name activity,xsd field field,landmark graphics,xml desc,element of act,swim desc meaning,xsd element type xs xml, xml%%%type xs xml - FW: having problems with the "

[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

FW: having problems with the "|" in field's element in the xs

  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Subject: FW: having problems with the "|" in field's element in the xs:key el ement
  • From: Bill Riegel <BRiegel@l...>
  • Date: Thu, 22 May 2003 08:53:36 -0500

type xs xml


It seems from the discussion that you can have the Pipe, "|" in the field
xpath. So why does Xerces fails when parsing this student3.xml

Xerces fails when parsing the student3.xml
SEVERE: java.lang.RuntimeException: org.xml.sax.SAXParseException: Identity
Constraint error (cvc-identity-constraint.4.2.1):  element
"studentActivities" has a key with no value.


My guess is that it only sees the act:name in the field definition
	<field xpath="act:name|act:desc"/>

Note: If I have only name elements under activity. Xerces is happy.

So what is wrong ?


Schema
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.exampleU.com/activity"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:act="http://www.exampleU.com/activity" elementFormDefault="qualified">
  <element name="studentActivity">
    <complexType>
      <sequence>
        <element name="studentID" type="normalizedString"/>
        <element name="activity" type="normalizedString"/>
        <!--<element name="studentID" type="IDREF"/> -->
      </sequence>
    </complexType>
  </element>
  <element name="activity">
    <complexType>
      <sequence>
        <choice>
          <element name="name" type="normalizedString"/>
          <element name="desc" type="normalizedString"/>
        </choice>
        <element name="fee" type="decimal"/>
      </sequence>
    </complexType>
  </element>
  <element name="studentActivities">
    <complexType>
      <sequence>
        <element ref="act:studentActivity" maxOccurs="unbounded"/>
        <element name="activities">
          <complexType>
            <sequence>
              <element ref="act:activity" maxOccurs="unbounded"/>
            </sequence>
          </complexType>
        </element>
      </sequence>
    </complexType>
    
    <keyref name="krActivity" refer="act:kActivity">
      <selector xpath="act:studentActivity"/>
      <field xpath="act:activity"/>
    </keyref>
    
    <key name="kActivity">
      <selector xpath="act:activities/act:activity"/>
      <field xpath="act:name|act:desc"/>
    </key>
  </element>
</schema>

instance
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by James L.
Blunt (Landmark Graphics Corp.) -->
<studentActivities xmlns="http://www.exampleU.com/activity"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exampleU.com/activity
 student3.xsd">
  <studentActivity>
    <studentID>sn42</studentID>
    <activity>Swimming</activity>
  </studentActivity>
  <studentActivity>
    <studentID>sn44</studentID>
    <activity>Polo</activity>
  </studentActivity>
  <studentActivity>
    <studentID>sn49</studentID>
    <activity>Swimming</activity>
  </studentActivity>
  <studentActivity>
    <studentID>sn11</studentID>
    <activity>Swimming</activity>
  </studentActivity>
  <studentActivity>
    <studentID>sn43</studentID>
    <activity>Bowling</activity>
  </studentActivity>
  <activities>
    <activity>
      <!--<name>Swimming></name> -->      <!-- if I uncomment name -->
      <desc>Swimming</desc>               <!-- and comment out desc -->

      <fee>47.50</fee>                    <!-- it works             -->
    </activity>
    <activity>
      <name>Polo</name>
      <!--<name>Swimming</name> -->
      <fee>789.99</fee>
    </activity>
    <activity>
      <name>Bowling</name>
      <fee>38.50</fee>
    </activity>
  </activities>
</studentActivities>

Bill Riegel
LandMark Graphics
713-839-3388

-----Original Message-----
From: Bob Foster [mailto:bob@o...] 
Sent: Wednesday, May 21, 2003 8:38 PM
To: Jeff Lowery; xml-dev@l...
Subject: Re:  having problems with the "|" in field's element in
the xs:key el ement

From: Jeff Lowery
>I'm not sure either one is doing a complete job of validating the schema.
>While XSV is the most correct, it doesn't complain if you remove either
>act:name or act:desc from the key's field XPath (neither does SQC).
>It would seem that it should, since both fields are in a choice model
>group, and if the one in the key field is missing XSV will throw a
>document validation error.

XSV doesn't complain if you remove, say, the act:desc alternative from the
key field xpath, provided act:desc is never used in an activity instance.

However, if act:desc is used in an instance instead of act:name, it
complains "missing one or more fields...from key".

This seems right. The validation rule in 3.11.4 para 4.2 only requires that
all actual elements have unique keys. I don't see anything that requires a
processor to warn that some otherwise valid instance might have a missing
key.

Bob


-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.