XPointer

Discussion in 'XML' started by Giacomino, Feb 17, 2007.

  1. Giacomino

    Giacomino Guest

    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.
     
    Giacomino, Feb 17, 2007
    #1
    1. Advertising

  2. * 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.
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
    68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
     
    Bjoern Hoehrmann, Feb 17, 2007
    #2
    1. Advertising

  3. Giacomino

    Giacomino Guest

    On 17 Feb, 12:59, Bjoern Hoehrmann <> wrote:
    > * 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.
    > --
    > Björn Höhrmann · mailto: ·http://bjoern.hoehrmann.de
    > Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·http://www.bjoernsworld.de
    > 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·http://www.websitedev.de/


    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?
     
    Giacomino, Feb 18, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shay
    Replies:
    0
    Views:
    885
  2. tintagel

    using xpointer in html

    tintagel, Apr 1, 2006, in forum: HTML
    Replies:
    3
    Views:
    445
    tintagel
    Apr 3, 2006
  3. DV
    Replies:
    1
    Views:
    2,822
    Martin Honnen
    Apr 19, 2004
  4. ShakyMobo

    Xpointer?

    ShakyMobo, Feb 24, 2005, in forum: XML
    Replies:
    0
    Views:
    490
    ShakyMobo
    Feb 24, 2005
  5. shaun

    XPointer support

    shaun, Nov 18, 2005, in forum: XML
    Replies:
    0
    Views:
    499
    shaun
    Nov 18, 2005
Loading...

Share This Page