Tuesday, 15 September 2015

Tokenizing XML output using Java DOM parser - multiple child node values -



Tokenizing XML output using Java DOM parser - multiple child node values -

in expressions tab in eclipse, able see next output

\nmilk product, cultured\ncow milk\ncheese farm\n

by calling

eelement.getelementsbytagname("xmltag").item(0).gettextcontent());

how tokenize string using \n using indexof such can have separate string values ie:

string dairy1 = "milk product, cultured"; string dairy2 = "cow milk" string dairy3 = "cheese farm"

the convenient way should be

string[] toks = eelement.getelementsbytagname("xmltag").item(0).gettextcontent().split( "\n" );

the empty element [0] must skipped if \n @ beginning.

java xml dom domparser

No comments:

Post a Comment