W3C home > Mailing lists > Public > www-xpath-comments@w3.org > October to December 2003

Using XPath to edit an XML document

From: Travis Stevens <Travis.Stevens@noaa.gov>
Date: Wed, 12 Nov 2003 17:07:56 -0700
Message-ID: <3FB2CB5C.1070407@noaa.gov>
To: www-xpath-comments@w3.org

XPath has been very helpful to me querying extremely large and complex 
XML schemas (FGDC and Remote Sensing Metadata Templates FYI).  My 
question is, why stop at querying documents.  It would be very useful to 
create xPath functions that allow one to create new Elements.  For example:

Lets say we have an xml document like so:

   <employee id="1">
      <name first="Travex" last="Stevex" />
      <family marriage="single" />

If I were to get married, I would create an xPath query 

This would return the family element and I would set the marriage 
attribute to be "married".  Well, if a family element did not exists, 
then this query would not work.  Why not have a function to create a new 
one if it does not exist: 

Lets say we want to add a new employee, xPath:

"/root/employee[new()]" would return a newly created employee element.

IMHO, I think it would only take these two functions to have a sort of 
element creational standard.

Received on Wednesday, 12 November 2003 19:13:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:02:15 UTC