Xpath add a field from an item to another item with a reference id - xpath

This is the structure of the file I need to import.
<channel>
<item>
<type>image</type>
<title>title image</title>
<id>1</id>
<image_url>url_to_image</image_url>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>2</id>
<ref>
<entity>image_ref</entity>
<ref_value>1</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
</channel>
In the page item the tag contains the id of the image item.
How do I add the image url from the image item to the page item?
I'm trying to use
/channel/item[id=ref/ref_value[../entity/text() = 'image_ref']]/image_url but it does not work...
What's the XPath expression to not import the image item but just the page item?
Thanks in advance

Use:
/*/item[type='image' and id=../item[type='page']
/ref[entity = 'image_ref']/ref_value]
/image_url/text()
XSLT - based verification:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:copy-of select=
"/*/item[type='image' and id=../item[type='page']
/ref[entity = 'image_ref']/ref_value]
/image_url/text()"/>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied to the provided XML document:
<channel>
<item>
<type>image</type>
<title>title image</title>
<id>1</id>
<image_url>url_to_image</image_url>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>2</id>
<ref>
<entity>image_ref</entity>
<ref_value>1</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
</channel>
the XPath expression is evaluated and the result of this evaluation is copied to the output:
url_to_image
Update:
The OP has implied in comments that there may be many "page items" and "image items" and that he needs an expression, getting the image url for only a specific page.
This XPath expression:
/*/item[type='image'
and id=../item[type='page'][1]
/ref[entity = 'image_ref']/ref_value
]
/image_url/text()"/>
produces the wanted image url for the first "page item" in the following XML document:
<channel>
<item>
<type>image</type>
<title>title image</title>
<id>1</id>
<image_url>url_to_image</image_url>
</item>
<item>
<type>image</type>
<title>title image</title>
<id>2</id>
<image_url>url2_to_image</image_url>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>3</id>
<ref>
<entity>image_ref</entity>
<ref_value>1</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>4</id>
<ref>
<entity>image_ref</entity>
<ref_value>2</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
</channel>
The result produced is:
url_to_image
To get the wanted url for the second page item, we simply modify the above XPath expression to:
/*/item[type='image'
and id=../item[type='page'][2]
/ref[entity = 'image_ref']/ref_value
]
/image_url/text()"/>
and now the result is:
url2_to_image

Related

Get product category IDs from Magento v2.0 SOAP API

