473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ID and IDREF

Hello,

Why does this not work:

<billTo id="addr-1">
<company>The Skateboard Warehouse</company>
<street>One Warehouse Park</street>
<street>Building 17</street>
<city>Boston</city>
<state>MA</state>
<postalCode>01775</postalCode>
</billTo>

<shipTo href="addr-1"/>

.. . . billTo and shipTo are defined as the same in the schema and I included
the following in the schema definition:

<xsd:attribute name="id" type="xsd:ID"/>
<xsd:attribute name="href" type="xsd:IDREF"/>

.. . . however, xml notepad says, 'the element shipTo has incomplete
contents'. If I populate shipTo with the same info as billTo, it works fine
but the referencing of billTo does not seem to work or is it a limitation of
xml notepad?

Thanks.

--g
Dec 2 '07 #1
2 2076
geoff wrote:
Why does this not work:

<billTo id="addr-1">
<company>The Skateboard Warehouse</company>
<street>One Warehouse Park</street>
<street>Building 17</street>
<city>Boston</city>
<state>MA</state>
<postalCode>01775</postalCode>
</billTo>

<shipTo href="addr-1"/>

. . . billTo and shipTo are defined as the same in the schema and I included
the following in the schema definition:

<xsd:attribute name="id" type="xsd:ID"/>
<xsd:attribute name="href" type="xsd:IDREF"/>

. . . however, xml notepad says, 'the element shipTo has incomplete
contents'. If I populate shipTo with the same info as billTo, it works fine
but the referencing of billTo does not seem to work or is it a limitation of
xml notepad?
If the schema for shipTo defines child elements then you have to include
those child elements literally. There is no way to include them using a
link mechanism, that is not how XSD schemas work.
All ID/IDREF allow you is to refer to other components for instance
<address id="addr1">
<company>The Skateboard Warehouse</company>
<street>One Warehouse Park</street>
<street>Building 17</street>
<city>Boston</city>
<state>MA</state>
<postalCode>01775</postalCode>
</address>

<billTo href="addr1"/>
<shipTo href="addr1"/>
but then the schema would not define child elements for billTo and
shipTo, it would just define the attribute and its type.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 2 '07 #2
After I uploaded that, I can see it has some problems, oh well.

--g
Dec 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lars | last post by:
Hi all, I suspect this may be a bug in XMLSpy, since IE seems to validate this XML successfully. Maybe someone here has run into this and can tell me. Problem: When I try to validate the XML...
2
by: Nicolas Bouillon | last post by:
Hi I am writing a schema and i want to have an element's attribute, which is an IDREF to an other type of element. For example <Type1 id="id1"/> <Type2 id="id2"/>
2
by: Neil Zanella | last post by:
Hello, Is it possible to specify an IDREF to an element to an external file in a DTD? I really need this feature cause that way I can do a good job of validating the XML files I am using. ...
2
by: VernonR | last post by:
I'm having problems getting the .NET 1.1 XSL transform to cross reference using ID / IDREF correctly. I have collapsed to a simple set of files to show the problem more clearly... The output...
2
by: jacquesh | last post by:
HI all I'm looking for different ways to using idref with more than one XML file ?? My case :: 2 xml files {labo.xml, contact.xml} I found a method which use an include via '<!ENTITY...'...
3
by: Eric Lilja | last post by:
Sorry for asking so many questions, but I've just started and need to get some things working so I can do the task that is before me. Consider this (validating) schema: <?xml version="1.0"?>...
2
by: maxwell | last post by:
I'm trying to write a schema, and test it by running an xml file of test data based on that schema through xmllint. I'm having a problem, because xmllint ( --version reports "using libxml version...
1
by: stran | last post by:
I'm trying to create a simple type that holds two different types. The first is IDREF and the second is an enumeration of string. When I generate a sample xml, I can enter any ID previously stated in...
2
by: Luigi | last post by:
Hello! I'm writing a schema where an element has got a reference to another element via IDREF. The problem is that I would restrict the possible references to the sole elements of a specific...
4
Dormilich
by: Dormilich | last post by:
Hello, I'm back with a problem, where I need help with starting. I got an XML file that contains a number of elements with IDREF type attributes: <?xml version="1.0" ?> <root> // these...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.