Here is an example bit from the xml file:
<array>
<dict>
<key>Name</key>
<string>Joe Smith</string>
<key>Type</key>
<string>Profile</string>
<key>Role</key>
<string>User</string>
<key>Some Number</key>
<integer>1</integer>
<key>Some Boolean</key>
<true/>...
I have something like this:
$url = "http://ws.geonames.org/findNearbyPostalCodes?country=pl&placename=";
$url .= rawurlencode($city[$i]);
$xml = simplexml_load_file($url);
echo $url."\n";
$cityCode[] = array(
'city' => $city[$i],
'lat' => $xml->code[0]->lat,
'lng' => $xml->code[0]->lng
);
It suppose to download xml ...
I'm trying to work with this XML feed that uses namespaces and i'm not able to get past the colon in the tags. Here's how the XML feed looks like:
<r25:events pubdate="2010-05-19T13:58:08-04:00">
<r25:event xl:href="event.xml?event_id=328" id="BRJDMzI4" crc="00000022" status="est">
<r25:event_id>328</r25:event_id>
<r25:event_name>Test...
I'm trying to access the number in the below element, but I'm having trouble getting the value out of it.
echo $object->0; //returns Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$'
SimpleXMLElement Object (
[0:public] => 15810
)
Any ideas on how I can get that value?
Update
I r...
I'm using SimpleXML to load in some xml files (which I didn't write/provide and can't really change the format of).
Occasionally (eg one or two files out of every 50 or so) they don't escape any special characters (mostly &, but sometimes other random invalid things too). This creates and issue because SimpleXML with php just fails, an...
Hi,
i just want to know if there are any alternatives to simpleXML for parsing XML Data with PHP.
For example if simpleXML module is not loaded or even if there is a lib/class out there that has a better performance then SimpleXML.
...
I'm building a library to access the Google Analytics Data Export API. All the data the library accesses is in Atom format and utilises numerous different namespaces throughout. My experiments with the API have used SimpleXML for parsing so far, especially as all I have been doing is accessing the data held within the feed.
Now I'm comi...
I'm trying to load parse a Google Weather API response (chinese response). Here is the API call..
http://www.google.com/ig/api?weather=11791&hl=zh-CN
// This code fails with the following error
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=11791&hl=zh-CN');
( ! ) Warning: simplexml_load_string()
[funct...
I have a simpleXml object and want to read the data from the object , I am new to PHP and dont quite know how to do this. The object details are as follows.
I need to read [description] and [hours]. Thankyou.
SimpleXMLElement Object (
[@attributes] => Array (
[type] => array
)
[time-entry] => Array (
[0] =>...
Hi there,
As a newbie I need your help in getting multidimensional array from simplexml object.
suppose my array is like:
just for getting idea:
Here $data is a simplexml object contains below xml:
<users>
<user>
<id></id>
<nm></nm>
<gender>
<male></male>
<female></female>
</gender>
</user>
</users>
...
I basicly need to load the whole XML file, add a new line with content and then saving it. But I wondered which one is faster.. XMLWriter or SimpleXML? Oh, and, it's mainly large XML files, more then 10MB.
Thanks!
...
Crux of my problem:
I've got an XML file that returns 20 results. Within these results are all the elements I need to get. Now, I need to return them in a random order, and be able to specifically work with item 1, items 2-5, and items 6-17.
Idea 1: Use this script to convert the object to an array, which I can shuffle through. This is ...
Hey, I'm very newbie to xPath and time is against me, I don't have the time right now to learn a lot about it, so I hope you guys can help me with this! :)
Here is my xml format:
<Filme>
<Film>
<filmid>13497</filmid>
<originaltitel>Bird</originaltitel>
<originaluntertitel></originaluntertitel>
<titel>Bird (OmU)</titel>
<unte...
I think that (the title) is the problem I am having. I set up a MySQL connection, I read an XML file, and then I insert those values into a table by looping through the elements. The problem is, instead of inserting only 1 record, sometimes I insert 2 or 3 or 4. It seems to depend on the previous values I have read. I think I am rein...
I am looking to get the value A-1 through xpath based on a passed attribue.
I have passed the index attribute of the unit through php from a previous page and am accessing it by global GET:
$value = intval($_GET['index']);
the xml:
<UNIT index='1'>
<ID>A-1</ID>
<MANUFACTURER>testing inc.</MANUFACTURER>
</UNIT>
<UNIT inde...
Is there any way to show XML data in a good and readable format using PHP? I know I can build code to do this, but is there a function that does something similar I can reuse?
eg:
<animals><animal><name>Lion</name><type>Stay away</type></animal><animal><name>Koala Bear</name><type>Hug</type></animal></animals>
Is there some code that...
http://pastebin.com/nN8G78AH
I'm using simplexml() function to parse through RSS feed, while i can access $var->title to < title> how do I access < dcterms:issued>
...
I'm trying to write a parser for a xml postback listener, but can't seem to get it to dump the xml for a sample. The API support guy told me to use 'DOMDocument', maybe 'SimpleXML'? Anyways here's the code: (thanks!)
<?php
$xml_document = file_get_contents('php://input');
$doc = new DOMDocument();
$doc->loadXML($xml_document);...
Hi,
I want to achieve the following xml using simple xml framework (http://simple.sourceforge.net/):
<events>
<course-added date="01/01/2010">
...
</course-added>
<course-removed date="01/02/2010">
....
</course-removed>
<student-enrolled date="01/02/2010">
...
</student-enrolled>
</event...
I am trying to retrieve the XML data for Google Calendar. Authentication and retrieval all works. However, when I retrieve the events, gd: data isn't included as the protocol reference documents it would be (http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#RetrievingWithoutQuery)
Some error messages I'm runni...