Title: Message
Brilliant.  Worked...thanks!
Question: why?
 
I'll admit, when it comes to character manipulation and text and such, I know about next to nothing.  However, this doesn't make sense.
 
In the XML file I've been processing, the node in question looked exactly like this:
 
<logicOperator>or</logicOperator>
 
I assume Xerces is adding whitespace or something when it processes...is that correct?
 
Regardless, thanks a bunch. :)
 
Ryan
----- Original Message -----
Sent: Monday, October 20, 2003 6:51 PM
Subject: RE: Node.getNodeValue() problem

try this
       
if (node.getNodeValue().trim().equals("and"))
    System.out.println("it worked");
 
-----Original Message-----
From: Michael Ryan Bannon [mailto:[EMAIL PROTECTED]
Sent: Monday, October 20, 2003 6:48 PM
To: [EMAIL PROTECTED]
Subject: Node.getNodeValue() problem

Hello,
 
This might be just a stupid Java problem I'm overlooking.
 
The snippet below deals with a TEXT_NODE with a String value "and":
 
============================================
...
 
// Output the value of a text node.
// This should, and does, output "and".
System.out.println(node.getNodeValue());
 
// Test the node.
if (node.getNodeValue() == "and")
    System.out.println("it worked");
 
..
============================================
 
Now, I've confirmed that it's a text node before the snippet.  The first println outputs "and".  However, the "if" statement is false, so I never see "it worked".  How is this possible?
 
This seems so trivial...what am I missing?
 
Thanks in advance,
 
Ryan
This e-mail may contain confidential or privileged information.  If you
think you have received this e-mail in error, please advise the sender by
reply e-mail and then delete this e-mail immediately.  Thank you.  Aetna

Reply via email to