Basically I have a script that updates an xml document in various places... However, I need the text to be in CDATA... So I attempted this:
$PrintQuestion->content->multichoice->feedback->hint->Passage->Paragraph->addChild('TextFragment', '<![CDATA[' . $value[0] . ']]>');
Unfortunately when I save the XML back to file,...
I'm using simpleXML to add in a child node within one of my XML documents... when I do a print_r on my simpleXML object, the < is still being displayed as a < in the view source. However, after I save this object back to XML using DOMDocument, the < is converted to < and the > is converted to >
Any ideas on how to change this beh...
Hello all,
<epp>
<domain:create xmlns:domain="urn:someurn">
<domain:name></domain:name>
<domain:registrant></domain:registrant>
<domain:contact></domain:contact>
</domain:create>
</epp>
I would like to add a child, on a very specific place (so I'm also using DOM and not only simpleXML) for <domain:create> ...
Hi all.
I'm trying to parse this feed: http://musicbrainz.org/ws/1/artist/c0b2500e-0cef-4130-869d-732b23ed9df5?type=xml&inc=url-rels
I want to grab the URLs inside the 'relation-list' tag.
I've tried fetching the URL with PHP using simplexml_load_file(), but I can't access it using $feed->artist->relation-list as PHP interprets "l...
example XML:
<users>
<user id="fakeuserid">
<password>fakeuserpassword</password>
<username>fakeusername</username>
</user>
<user id="anotherfakeuserid">
<password>anotherfakeuserpassword</password>
<username>anotherfakeusername</username>
</user>
</users>
I would like to be able to access the id attrib...
Hi,
When I parse an rss file with SimpleXMLElement, I get this object :
object(SimpleXMLElement)#307 (1) {
[0]=>
string(39) "http://workspace/wordpress/hello-world/"
}
$var->0 doesn't works.
I don't know how to do it :(
thanks.
...
I have a variable named $data["main_deal"] that has the value $xml->deals->deal[0] (as a string). $xml is a simpleXML object, and the value of main_deal is the selector needed to access the data I want.
When I tried echo "<p><b>Main Deal:</b> ".$data["main_deal"]; it output: Main Deal: $xml->deals->deal[0]
So I went back to where I gav...
I neeed to convert a SimpleXML object to a DOMDocument, to use it with DOMXPath. I need DOMXPath for it's method registerPHPFunctions. Can this be done?
With dom_import_simplexml I get a DOMElement, not DOMDocument.
...
I try to get the lat and lon's from a gpx file (GPS XML).
When I do (snippet): $res = $xml->xpath('//*');
I get the full content returned.
When I try to narrow down like this: $res = $xml->xpath('//rte');
I get nothing: array(0) { }.
Even when the tag(s) exists.
Actually whatever I try to fill in after // other then * it returns...
I'm parsing simplexml and normally my simple xml would look like this
$sig_size = (int)$xmlObject->sig->points;
which returns 24 in this example
<?xml version='1.0' standalone='yes'?>
<photo id='470'>
<artist>mg</artist>
<lines>
<points>22</points>
<angle>-5</angle>
<x>165</x>
<align>...
Hi all,
I have an email xml file like this:
<?xml version='1.0' standalone='yes'?>
<emails>
<email id="contract-expired">
<description>We send this email when we want to inform a user that a contract is coming up to it's expiration date</description>
<subject>Example: Contract Expiration</subject>
<parameters>
<par...
Hi Im trying to parse an xml feed using simplexml in php.
The xml feed is laid out as follows:
<Member>
<MemberType>Full</MemberType>
<JoinDate>2010-06-12</JoinDate>
<DataType>A</DataType>
<Data>
<FirstName>Ted</FirstName>
<LasttName>Smith</LasttName>
<Data1>56</Data1>
<Data2>100</Data2>
...
This is sort of confusing to explain, so thank you ahead of time for bearing with me.
I am using Kohana PHP framework to develop an application. I have a model function that accepts parameters for a search, and should return an XML styled page. I need this to be read by the controller with SimpleXML. Any ideas how to do this?
$o = ...
Hi,
I've had a look round similar articles such as this one and I can't quite get it to work, quite possible I'm just misunderstanding.
I've got a simple script which parses a bit of xml and prints out specific fields - what I'm having trouble doing is accessing the data of SimpleXMLElement Objects.
XML (simplified for clarity)
<cha...
Is there any way to loop through an xml loaded in simpleXML in reverse?
say if i have the following xml
$string ="<items>
<item>1</item>
<item>2</item>
<item>3</item>
</items>";
$xml = simplexml_load_string($string);
is there any way to reverse $xml so that i get item 3 when i do a foreach
...
I'm trying trying to use simplexml to read a feedburner xml. I can read every properties in the xml but not the keys with ':' in it. Example "feedburner:origLink". When I vardump the items, those keys with : doesn't show up. And I can't do like $s->item->feedburner:origLink.
Please advise!
...
I am trying to parse the XML found on the page ...
http://www.rapleaf.com/apidoc/person
Name: Test Dummy
Age: 42
gender: Male
Address: San Francisco, CA, US
Occupation:
University: Berkeley
first seen: 2006-02-23
last seen: 2008-09-25
Friends: 42
Name:
Age:
gender:
Address:
Occupation:
University:
first seen:
last seen:
Friends:
1) ...
I want to access the 'url' attribute in the media:content element below. I am pretty sure this gives me the media:content, but I can not seem to get the url (see what I tried below):
$theContent = $item->children('media', true)->content;
xml:
<item>
<media:content type="image/jpeg" url="my url" />
</item>
I have tried variations:
...
I'm using SimpleXML to load and parse an XML document with PHP.
I'm not too familiar with XPath and I would prefer using CSS selectors to parse it. What are my options? Is there anything pre-build for SimpleXML, or should I be using something different altogether ?
...
<?php
// load SimpleXML
$entry = new SimpleXMLElement('http://bit.ly/c3IqMF', null, true);
echo <<<EOF
<table>
<tr>
<th>Title</th>
<th>Image</th>
</tr>
EOF;
foreach($entry as $item) //
{
echo <<<EOF
<tr>
<td>{$item->title}</td>
...