Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to ignore space, tab, return charactors

Status
Not open for further replies.

kanghao

IS-IT--Management
Jul 4, 2004
68
KR
//1)<Root> <A>a</A><B>a</B></Root>
//2)<Root><A>a</A><B>a</B></Root>
Node n = XPathAPI.selectSingleNode(domDoc, "//Root");
System.out.println(n.getFirstChild().getNodeName()); // 1)#text 2)A

The ouput is different depending on the space, tab,return or other charactors.
I want to get number 2) no matter what the charactor is in.
Thanks.
 
See what happens if you use this instead:
Code:
Node n = XPathAPI.selectSingleNode(domDoc, "//Root[b]/*[1][/b]");
System.out.println(n.getNodeName());

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Yes it works.
what 's the predicate, [1]?
 
[1] = 1st object in node-set
[2] = 2nd, etc...
[last()] = last object

for more info see:

other areas that may be of interest include:

Hope this Helps...

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top