function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Naresh.ReddyNaresh.Reddy 

How to read data from xml in webservices

hi,

     I am developing a webservice in Apex. The xml file is like:

<?xml version="1.0" encoding="UTF-8" ?>
- <Body>
- <InvoiceRequest>
- <Item>
  <ItemName>num1</ItemName>
  <ItemPrice>$11.0</ItemPrice>
  <ItemId>01278390921098209AB872190</ItemId>
 <ItemId>01278390921098209AB872191</ItemId>
  <ItemType>NULL</ItemType>
  </Item>
</Body>

So, there will be more than one id's..i mean the element names may be same, . So in webservice how can i handle this.  PLease its urgent.....Thanx in advance....
..

Eugene NeimanEugene Neiman

Salesforce provides XMLStream classes that make it easy to read & write XML Strings.  Specifically, you have XMLStreamWriter for callouts, XMLStreamReader for reading through XML.  As an alternative, you can use Document and XMLNode classes to process XML content.

Naresh.ReddyNaresh.Reddy

Hi,

 

      Can you please give me an example for this...