cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

how can I read value of xml node?

SOLVED
Level 8

how can I read value of xml node?

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,

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: how can I read value of xml node?

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;

8 REPLIES 8

Re: how can I read value of xml node?

Hi,

It's case sensitive

Best Regards,

Carles.

Re: how can I read value of xml node?

Hi Carles,

I tried with BATCH_ID but result is same

Re: how can I read value of xml node?

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;

Highlighted

Re: how can I read value of xml node?

Well I did test with your code and calling the service and it also works:

Re: how can I read value of xml node?

Hi Carles,

What is the your output type? I selected string, maybe it was wrong.

Re: how can I read value of xml node?

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

Re: how can I read value of xml node?

On my case it's case sensitive, are you sure it aren't case sensitive on your side?

Re: how can I read value of xml node?

Yes, I'm sure. By the way, thank you so much for your support.