Ignorant meta-document (from schema?) question

Discussion in 'XML' started by Mike, Nov 1, 2004.

  1. Mike

    Mike Guest

    I am writing a post-processor for an existing XML document (that I have
    no control over), this entails a lot of inserting and deleting of
    nodes.

    I don't want to have to hard code the (schema-defined) 'parent' XPath
    of every node (so that I know what to clone and where to insert). It
    seems that there should be someway of dynamically determining (via the
    schema?) the 'parent' paths such that I am able to create valid
    documents.

    Does anything like this exist or is it just wishful thinking?

    (I use 'parent' here not to mean the physical parent of a node, rather
    the logical parent from the schema's point of view (as in if I clone
    this node then I really have to clone this entire path and insert it
    here)).
    I'm hoping I've missed something painfully obvious.

    Thanks-- Mike
     
    Mike, Nov 1, 2004
    #1
    1. Advertising

  2. Mike wrote:
    > I am writing a post-processor for an existing XML document (that I have
    > no control over), this entails a lot of inserting and deleting of
    > nodes.
    >
    > I don't want to have to hard code the (schema-defined) 'parent' XPath
    > of every node (so that I know what to clone and where to insert). It
    > seems that there should be someway of dynamically determining (via the
    > schema?) the 'parent' paths such that I am able to create valid
    > documents.
    >
    > Does anything like this exist or is it just wishful thinking?
    >
    > (I use 'parent' here not to mean the physical parent of a node, rather
    > the logical parent from the schema's point of view (as in if I clone
    > this node then I really have to clone this entire path and insert it
    > here)).


    I think MSXML 4 when validating XML instance files against XML schemas
    tries to display the XPath to the relevant element e.g.
    /root/el1[3]/el2[4]/el3[5]
    and it is certainly possible to construct such paths using XSLT. I can't
    point you to an existing XSLT stylesheet or other XML software tools
    that solves that.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Nov 1, 2004
    #2
    1. Advertising

  3. Mike

    Mike Guest

    Martin,

    Thanks for the thoughts, I already have access to the unique path
    though.

    What I'm looking for is something that would do an XPath-like
    ancestor-or-self:: search but use what it knows about the schema to
    find the "real" root node.

    Thanks again-- Mike
     
    Mike, Nov 2, 2004
    #3
  4. Mike wrote:

    > What I'm looking for is something that would do an XPath-like
    > ancestor-or-self:: search but use what it knows about the schema to
    > find the "real" root node.


    Some schema aware parsers implement a schema object model that allows
    you to find out schema related information.
    For MSXML 4 (and 5) look at
    http://msdn.microsoft.com/library/d...y/en-us/xmlsdk/html/SOM_DevGuide_Overview.asp
    For Xerces-J have a look at the documentation at
    http://xml.apache.org/


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Nov 2, 2004
    #4
  5. Mike

    Mike Guest

    The Xerces-J schema stuff looks interesting, I might be able to build
    something out of that.
    http://xmlbeans.apache.org/ also looks promising.

    Thanks for the help.
     
    Mike, Nov 3, 2004
    #5
    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. dan m

    painfully ignorant but frustrating

    dan m, Feb 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    328
    Alvin Bruney [MVP]
    Mar 2, 2004
  2. Rut

    xml ignorant

    Rut, Nov 19, 2004, in forum: XML
    Replies:
    3
    Views:
    438
    cr88192
    Nov 20, 2004
  3. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,329
    Stanimir Stamenkov
    Apr 25, 2005
  4. ignorant question

    , Oct 2, 2004, in forum: Javascript
    Replies:
    8
    Views:
    107
  5. Debo
    Replies:
    8
    Views:
    123
Loading...

Share This Page