[jdom-interest] (no subject)

MarkW mark.wilson at wilsoncom.de
Thu Jul 18 01:11:47 PDT 2002


Hi,
werken.xpath is an older version of jaxen.
 
I use the following method to count elements according to a certain
xpath expression:
 
  public static int getJDOMCount( Document doc, String xpath )
  {
    int ret = -1;
    try
    {
      Number num = new XPath( xpath ).numberValueOf( doc );
      ret = num.intValue();
    }
    catch ( SAXPathException spx )
    {
      out(" getJDOMElement->ERROR ");
      logError( spx );
    }
    return ret;
  }
 
An example for an xpath expression:
"count(items/item[name='"+something+"']/value/entities/entity)"
 
Jaxen unfortunately does not contain good examples.
Some good links:
http://www.zvon.org/xxl/XPathTutorial/General/examples.html
 
Elliotte Rusty Harold has an excellent introduction to xml and (amongst
other things) xpath:
http://cafeconleche.org/books/xmljava/chapters/
 
The latest (cvs?) version of jdom has jaxen built in.
 
Greetings,
Mark

-----Original Message-----
From: Adrian Jetzer [mailto:wwwaci at tic.ch] 
Sent: Thursday, July 18, 2002 9:38 AM
To: MarkW
Subject: Re: [jdom-interest] (no subject)


Hi. Thanks for you mail.
 
Which XPath-thing do you use with JDOM for this 'count()' function ?
 
- werken.xpath
or 
- jaxen-xpath
 
And in which Class is this count method ?
 
Thanks,
Adrian

----- Original Message ----- 
From: MarkW <mailto:mark.wilson at wilsoncom.de>  
To: Jdom-Interest <mailto:jdom-interest at jdom.org>  
Sent: Wednesday, July 17, 2002 3:19 PM
Subject: RE: [jdom-interest] (no subject)


Hi,
you could use the count() function in xpath in order to program a
progress bar.
 
Mark

-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]
On Behalf Of Adrian Jetzer
Sent: Wednesday, July 17, 2002 2:27 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] (no subject)


Hi there!
 
 
I'm parsing a xml-file. The file has a specific amount
of elements. 
 
Is there a way to know, on which line of the file 
the parser in a particular moment is?
 
For example. After I read (parsed) several elements of
the xml file, I would like to know, on which line
of the file the "actual-file-pointer" is.
 
I don't want to know the line-number for every element.
Just sometimes I want to check, on which line the
parser is.
 
 
For what do I use this?
 
I want to use it for a progress bar. I want to show the
user how far the parsing process is. I know the total
amount of lines in the file. So with some checkpoints
(hey parser, on which line are you now?) I can  realise
a progress bar ....
 
 
Adrian
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020718/d47e3887/attachment.htm


More information about the jdom-interest mailing list