Android: Reading specific nodes from XML without parsing entire document -


i'm feeling kind of dumb here. storing sets of data organized @ top level chapter > scene > dialogue. dialogue has several attributes , has additional data stored in organized hierarchy (sets of conditions, or sets of choices, each attributes of own read). imagine choose-your-own-adventure book , of rules being stored in xml document. seemed best way store it, i'd welcome contradiction.

i start on chapter 1, scene 1, dialogue 1. each dialogue, either through attributes or conditions, direct me single new node, example, chapter 3, scene 2, dialogue 8. never have parse entire document looking chapter, scene, or dialogue tags. however, want parse given dialogue node @ included sets of conditions or choices.

i can not life of me find how specify, in android, equivalent of:

xmlresourceparser parser = getresources().getxml((r.xml.script).getchild[chapter][scene][dialogue]); 

and while parse entire document every time , iterate off match indexes , know am, seems uncalled for. thoughts? everywhere people looking solutions problems require reading entire document , answer on how use parser.

its not clear looking for. if want read in xml file, , care few nodes within file, can use sax or pull parser listen nodes care about. article xml in android has examples of both.

if care whole document, want easy way navigate navigate particular element in tree, couple of options. can parse xml dom document (the third option in article above) , use functions getelementsbytagname walk tree.

or, using xpath. see documentation overview.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -