PHP Web Service Clients: Guzzle and xsd

3F72A12

New Member
I'm new to working with xml and xsd stuff. I'm trying to create a web service client using Guzzle:http://guzzlephp.org/index.htmlI was able to create a very basic client and 1 command following this tutorial:http://guzzlephp.org/tour/building_services.htmlThe issue I have is how get the returned XML into a more useful format. The web service I'm using (and its documentation and xsd) can be found here:http://www.epo.org/searching/free/ops.htmlI get a SimpleXMLElement. Assume following content of the XML:\[code\]<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/2.6.2/style/exchange.xsl"?><ops:world-patent-data xmlns:ops="http://ops.epo.org" xmlns="http://www.epo.org/exchange" xmlns:ccd="http://www.epo.org/ccd" xmlns:xlink="http://www.w3.org/1999/xlink"> <ops:meta name="elapsed-time" value="http://stackoverflow.com/questions/10482838/30"/> <exchange-documents> <exchange-document system="ops.epo.org" family-id="19768124" country="EP" doc-number="1000000" kind="A1"> <bibliographic-data> <publication-reference> <document-id document-id-type="docdb"> <country>EP</country> <doc-number>1000000</doc-number> <kind>A1</kind> <date>20000517</date> </document-id> <document-id document-id-type="epodoc"> <doc-number>EP1000000</doc-number> <date>20000517</date> </document-id> </publication-reference> <!-- a lot of content snipped --> </bibliographic-data> </exchange-document> </exchange-documents></ops:world-patent-data>\[/code\]How can I as very simple example extract the doc-number (on Line 11 of the XML above)?I tried:\[code\]$xpath = '/ops:world-patent-data/exchange-documents/exchange-document/bibliographic-data/publication-reference/document-id/doc-number';$data = http://stackoverflow.com/questions/10482838/$result->xpath($xpath);\[/code\]and variations of it but $data is always and empty array.
 
Back
Top