if a response that is an XML document I'm trying ...
# suitescript
s
if a response that is an XML document I'm trying just to get just one child node
Copy code
var xmlDocument = xml.Parser.toString({
text: xmlString
});
var labelkNode = xml.XPath.select({
node: xmlDocument,
xpath: '//label'
});
b
you need to share the error code/message for these kind of things
stack trace is especially helpful so you know which line is causing the error
s
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "WRONG_PARAMETER_TYPE",
  "message": "Wrong parameter type: node is expected as xml.Node or subclass. ",
  "stack": [
    "Error",
    " at Object.beforeSubmit (/SuiteScripts/Shipglobal.js:189:27)"
  ],
  "cause": {
    "name": "WRONG_PARAMETER_TYPE",
    "message": "Wrong parameter type: node is expected as xml.Node or subclass. "
  },
  "id": "",
  "notifyOff": false,
  "userFacing": true
}
b
Parser.fromString changes a string into a xml document
Parser.toString changes a xml documents into a string
s
the response i get is an xml document i want to just get the data inside <label></label> node
b
that doesnt sound right
what is xmlString?
s
i am making an api call the response is an XML document or string with XML inside ?
this was the respone
Copy code
<?xml version="1.0"?> <FFUSACourier><Shipment><Result>Success</Result><TrackingNumber>FFUSA247134</TrackingNumber><Label>PGhlYWQ+ID ......
b
are you using ClientResponse.body?
s
yes
b
look at the return type of the documentation i linked
s
thanks working