java - Jdom no results when XML is a rowset -
i trying grab data xml file, getting null data, appears picking there 3 results, returning null 3 times instead of relivant data.
the xml follows
<eveapi version="2"> <currenttime>2014-03-10 11:12:27</currenttime> <result> <rowset name="characters" key="characterid" columns="name,characterid,corporationname,corporationid"> <row name="char 1" characterid="0000000" corporationname="test corp" corporationid="000000"/> <row name="char 3" characterid="0000000" corporationname="test corp" corporationid="000000"/> <row name="char 2" characterid="0000000" corporationname="test corp" corporationid="000000"/> </rowset> </result> <cacheduntil>2014-03-10 11:40:26</cacheduntil> </eveapi>
code grabbing xml
public static void apigetchar(){ .... element rootelement = document.getrootelement() ; element windowmanager = rootelement.getchild("result") .getchild("rowset"); list namedchildren = windowmanager.getchildren("row"); (int = 0; < namedchildren.size(); i++) { element node = (element) namedchildren.get(i); string rowset = node.getchildtext("row name"); string row = node.getchildtext("row"); string result = node.getchildtext("result"); string result1 = node.getchildtext("name"); system.out.println("row name: "+rowset); system.out.println("row: "+row); system.out.println("name: "+result1); ....
as can see have tried varied names, compared other xml grabber, guess rowsets handled differently, no amount of googleing coming answer, great.
i need grab data xml, , pass string can display results in program
so appears items in rowset attributes, hence when getting childtext did not work, used
string name = node.getattributevalue("name");
allowed me names, other code correct.
xml attribute web definitions in xml, designation represents combination of name , value , used provide additional information xml element, example, <font size=2>. in case, font element , size=2 attribute.
Comments
Post a Comment