XPointer

G

Giacomino

Let's suppose I want a document like this:

<tree>
<node>
<nodeChildren>
<node> ... </node>
...
<nodeSelection selected="..."/>
</node>
....
</tree>

"selected" attribute is an xpointer that point to a child node in
nodeChildren sequence.
I have to write the schema for that document. My question is
how can I specify the "selected" attribute in the schema to be an
xpointer?
Thanks.
 
B

Bjoern Hoehrmann

* Giacomino wrote in comp.text.xml:
Let's suppose I want a document like this:

<tree>
<node>
<nodeChildren>
<node> ... </node>
...
<nodeSelection selected="..."/>
</node>
...
</tree>

"selected" attribute is an xpointer that point to a child node in
nodeChildren sequence.
I have to write the schema for that document. My question is
how can I specify the "selected" attribute in the schema to be an
xpointer?

Just like you would specify any other data type for the attribute. The
main problem here is that common implementations do not have pre-defined
data types that would help you here, you would have to define and if you
also want to actually validate documents implement one yourself. Another
problem is that XPointer is extensible, you would have to decide how you
handle XPointer schemes your implementation does not know about. In the
general case XPointer is a context-free language, so to implement it you
would need to write a corresponding parser for it. You could also try to
approximate the grammar using a regular expression.
 
G

Giacomino

* Giacomino wrote in comp.text.xml:






Just like you would specify any other data type for the attribute. The
main problem here is that common implementations do not have pre-defined
data types that would help you here, you would have to define and if you
also want to actually validate documents implement one yourself. Another
problem is that XPointer is extensible, you would have to decide how you
handle XPointer schemes your implementation does not know about. In the
general case XPointer is a context-free language, so to implement it you
would need to write a corresponding parser for it. You could also try to
approximate the grammar using a regular expression.

And if I declare "select" attribute as xs:AnyURI? Is "#xpointer(here()/
ancestor::node[1]/child::nodeChildren/child::node[2])" a valid value
for it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top