Search code examples
xmlxpathgoogle-sheetsapi-eveonlinegoogle-sheets-formula

"XML content cannot be parsed"


Google spreadsheet gives me an error stating "Imported XML content cannot be parsed" when I try to use the IMPORTXML function.

Cell contents:

=IMPORTXML("http://api.eveonline.com/char/AccountBalance.xml.aspx?keyID=myKey&vCode=myVCode&characterID=myCharID","/eveapi/result/rowset/row@balance")

where myKey, myVCode & myCharID are all valid (accessing the link via address bar with actual keys/IDs gives me a clean XML document).

The XPATH attempts to return the value for attribute "balance" in node "row". eveapi is a root note.

The only information I've found on the web regarding this issue is that IMPORTXML cannot parse js, but there's no js to handle - output is literally a pure XML document.


Solution

  • Your XPath is invalid. Using / you are doing an axis step. However, when you write row@balance you are not doing the required axis step to goi to the balance attribute. Hence, it must be

    /eveapi/result/rowset/row/@balance