473,569 Members | 3,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to represent links within XML & XSD?

I'm trying to represent a linked relationship among between nodes as
follows:

<!-- Top level nodes -->
<Cities>
<City>Los Angeles</City>
<City>San Francisco</City>
<City>Seattle </City>
<City>Washingto n DC</City>
</Cities>
....
<Dimensions>
<Weight>
<Metric>
<Tonnes>
2.5
</Tonnes>
</Metric>
</Weight>
<Height>
<Metric>
<Metres>
6.4
</Metres>
</Metric>
</Height>
</Dimensions>
....

<!-- User level nodes -->
<Address>
<Line1>...</Line1>
<Line2>...</Line2>
<City>/Cities/City[2]</City> <!-- Links to top level nodes -->
</Address>

<Truck>
<Capacity>
<Weight>/Dimensions/Weight/Metric/Tonnes</Weight> <!-- Links
to top level nodes -->
<Height>/Dimensions/Height/Metric/Metres</Height> <!-- Links
to top level nodes -->
</Capacity>
</Truck>
Is it possible to represent this relationship both at design-time (in
the schema/XSD) and at run-time (in the XML document)?

Is there a way to do this in XLink/XPointers such that in Java code I
could, for example, transparently use the linked objects as follows:

System.out.prin tln(address.cit y);
System.out.prin tln(truck.capac ity.weight);
System.out.prin tln(truck.capac ity.height);

(Unless I absolutely have to, I don't want to write additional code to
"understand " the semantics of the links to the city, height and weight.
That is, in a Java program, the links should "automatica lly" refer to
and retrieve the top-level data as "objects" rather than just plain
strings.

Thanks in advance,
Kunal

May 4 '06 #1
3 1644
The traditional way to represent point-to-point links within an XML
document is by an ID attribute defining the point of interest and IDREF
attributes pointing to those points. Schema does have that concept.

This does require that you explicitly follow the IDREF connection. The
standard XML APIs have some assistance for doing so, eg the DOM's
getElementByID operation. Your example isn't using those APIs -- it's
assuming data binding -- so you need to check the specs of your data
binding tool to see what it does in that regard.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 5 '06 #2
The biggest failing of ID/IDREF is that the link has no way of
expressing any semantic value as to why the relationship was
established. ID/IDREFs rely on the text that is highlighted to explain
why the link was inserted. This model works if the authors understand
the semantic meaning of the links that should point to or from the file
that they were authoring. And, although this isn't important as yet,
ID/IDREF can't express bi-directional links.

I was reading up on XLinks and it appears that XLink enables you to:
(1) Link between resources without the need to change them (very imp
req in my case)
(2) Build new documents dynamically from a template link document
(could be imp as an alternative)
(3) Have true bi-directional links between resources (not imp)
(4) Group sets of related resources in strongly typed relationships
(imp)
(5) Link between structured and unstructured information (very imp)
(6) Manage large repositories of link information in a centralised
efficient manner (not imp)
(7) Link resources that are stored in a variety of different data
repositories (imp)
(8) Create links using any application that creates XML XLink documents
(not sure)

I don't know if ID/IDREF can do those or how XLink can do them, with or
without using a separate tool other than a traditional XML parser.

May 5 '06 #3
ak****@gmail.co m wrote:
The biggest failing of ID/IDREF is that the link has no way of
expressing any semantic value as to why the relationship was
established.
Not entirely true; that's a matter of how you design your document.
Remember, the IDREF doesn't exist in a vacuum; its context may provide
additional information.

Keys, defined in the Schema spec, are a more flexible alternative to IDs
and (because there are multiple key spaces rather than a single shared
space for all IDs) may be more felxible in this regard.
ID/IDREF can't express bi-directional links.
True.
I was reading up on XLinks


XLink is indeed a much richer mechanism. There still isn't much
off-the-shelf support available for it, unfortunately, so actually using
it productively can be a challenge. And you did way you didn't want to
write additional code.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
May 5 '06 #4

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

Similar topics

2
5518
by: SDM | last post by:
I need to create a stylesheet to allow the querystring in my attribute links to format as: <TD<A href='IQNet.asp?f=2&t=3'>Choice 1</A></TD> not <TD<A href='IQNet.asp?f=2&amp;t=3'>Choice 1</A></TD> I can't put an XSLT tag inside an HTML tag so <xsl:text disable-output-escaping="yes"> won't cut it.
0
2411
by: Thomas Scheffler | last post by:
Hi, I runned in trouble using XALAN for XSL-Transformation. The following snipplet show what I mean: <a href="http://blah.com/?test=test&amp;test2=test2">Test1&amp;</a> <a href="http://blah.com/?test=test&amp;amp;test2=test2">Test2&amp;amp;</a> This results in the following HTML Code:
25
5003
by: Shannon Jacobs | last post by:
Maybe there is a simple trick here, and I'm not spotting it... Is there a guru of CSS hanging around here who can help out? The page in question has a multi-column table with a list of links in each column. Because links are added and deleted separately in each column, it would be exceedingly awkward to use a separate table row for each...
22
2969
by: Fred Ma | last post by:
I'm using the expression "int a = ceil( SomeDouble )". The man page says that ceil returns the smallest integer that is not less than SomeDouble, represented as a double. However, my understanding is that a double has nonuniform precision throughout its value range. Will a double always be able to exactly represent any value of type int? ...
3
2712
by: Ptaku25 | last post by:
I have in a few first page defined links (font blue color) row by row which are links for to appropriate pages in this pdf document. Could you tell how to get this links in javascript lang ??? Which method or function I should to invoke to get links which arer defined in my pdf document ??? Regards, Piotrek
1
2762
by: khoegen | last post by:
I've created a Table and wish to create links between the records wtihin the table. Background: The table consists of a list of Documents. These documents contain references to other documents...which are also listed within this same table. I would like to create a form which will allow me to call up any one 'parent' document, and have it list...
1
3003
by: boclair | last post by:
I have been asked to assist some Veterans to overcome a problem they are having in IE6 with the behaviour of internal links on some pages they have written. Background Their schema is to float a thumbnail link to the right of a para (say), the para having the same id value as the name of full size image file that is to be downloaded. The...
3
470
by: Bart Steur | last post by:
Hi I want to represent the following XML structure in a class or classes. <CATEGORY NAME="BASE"> <PERSON NAME="PERSON">M. Johnson</PERSON> <JOBTITLE NAME="JOBTITLE">Director</JOBTITLE> <SUBCATEGORY NAME="SUB"> <BUILDING NAME="BUILDING">Paris</BUILDING>
2
3129
iam_clint
by: iam_clint | last post by:
/*###############################*/ /* Link fade script by iam_clint, bytes.com */ /* www.bytes.com, If you use this script on your site */ /* Please keep this comment at the top of the javascript */ /*###############################*/ window.onload=function() { setupLinks(); } var red=0; /*base 16*/ var green=15;...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7681
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.