Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] Question for Xpath usage in setter, not query or transformation

From: Burak Emir <Burak.Emir@----.-->
To: "Chen, Andrew ." <ChenA@------------.--->
Date: 8/3/2004 12:51:00 PM
Chen, Andrew . wrote:

> Is it possible to set data in a DOM tree through a simple Xpath like 
> syntax?
>
(Although it is Java based, you might take some inspiration from this one)
At IBM research, people are working on a Java + XML, called XJ.

Here is a short summary of the WWW2004 conference poster. Vivek Sarkar 
presented it also at ECOOP2004 in Oslo.
http://www2004.org/proceedings/docs/2p340.pdf

Here's the extract of the code. They use backquotes `...` to embed XPath 
expressions in Java syntax.

 1 import "po.xsd";
 2 public class Discounter {
 3     public void giveDiscount(){
 4
          purchaseOrder po =
                 (purchaseOrder)XMLItem.load("po.xml", null);
 5
 6        XML<item> bulkPurchases =
                  po/item[quantity/text() > 50] ;
 7        for (int i = 0; i < bulkPurchases.size(); i++) {
 8
              item current = bulkPurchases.get(i);
 9
               `current/USPrice/text()` *= 0.80; // Deduct 20%
10        }
11        XMLItem.serialize(po, "po.xml");
12     }
13 }


Again, some fancy XML database API might also provide what you need but 
I do not know of any.
Berkeley DB XML by sleepycat and Apache do not seem offer such an update 
mechanism, but only "insert-before" and "insert-after".

Looks like something worth implementing, but if the programs are to be 
readable, it requires a clean and at the same time flexible XML API, 
something which does not seem to exist in the mainstream programming 
language world, or a language extension, which most users are not 
inclined to use.

cheers,
Burak


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent