Well there are 2 things at play here - 

1) Elements don't neccessarily have text (you may want a TEXT_NODE)
2) getTextContent() is a Java 1.5 method, so you could either have (a)
the wrong JDK version or (b) it may not be implemented on the XML
parser you are using.

Enjoy :o)

Mark

On 8/12/05, Gareth Edwards <[EMAIL PROTECTED]> wrote:
>  
> 500 org.w3c.dom.Node.getTextContent()Ljava/lang/String;
> org.w3c.dom.Node.getTextContent()Ljava/lang/String;
>  
>  
>  Mark Mandel wrote: 
>  What's the error gareth?
> 
> (and why you creating a new String()... seems kinda redundant)
> 
> Mark
> 
> On 8/12/05, Gareth Edwards <[EMAIL PROTECTED]> wrote:
>  
>  
>  I'm using Java to parse an xml document and have included some bits of the
> method that helps me describe what is causing a problem.
>  
>  import org.w3c.dom.*; 
>  import javax.xml.parsers.DocumentBuilder; 
>  import javax.xml.parsers.DocumentBuilderFactory; 
>  
>  The bit below is what I'm a little confused about, it seems that the line
>  hashvalue = new String(nodelist.item(nodeindex).getTextContent());
>  seems to throw a strange Java servlet / string error, anyone know what
> might be causing this? 
>  
>  for(int nodeindex = 0; nodeindex < nodelist.getLength(); nodeindex++){
>  if(nodelist.item(nodeindex).getNodeType() == Node.ELEMENT_NODE)
> { 
>  hashkey = new
> String(nodelist.item(nodeindex).getNodeName()).trim();
>  hashvalue = new
> String(nodelist.item(nodeindex).getTextContent());
>  properties.put(hashkey,hashvalue); 
>  }
>  }
>  
>  
>  
> -- 
>  
>  
> 
>  
> 
> the alpha school system PTY LTD
>  Unit 1, 31 Thompson Street Bowen Hills QLD 4006
>  T Intl +61 7 3216 0999 F Intl +61 7 3216 0500
>  www.tassweb.com.au ABN 87 010 874 816 
> 
>  
> TASS news 
> 
> - Change of company name - the alpha school system PTY LTD 
> 
> - New & improved website coming soon 
> 
> - TASS.web Fundraising upgrade available now! 
> 
> - TASS 6.09.007 patch release ready for download 
> 
> ----- Visit www.tassweb.com.au for more info ------- 
> 
>  
> 
> Virus Disclaimer: Please note that this email may contain computer-generated
> file(s) as an attachment. Whereas we take every effort to protect our files
> from computer virus, we recommend that you check the file(s) with your own
> virus detection software prior to opening it. If you would prefer to receive
> a hardcopy of the file please email or phone. Alpha Business Systems does
> not accept liability for the consequences of any computer viruses that may
> be transmitted with this email. 
> 
> Confidentiality: This email and any attached files are intended solely for
> the addressee(s) and may contain confidential and privileged information. If
> you received this email in error, please advise us by return email or phone
> and disregard the contents and immediately delete it and destroy any copies.
> 
>  
>  
>  
>  ---
>  You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
>  To unsubscribe send a blank email to
> [EMAIL PROTECTED] Aussie Macromedia
> Developers: http://lists.daemon.com.au/ 


-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com
ICQ: 3094740

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to