commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Vinson <vinson.li...@charter.net>
Subject [Jelly] Problem Parsing Xml Nodes
Date Fri, 07 Oct 2005 13:00:43 GMT
Hi everyone,

I'm attempting to use the xml tags from Jelly to parse an xml document and
pull out text values.  I've included my jelly script and sample xml below.
I've also written a simple tag processor that I can insert as a "breakpoint"
of sorts in my script, which is the x:debugger tag below.

The problem I am seeing is that when I use an xpath expression to get the
text of a node, I get a NumberFormatException on the .text.  Can anyone
point me in the right direction?  If I don't use text, I get an ArrayList of
DefaultElements, which isn't what I want either.  Thanks for any pointers.

Jason


Jelly:

<j:jelly 
  xmlns:j="jelly:core"
  xmlns:t="transform"
  xmlns:x="jelly:xml">
  
  <x:parse xml="${input}" var="doc"/>


  <x:set var="records" select="$doc/records/record"/>
 
  <j:forEach var="record" items="${records}">
    <x:set var="lastName" select="$record/person/names/last_name"/> 

    <t:debugger content="${lastName.text}" label="bp1"/>

  </j:forEach>

</j:jelly>

Xml:

<records>
  <record>
    <person>
      <names>
        <first_name>Jason</first_name>
        <last_name>Vinson</last_name>
      </names>
    </person>
  </record>
</records>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message