L
Leopold Schwinger
Hello!
I am just learning some basic concepts about xml in order
to write a small application.
Now my question:
I have an element, which content (text) must be the same,
as the content of another element. If you compare it to
relational databases, it is like a foreign key.
Is it possible to define this in a validating scheme?
If yes, how can I do it, and which "technology" would
you use (DTD, XML-Schemata or Relax NG)?
example (has nothing to do with the application):
<mydoc>
<!-- entire book collection -->
<book_collection>
<book>
<nr>001</nr>
<title>this is a nice book</title>
</book>
<book>
<nr>002</nr>
<title>one more book</title>
</book>
<book>
<nr>003</nr>
<title>my last book</title>
</book>
</book_collection>
<!-- my favorite books -->
<book_favorites>
<!-- the book_nr must appear under book_collection/book/nr> -->
<book_nr>001</book_nr>
<book_nr>003</book_nr>
</book_favorites>
</mdoc>
Thank you,
Leopold
I am just learning some basic concepts about xml in order
to write a small application.
Now my question:
I have an element, which content (text) must be the same,
as the content of another element. If you compare it to
relational databases, it is like a foreign key.
Is it possible to define this in a validating scheme?
If yes, how can I do it, and which "technology" would
you use (DTD, XML-Schemata or Relax NG)?
example (has nothing to do with the application):
<mydoc>
<!-- entire book collection -->
<book_collection>
<book>
<nr>001</nr>
<title>this is a nice book</title>
</book>
<book>
<nr>002</nr>
<title>one more book</title>
</book>
<book>
<nr>003</nr>
<title>my last book</title>
</book>
</book_collection>
<!-- my favorite books -->
<book_favorites>
<!-- the book_nr must appear under book_collection/book/nr> -->
<book_nr>001</book_nr>
<book_nr>003</book_nr>
</book_favorites>
</mdoc>
Thank you,
Leopold