Information Technology Reference
In-Depth Information
serve the purpose of disambiguating tags by reusing the fundamental idea of
URIs once again: Global naming allows universal IDs for tag and attribute
names.
If you consider our example above, a mathematician who did not know
about our WSMO Working Group DTD might easily come up with another
XML document if she wanted to represent the set
, using the tag name
member ambiguously, with a completely different meaning:
{
a, b, c
}
< ? xml version =”1.0”? >
< set xmlns=”http://www.example.org/mathstuff/sets/” >
< member > a < /member >
< member > b < /member >
< member > c < /member >
< /set >
Fortunately, by declaring different namespaces, an XML parser will recognize
that the member in Listing 2.1 is something different from that in this short
example. Different namespaces can also be mixed within one document, since
each tag or attribute is uniquely identified by a qualified name , which is ob-
tained from the combination of the namespace plus the tag/attibute name.
However, if different namespaces are used within one XML document, they
must be disambiguated by using different prefixes. Assuming that we wanted
to reuse the set notation of our unknown mathematician for people with sev-
eral a liations among the WSMO Working Group members, we could come
up with a modified XML document as in Listing 2.1.
< ? xml version =”1.0”? >
< people xmlns=”http://www.wsmo.org/namespace”
xmlns:math=”http://www.example.org/mathstuff/sets/” >
< title > WSMO working group members < /title >
< member chair=”yes” >
< firstname > Dieter < /firstName >< lastame > Fensel < /lastname >
< a liation >< math:set >
< math:member > DERI International < /math:member >
< math:member > DERI Innsbruck < /math:member >
< math:member > DERI Galway < /math:member >
< /math:set >< /a liation >
< /member >
< member chair=”yes” >
< firstname > John < /firstname >< lastname > Domingue < /lastname >
< a liation > Open University < / a liation >
< /member >
.
< member chair=”yes” >
< firstname > Axel < /firstname >< lastname > Polleres < /lastname >
< a liation >< math:set >
< math:member > Univ. Rey Juan Carlos < /math:member >
< math:member > DERI Innsbruck < /math:member >
< /math:set >< /a liation >
< /member >
.
< /people >
Listing 2.3. Alternative XML format for Listing 2.1
Search WWH ::




Custom Search