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?

burak
10-Marble

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,

1 ACCEPTED SOLUTION

Accepted Solutions

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;

View solution in original post

8 REPLIES 8

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;

View solution in original post

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.

burak
10-Marble
(To:burak)

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.

Announcements