XML Document traversal in java -
which preferable xml document traversal method in java ? using getelementsbytagname
or using treewalker
.
i've 1 treemodel
. dom node
root of treemodel
. there 2 thread
s adding nodes it. 1 thread
adding nodes according nodes added other thread
.
e.g.
one thread
adding node
s named app
. other thread
adding nodes according name
attribute of node
s named app
. nodes not added correctly. treemodel
shows details in elements traversing through nodes.
note: adding app
node
according name attribute of node
.
currently second thread
, node
s taken calling getelementsbytagname
. there advantage changing treewalker
?
i xpath. w3schools link here, javadocs here. tedious started factories , builders, imo write own utility class save on tedium. syntax traverse around expressive , powerful, , "standard" documentation.
if brave, check out beta groovy-like xpath-like project, not propose "the preferable". :-)
added: xpath query language selecting nodes xml document. traversing (moving around in) dom structure. however, op's updated requirements manipulating / modifying dom structure. xpath not fit there.
Comments
Post a Comment