A
akunal
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>Washington 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.println(address.city);
System.out.println(truck.capacity.weight);
System.out.println(truck.capacity.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 "automatically" refer to
and retrieve the top-level data as "objects" rather than just plain
strings.
Thanks in advance,
Kunal
follows:
<!-- Top level nodes -->
<Cities>
<City>Los Angeles</City>
<City>San Francisco</City>
<City>Seattle</City>
<City>Washington 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.println(address.city);
System.out.println(truck.capacity.weight);
System.out.println(truck.capacity.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 "automatically" refer to
and retrieve the top-level data as "objects" rather than just plain
strings.
Thanks in advance,
Kunal