[no subject]
http://Bernadethr2taylordd0.spaces.live.com - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org
Re: Question about performance for COM/SAX gurus
On Tue, Apr 20, 2010 at 4:25 PM, Ramon F Herrera ra...@patriot.net wrote: Subtitle 1: How to make SAX fly. Subtitle 2: Should I use DOM instead? My application retrieves several items (attributes and text) from large XML files. Such items are used to create a spreadsheet. The app is based on JAXP, and the code contains many lines like these: cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@user); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@project); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@projectpath); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@title); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@notes); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@computer); [...] I'm not sure what you're using, but nothing in this sample is SAX. It sounds like there's some higher level API sitting on top of SAX doing something ill-advised. Were you to rewrite this app to use real SAX, you could first use a single pass to grab all the values you need; and then fill the cells. -- Elliotte Rusty Harold elh...@ibiblio.org - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org
Re: Question about performance for COM/SAX gurus
Elliotte Rusty Harold elh...@ibiblio.org wrote on 04/20/2010 08:16:02 PM: On Tue, Apr 20, 2010 at 4:25 PM, Ramon F Herrera ra...@patriot.net wrote: Subtitle 1: How to make SAX fly. Subtitle 2: Should I use DOM instead? My application retrieves several items (attributes and text) from large XML files. Such items are used to create a spreadsheet. The app is based on JAXP, and the code contains many lines like these: cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@user); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@project); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@projectpath); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@title); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@notes); cell.cellValue = oneItemAtATime(xmlFile, //root/creator/@computer); [...] I'm not sure what you're using, but nothing in this sample is SAX. It sounds like there's some higher level API sitting on top of SAX doing something ill-advised. Were you to rewrite this app to use real SAX, you could first use a single pass to grab all the values you need; and then fill the cells. And if the queries were complex enough that you couldn't stream it then you could build a DOM and evaluate each XPath over the same instance. You certainly don't need to parse the same document N times to accomplish this. -- Elliotte Rusty Harold elh...@ibiblio.org - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org
Re: Looking for a simple, XPath-like way to retrieve values from XML files
Hi Ramon, The JAXP XPath API supports XPath 1.0 expressions [1]. Whatever sample you're looking at is just an *example*. You're certainly not restricted to only selecting attributes. Thanks. [1] http://www.w3.org/TR/xpath/ Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Ramon F Herrera ra...@patriot.net wrote on 04/13/2010 04:59:17 PM: Hi Michael (and other participants), Thanks so much for your recommendation. I downloaded and am experimenting with JAXP. It indeed seems to be a perfect match for my needs. It even comes with a very specific example, XPath Demo that I intend to use as reference. http://jaxp.dev.java.net/ However, I am concerned because that code only displays attributes: /root/creator/@projectpath I wonder whether I need to modify it (how?) in order to produce other items, such as the all-important atomic text values? TIA, -Ramon On 4/12/2010 9:20 PM, Michael Glavassevich wrote: Hi, JAXP has an XPath API. It is supported by Xalan and Java 5+. Here's a reference [1] to the Javadocs. Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/xpath/ package-summary.html Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Ramon F Herrerara...@patriot.net wrote on 04/12/2010 07:53:54 PM: Hello, My current application runs on C++ and has many lines like this: Variable[user]= xpath_of(//root/creator/user); Variable[project] = xpath_of(//root/creator/project); Variable[projectpath] = xpath_of(//root/creator/projectpath); Variable[title] = xpath_of(//root/creator/title); Variable[notes] = xpath_of(//root/creator/notes); The LHS is a Map, and the RHS is an XQilla function. http://xqilla.sourceforge.net Everything is working fine, but it seems that I will have to port the application to Java. I don't expect to have any problem going from Xerces-C to Xerces-J. I need a simple retrieval function, though. Xerces programming is more or less equivalent to assembly language. Can you folks recommend some XPath -or equivalent- implementation that runs on Java? TIA, -Ramon - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org