How can i get the list of categories a product is a member of, using the Magento v2.0 SOAP web service?
On http://devdocs.magento.com/guides/v2.0/soap/bk-soap.html i found a list of services.
With the catalogProductRepositoryV1, i can request a list or a single product, but it doesn't contain the categories. eg:
Request:
POST http://domain/soap/default?services=catalogProductRepositoryV1 HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8; action="catalogProductRepositoryV1Get"
Host: domain
Content-Length: 382
Expect: 100-continue
Accept-Encoding: gzip, deflate
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<catalogProductRepositoryV1GetRequest xmlns="http://domain/soap/default?services=catalogProductRepositoryV1">
<sku xmlns="">24-MB01</sku>
</catalogProductRepositoryV1GetRequest>
</s:Body>
</s:Envelope>
Response:
HTTP/1.1 200 OK
Date: Fri, 20 May 2016 12:21:46 GMT
Server: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 PHP/5.6.21
X-Powered-By: PHP/5.6.21
Set-Cookie: PHPSESSID=89fdd89a6caeb8be424b9531c69d6c69; expires=Fri, 20-May-2016 13:21:47 GMT; Max-Age=3600; path=/; domain=domain; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 5547
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Connection: close
Content-Type: application/soap+xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://domain/soap/default?services=catalogProductRepositoryV1">
<env:Body>
<ns1:catalogProductRepositoryV1GetResponse>
<result>
<id>1</id>
<sku>24-MB01</sku>
<name>Joust Duffle Bag</name>
<attributeSetId>15</attributeSetId>
<price>34</price>
<status>1</status>
<visibility>4</visibility>
<typeId>simple</typeId>
<createdAt>2016-01-22 16:28:25</createdAt>
<updatedAt>2016-04-20 09:51:54</updatedAt>
<extensionAttributes/>
<productLinks>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB03</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB05</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB06</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB02</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-UB02</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-WB03</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-WB07</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-WB04</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
</productLinks>
<options/>
<mediaGalleryEntries>
<item>
<id>1</id>
<mediaType>image</mediaType>
<label>Image</label>
<position>1</position>
<disabled>false</disabled>
<types>
<item>image</item>
<item>small_image</item>
<item>thumbnail</item>
</types>
<file>/m/b/mb01-blue-0.jpg</file>
</item>
</mediaGalleryEntries>
<tierPrices/>
<customAttributes>
<item>
<attributeCode>description</attributeCode>
<value><p>The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.</p>
<ul>
<li>Dual top handles.</li>
<li>Adjustable shoulder strap.</li>
<li>Full-length zipper.</li>
<li>L 29" x W 13" x H 11".</li>
</ul></value>
</item>
<item>
<attributeCode>meta_title</attributeCode>
<value>Joust Duffle Bag</value>
</item>
<item>
<attributeCode>meta_keyword</attributeCode>
<value>Joust Duffle Bag</value>
</item>
<item>
<attributeCode>meta_description</attributeCode>
<value>Joust Duffle Bag <p>The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places t</value>
</item>
<item>
<attributeCode>image</attributeCode>
<value>/m/b/mb01-blue-0.jpg</value>
</item>
<item>
<attributeCode>small_image</attributeCode>
<value>/m/b/mb01-blue-0.jpg</value>
</item>
<item>
<attributeCode>thumbnail</attributeCode>
<value>/m/b/mb01-blue-0.jpg</value>
</item>
<item>
<attributeCode>category_ids</attributeCode>
<value>
<xsd:string>3</xsd:string>
<xsd:string>4</xsd:string>
</value>
</item>
<item>
<attributeCode>options_container</attributeCode>
<value>container2</value>
</item>
<item>
<attributeCode>required_options</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>has_options</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>image_label</attributeCode>
<value>Image</value>
</item>
<item>
<attributeCode>small_image_label</attributeCode>
<value>Image</value>
</item>
<item>
<attributeCode>thumbnail_label</attributeCode>
<value>Image</value>
</item>
<item>
<attributeCode>msrp_display_actual_price_type</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>url_key</attributeCode>
<value>joust-duffle-bag</value>
</item>
<item>
<attributeCode>tax_class_id</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>activity</attributeCode>
<value>11,19,21,22</value>
</item>
<item>
<attributeCode>style_bags</attributeCode>
<value>25,26,29</value>
</item>
<item>
<attributeCode>material</attributeCode>
<value>37,38</value>
</item>
<item>
<attributeCode>strap_bags</attributeCode>
<value>61,62,63,64,65,66</value>
</item>
<item>
<attributeCode>features_bags</attributeCode>
<value>74,76,79</value>
</item>
<item>
<attributeCode>eco_collection</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>performance_fabric</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>erin_recommends</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>new</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>sale</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>eboekhouden_grootboekrekening</attributeCode>
<value>8000</value>
</item>
<item>
<attributeCode>eboekhouden_costcenter</attributeCode>
<value>0</value>
</item>
</customAttributes>
</result>
</ns1:catalogProductRepositoryV1GetResponse>
</env:Body>
</env:Envelope>
in the product detail SOAP Call i.e. catalogProductRepositoryV1
you will find category_ids as an item in customAttributes tag
<customAttributes>
...
<item>
<attributeCode>category_ids</attributeCode>
<value>
<xsd:string>3</xsd:string>
<xsd:string>4</xsd:string>
</value>
</item>
...
</customAttributes>
than you need to load the categories if you want any information of that from catalogCategoryRepositoryV1

Remove invalid XML after xmllint validation

