[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Question for Xpath usage in setter, not query or transform

  • To: "Chen, Andrew ." <ChenA@w...>
  • Subject: Re: Question for Xpath usage in setter, not query or transformation
  • From: Burak Emir <Burak.Emir@e...>
  • Date: Tue, 03 Aug 2004 14:51:17 +0200
  • Cc: "'xml-dev@l...'" <xml-dev@l...>
  • In-reply-to: <945A2CFE6C33D611A49D0002A59305DB044B4765@SWEC9901>
  • References: <945A2CFE6C33D611A49D0002A59305DB044B4765@SWEC9901>
  • User-agent: Mozilla Thunderbird 0.5 (X11/20040208)

xpath usage
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.