Category : xml-parsing

I try parse xml receiving from server with function simplexml_load_string(), but I receive parse error. Is another way to parse this xml? <xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="NewDataSet"><xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Measurements" msdata:UseCurrentLocale="true"><xs:complexType><xs:choice minOccurs="0" maxOccurs="unbounded"><xs:element name="Measurements"><xs:complexType><xs:sequence><xs:element name="Station" type="xs:long" minOccurs="0"/><xs:element name="ChannelID" type="xs:int" minOccurs="0"/><xs:element name="DateTime" type="xs:dateTime" minOccurs="0"/><xs:element name="Value" type="xs:double" minOccurs="0"/><xs:element name="Status" type="xs:int" minOccurs="0"/></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><DocumentElement xmlns=""><Measurements diffgr:id="Measurements1" msdata:rowOrder="0"><Station>12</Station><ChannelID>6</ChannelID><DateTime>2021-06-04T18:10:00+02:00</DateTime><Value>13.77392</Value><Status>0</Status></Measurements><Measurements diffgr:id="Measurements2" ..

Read more

I have this XML link example: https://np.tritondigital.com/public/nowplaying?mountName=KFRQFMAAC&numberToFetch=3&eventType=track&request.preventCache=1621376522745 Inside to the node "nowplaying-info-list" I have nodes called "nowplaying-info" and I need get each property for nodes "nowplaying-info", for example, <nowplaying-info-list> <nowplaying-info mountName="KFRQFMAAC" timestamp="1621894561" type="track"> <property name="cue_time_duration"> <![CDATA[ 05:07 ]]> </property> <property name="cue_time_start"> <![CDATA[ 1621894561283 ]]> </property> <property name="cue_title"> <![CDATA[ WIND OF CHANGE ]]> </property> <property name="program_id"> ..

Read more

I want to get decode the Azure Response and need to get the attribute values of surname, name, givenname etc… I just tried the following but nothing helps… $dom = new DOMDocument(); $dom->loadXML($response); $doc = $dom->documentElement; $xpath = new DOMXpath($dom); $xpath->registerNamespace(‘samlp’, ‘urn:oasis:names:tc:SAML:2.0:protocol’); $xpath->registerNamespace(‘saml’, ‘urn:oasis:names:tc:SAML:2.0:assertion’); $isAttribute = false; foreach ($xpath->query(‘/samlp:Response’, $doc) as $attr) { $isAttribute = ..

Read more

I am stuck on reading a attribute from a xml file. A sample of the xml file is this: <products products_num="358"> <product product_id="71166" type="main" product_counter="1"> <product_id>71122</product_id> <sku>TN245</sku> <model>37TN245Y</model> <name>PRODUCT NAME</name> <manufacturer>OEM</manufacturer> <url>http://www.mysite.xx/index.php?route=product/product&amp;product_id=71122</url> <product_categories prod_cat_num="1"> <category_path category_id="48">CATEGORY -&gt; CATEGORY</category_path> </product_categories> <mpn>-</mpn> <barcode>-</barcode> <date_added>2021-03-17 15:16:26</date_added> <last_modified>2021-03-17 15:16:26</last_modified> <description><![CDATA[DESCRTION]]></description> <images> <image_url type="main">http://www.mysyte.xx/image/catalog/product/10061.jpg</image_url> </images> <price tax_rate="24%" customer_perc="50.00%" currency="EUR"> <price_original>7.9300</price_original> ..

Read more

I am receiving a SOAP XML response from a soap call to a web service. My SOAP call is receiving a response. my code to generate the response is: $soapUrl = "https://website.azurewebsites.net/services/IntSer.svc"; $xml_post_string = ‘<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"> <soapenv:Header/> <soapenv:Body> <tem:DownloadLP> <tem:userName>UN</tem:userName> <tem:password>PwD</tem:password> </tem:DownloadLP> </soapenv:Body> </soapenv:Envelope> ‘; $headers = array( "Content-type: text/xml;charset="utf-8"", "Accept: text/xml", "Cache-Control: no-cache", ..

Read more

I’m struggling with parsing xml from url with simplexml_load_file PHP. I found many examples here on stackoverflow but no one gave me the result I expect. This is a part of the xml url. What I would like to get is itunes:image or google:image tag. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="rss.xslt" ?> <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" ..

Read more

I’m trying to build a parser for XML documents in the following format: <subtopic> <header>Subtopic #1</header> <notes> <data>Some text here…</data> <data>More text here…</data> </notes> </subtopic> However, when I run this parser, nothing is displayed. Are the patterns wrong? function parseContent($content) { $output = array(); $pattern = ‘/<subtopic>([sS.]*?)</subtopic>/’; preg_match_all($pattern, $content, $subtopics); if($subtopics[1]) { $pattern = ‘/(<header>([sS.]*?)</header>)(?:[sS.]*?)(<notes>([sS.]*?)</notes>)/’; ..

Read more