Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi all,
I want to read value of node (not attribute). I can read value of attribute clearly but I missed something. Could you please help me?
My xml file;
<?xml version="1.0" encoding="utf-8"?>
<ITEMS>
<BATCH_ID>X001</BATCH_ID>
<NAME>XML TEST VALUE </NAME>
<STEPS>
<STEP>
<STEP_ORDER>1</STEP_ORDER>
<NO_MORE_THAN>1,5</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
<STEP>
<STEP_ORDER>2</STEP_ORDER>
<NO_MORE_THAN>2</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
<STEP>
<STEP_ORDER>3</STEP_ORDER>
<NO_MORE_THAN>20</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
</STEPS>
</ITEMS>
My script code is;
var params = {
ignoreSSLErrors: true /* BOOLEAN */,
url: 'http://caws.ixcoe.com/data/pfizer.xml' /* STRING */
};
// result: XML
var xmlVar = Resources["ContentLoaderFunctions"].LoadXML(params);
result = xmlVar.batch_id;
Regards,
Solved! Go to Solution.
I've tested without the service call and it works, should be something with the XML answer from your service:
var xml = new XML();
xml = <ITEMS>
<BATCH_ID>X001</BATCH_ID>
<NAME>XML TEST VALUE </NAME>
<STEPS>
<STEP>
<STEP_ORDER>1</STEP_ORDER>
<NO_MORE_THAN>1,5</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
<STEP>
<STEP_ORDER>2</STEP_ORDER>
<NO_MORE_THAN>2</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
<STEP>
<STEP_ORDER>3</STEP_ORDER>
<NO_MORE_THAN>20</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
</STEPS>
</ITEMS>
var result = xml.BATCH_ID;
Hi,
It's case sensitive
Best Regards,
Carles.
Hi Carles,
I tried with BATCH_ID but result is same
I've tested without the service call and it works, should be something with the XML answer from your service:
var xml = new XML();
xml = <ITEMS>
<BATCH_ID>X001</BATCH_ID>
<NAME>XML TEST VALUE </NAME>
<STEPS>
<STEP>
<STEP_ORDER>1</STEP_ORDER>
<NO_MORE_THAN>1,5</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
<STEP>
<STEP_ORDER>2</STEP_ORDER>
<NO_MORE_THAN>2</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
<STEP>
<STEP_ORDER>3</STEP_ORDER>
<NO_MORE_THAN>20</NO_MORE_THAN>
<START_TIME>1513750662</START_TIME>
</STEP>
</STEPS>
</ITEMS>
var result = xml.BATCH_ID;
Well I did test with your code and calling the service and it also works:
Hi Carles,
What is the your output type? I selected string, maybe it was wrong.
Sorry, I found mistake. I didn't define result variable.
I just type result = xml.BATCH_ID instead of var result = xml.BATCH_ID
Also, it is not case sensitive
On my case it's case sensitive, are you sure it aren't case sensitive on your side?
Yes, I'm sure. By the way, thank you so much for your support.