I receive a large XML file and often the XML file do not validate to schema file.
Instead of droping the whole xml file I would like to remove the "invalid" content and save the rest of the XML file.
I'm using xmllint to validate the xml by this command:
xmllint -schema testSchedule.xsd testXML.xml
The XSD file (in this example named testSchedule.xsd):
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.testing.dk" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="MasterData">
<xs:complexType>
<xs:sequence>
<xs:element name="Items">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:integer" name="Id" minOccurs="1"/>
<xs:element type="xs:integer" name="Width" minOccurs="1"/>
<xs:element type="xs:integer" name="Height" minOccurs="0"/>
<xs:element type="xs:string" name="Remark"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
And the XML file (In this example named testXML.xml):
<?xml version="1.0" encoding="ISO-8859-1" ?>
<MasterData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.testing.dk">
<Items>
<Item>
<Id>1</Id>
<Width>10</Width>
<Height>100</Height>
<Remark>This is OK</Remark>
</Item>
<Item>
<Id>2</Id>
<Width>20</Width>
<Height>200</Height>
<Remark>This is OK - But is missing Height a non mandatory field</Remark>
</Item>
<Item>
<Id>3</Id>
<Height>300</Height>
<Remark>This is NOT OK - Missing the mandatory Width</Remark>
</Item>
<Item>
<Id>4</Id>
<Width>TheIsAString</Width>
<Height>200</Height>
<Remark>This is NOT OK - Width is not an integer but a string</Remark>
</Item>
<Item>
<Id>5</Id>
<Width>50</Width>
<Height>500</Height>
<Remark>This is OK and the last</Remark>
</Item>
</Items>
</MasterData>
Then I get the this result of the xmllint command:
testXML.xml:18: element Height: Schemas validity error : Element '{http://www.testing.dk}Height': This element is not expected. Expected is ( {http://www.testing.dk}Width ).
testXML.xml:23: element Width: Schemas validity error : Element '{http://www.testing.dk}Width': 'TheIsAString' is not a valid value of the atomic type 'xs:integer'.
testXML.xml fails to validate
And that is all correct - There is two errors in the XML file.
Now I would like to have a tool of some kind to remove entry 3 and 4 so I end up with this result:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<MasterData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.testing.dk">
<Items>
<Item>
<Id>1</Id>
<Width>10</Width>
<Height>100</Height>
<Remark>This is OK</Remark>
</Item>
<Item>
<Id>2</Id>
<Width>20</Width>
<Height>200</Height>
<Remark>This is OK - But is missing Height a non mandatory field</Remark>
</Item>
<Item>
<Id>5</Id>
<Width>50</Width>
<Height>500</Height>
<Remark>This is OK and the last</Remark>
</Item>
</Items>
</MasterData>
Does anybody in here have a tool that can do this?
I'm currently using bash scripting and the xmllint.
I really hope somebody can help.
You can achieve that with this XSLT stylesheet, which you can run in any environment which supports XSLT 1.0 (most languages), using an command line tool such as xsltproc (libxslt) or Saxon, a browser or an online tool. Here is an example.
If you feed your original XML file as input to a XSLT transformer with the following stylesheet it will produce the result you have shown in your second XML:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:t="http://www.testing.dk">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="t:Item[t:Id and not(number(t:Id))]"/>
<xsl:template match="t:Item[t:Width and not(number(t:Width))]"/>
<xsl:template match="t:Item[t:Height and not(number(t:Height))]"/>
<xsl:template match="t:Item[not(t:Width)]"/>
<xsl:template match="t:Item[not(t:Id)]"/>
<xsl:template match="t:Item[not(t:Remark)]"/>
</xsl:stylesheet>
The first <xsl:template> block simply copies all nodes from the source tree to the result tree. It has lower precedence than the specific templates which match nodes by their name.
Since matches are done in XPath which requires namespace-qualified selectors, your default namespace was declared in the <xsl:stylesheet> opening tag and mapped to a prefix that was used to qualify the tag names.
Each template uses an XPath expression to test if a specific child element is present or not in Item, or if that child is present, if it is a number (according to the XSD).
I'm using XSLT 1.0, which is more widely supported and should be easier to find in your environment. But if you can use a XSLT 2.0 processor, you could use XSLT 2.0 features such as support for XSD types, and instead of comparing your values to number type, you could compare them to specific types like xsd:integer.
You can verify the transformation performed on your example XML by that stylesheet in this XSLT Fiddle.
If you create a XML document containing the code above and place it in a file named stylesheet.xsl you can run the transformation using xsltproc (which probably exists in your environment) using:
xsltproc stylesheet.xsl testXML.xml > fixedXML.xml

XPATH expression not respected with filter using variable

There is this XSLT code in one of my projects
<xsl:template match="strategic-objectives/list/item" mode="table-of-contents">
<div class="toc">
<h3 class="report">Strategic objective: <xsl:value-of select="title"/></h3>
<xsl:variable name="flex_value" select="flex_value"/>
<xsl:apply-templates select="//root/data/operational-outcomes/list/item[sf = $flex_value]" mode="table-of-contents"/>
</div>
</xsl:template>
how much ever I try, the data for <operational-outcomes> does not match to sf = flex_value, but sf = '020000' matches.
I have checked the <flex_value> if proper in XML for the <strategic-objectives> item. It in fact also has 020000 as one of the values.
data
<data xsql-timing="3131">
<time>20 of April, 2014 (14:22) </time>
<strategic-objectives>
<list type="strategic_objective" xsql-timing="81">
<item num="1">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<attribute5>10 </attribute5>
<flex_value>010000 </flex_value>
<hierarchy_level>1 </hierarchy_level>
<title>Policy Making </title>
</item>
<item num="4">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<attribute5>10 </attribute5>
<flex_value>200000 </flex_value>
<hierarchy_level>1 </hierarchy_level>
<title>Employment </title>
<description> </description>
<text> </text>
</item>
</list>
</strategic-objectives>
<operational-outcomes>
<list type="outcome" xsql-timing="477">
<item num="9">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<flex_value>220025 </flex_value>
<parent_flex_value>220000 </parent_flex_value>
<hierarchy_level>3 </hierarchy_level>
<status>10 </status>
<attribute5>40 </attribute5>
<title>REVISED - Policies for growth, employment and poverty reduction </title>
<description></description>
<text> </text>
<sf>200000 </sf>
</item>
<item num="10">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<flex_value>740050 </flex_value>
<parent_flex_value>740000 </parent_flex_value>
<hierarchy_level>3 </hierarchy_level>
<status>10 </status>
<attribute5>40 </attribute5>
<title>DELETED - Internal Administration and Security </title>
<sf>700000 </sf>
</item>
</list>
</operational-outcomes>
</data>
Looking at your XML source, there's a white-space problem:
<flex_value>200000 </flex_value>
Every character matters, 200000␣␣␣␣ is not the same as 200000.
normalize-whitespace() strips leading and trailing whitespace, and collapses multiple subsequent whitespace characters within a string into one. Example:
<xsl:variable name="flex_value" select="normalize-space(flex_value)"/>
␣␣foo␣␣␣bar␣␣ becomes foo␣bar.

How do i display an image instead of text for a ? on an xml form for ODK collect?

Since odk collect uses utf-8, the language that i would like the questions of the form to be in would be displayed one character at a time vs. conjoined. instead of displaying text for the question, i want the question to display an image which will be on the question text formatted properly. Is there anyway this can be done, are there any good tutorials or information out there that can help me accomplish this?
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
<h:head>
<h:title>firstform</h:title>
<model>
<instance>
<data id="build_firstform_1375472795">
<meta>
<instanceID/>
</meta>
<field_name/>
<field_age/>
<field_location/>
</data>
</instance>
<itext>
<translation lang="eng">
<text id="/data/field_name:label">
<value>**<img src="Q1.png" >**</value>
</text>
<text id="/data/field_name:hint">
<value>What is your name (last, first)?</value>
</text>
the bolded code did not work.
<?xml version="1.0" encoding="UTF-8"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:jr="http://openrosa.org/javarosa" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><h:head xmlns="">
<h:title>images</h:title><model>
<instance>
<data id="1">
<some_text/>
<image_test/>
</data>
</instance>
<itext>
<translation lang="eng">
<text id="/data/image_test:label">
<value>picture test</value>
</text>
<text id="/data/image_test:a">
<value form="image">jr://images/p1.jpg</value>
</text>
<text id="/data/image_test:b">
<value form="image">jr://images/p2.jpg</value>
</text>
</translation>
</itext>
<bind nodeset="/data/image_test" type="select1"/>
</model>
</h:head>
<h:body xmlns="">
<select1 ref="/data/image_test">
<label ref="jr:itext('/data/image_test:label')"/>
<item>
<label ref="jr:itext('/data/image_test:a')"/>
<value>a</value>
</item>
<item>
<label ref="jr:itext('/data/image_test:b')"/>
<value>b</value>
</item>
<item>
<label ref="jr:itext('/data/image_test:c')"/>
<value>c</value>
</item>
</select1>
</h:body>
</h:html>

How to parse SOAP XML in ruby?

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="https://extranet.mcs.be/DEV_QUALITY_API/modules/quality/services/soap/quality.php"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getQuestionnairesListResponse>
<return SOAP-ENC:arrayType="ns1:QuestionnaireListItem[34]"
xsi:type="ns1:ArrayOfQuestionnaireListItem">
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000022</ID>
<Code xsi:type="xsd:string">Interest PubTransp</Code>
<Reference xsi:type="xsd:string">Check Employees Interest in Public
Transport</Reference>
</item>
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000008</ID>
<Code xsi:type="xsd:string">CS SRE North 2003</Code>
<Reference xsi:type="xsd:string">Customer Satisfaction SRE North 2003</Reference>
</item>
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000006</ID>
<Code xsi:type="xsd:string">CS SRE South 2003</Code>
<Reference xsi:type="xsd:string">Customer Satisfaction SRE South 2003</Reference>
</item>
.
.
.
I want to parse the above soap String (I actually want to get items from the above soap). How could I do this?
There's a gem called Savon that's specifically made for dealing with SOAP in Ruby.
There's good documentation on the web site, once you looked into that and have more specific questions I'm sure we can help you.

Resources