Hi Everyone,
For some reason, my addChild and addAttribute functions only seem to work when I enter in direct strings. They don't work when I enter in a variable string that I received from a html form POST.
Anyone know the reason why?
$question = "What is your name?";
$entry->addChild("Question")->addAttribute("text",$question);
...
I'm using simplexml_load_file() to fetch my Twitter RSS feed and process it:
$feed = 'http://twitter.com/statuses/user_timeline/user.rss';
$tweets = simplexml_load_file($feed)
The data itself looks like this:
<item>
<title>Title</title>
<description>This is a description</description>
<pubDate>Sun, 15 Aug 2010 18:21:20 +0...
I have decided to use Simple XML serialization and was stucked with basic problem. I am trying to serialize java.util.UUID class instance as final field in this small class:
@Root
public class Identity {
@Attribute
private final UUID id;
public Identity(@Attribute UUID id) {
this.id = id;
}
}
Tutorial shows h...
Ok guys,
Essentially, im loading a simplexml_load_file from a URL like this
$stats = simplexml_load_file("http://example.com/api/api.asmx/Campaign.GetSummary?ApiKey=$apikey&CampaignID=$CID");
Which returns this
SimpleXMLElement Object
(
[Recipients] => 1
[TotalOpened] => 0
[Clicks] => 0
[Unsubscribed] => 0
[...
I have the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<gnm:Workbook xmlns:gnm="http://www.gnumeric.org/v10.dtd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gnumeric.org/v9.xsd">
<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http...
Hi, I've never asked a question here before so please forgive my question if its formatted badly or not specific enough. I am just a dabbler and know very little about PHP and XPath.
I have an XML file like this:
<catalogue>
<item>
<reference>A1</reference>
<title>My title1</title>
</item>
<item>
<reference>A2</reference>
<t...
I have a script pulls some data out of a database and then sends it in xml format using SimpleXML. Clients that use the service load the xml using file_get_contents(url-to-script) and then use SimpleXML to find the relevant data and display it on a webpage.
The problem I am having is that the output on the webpage is always escaped. I...
I am trying to extract some data from XML but when I execute the following I get a "Warning: Invalid argument supplied for foreach() in ..." message
foreach ($xml->custom-field-value as $milestone) {
print "<tr>";
print "<td>".$milestone->{'field-number'}." ".$milestone->{'value'}."</td>";
print "</tr>";
}
It works fine for ...
I am reading xml with this code.
$xml = simplexml_load_string($data);
it reads correctly, and can access to data via $xml->title etc.
but i need to access to CDATA and <media:xxx> tags.
example of xml: pastie
from: http://www.metacafe.com/api/item/4779040/
is possible to parse that data? how?
sorry for my english! :)
...
I have this simplexml result object:
object(SimpleXMLElement)#207 (2) {
["@attributes"]=>
array(1) {
["version"]=>
string(1) "1"
}
["weather"]=>
object(SimpleXMLElement)#206 (2) {
["@attributes"]=>
array(1) {
["section"]=>
string(1) "0"
}
["problem_cause"]=>
object(SimpleXMLElement)#94 (1) {
["@attr...
I have an xml file
<?xml version="1.0" encoding="utf-8"?>
<xml>
<events date="01-10-2009" color="0x99CC00" selected="true">
<event>
<title>You can use HTML and CSS</title>
<description><![CDATA[This is the description ]]></description>
</event>
</events>
</xml>
I used xpath and and xquer...
<contact:addr>
<contact:street></contact:street>
<contact:street></contact:street>
<contact:street></contact:street>
<contact:city></contact:city>
<contact:pc></contact:pc>
<contact:cc></contact:cc>
</contact:addr>
On the example above we can see that we do have three times the element street;
Is there a way, by using simpl...
I'm trying to write a PHP script that gets my total unread count from Google Reader. I already have it getting the XML response from Google (which also includes unread counts for each feed), but now I'm having trouble accessing the right node in order to get the number I want, just the total unread items. Here's the basic structure of ...
I realize that my request is not possible using just SimpleXML -- that much I did figure out. Here is what I tried:
$newXML = simplexml_load_file($filePath);
$domNewXML = dom_import_simplexml($newXML);
$domItem = dom_import_simplexml($items[$itemQty]); <-- item I want to move
$domNewItem = $domItem->cloneNode(true);
$newNode = $domNew...
I am writing a proxy service for caching the queries that my mobile app makes to webservice. (like a man in the middle)
The task of proxy site I have built is pass the query it gets from the app onto third party webservice and save the response from the third party webservice as an XML file and for all subsequent calls for the same que...
Can somebody show me some examples to import a html-page and
use the XPath to find the keywords including the rest of the text from the div, p, title etc.
Thank you!
EDIT:
In this case i use my webcrawler for example, i have a form to get the website to be crawled and the keywords wich has to be find in pages of the website.
http://c...
Is there any function that makes string from PHP simpleXMLElement?
...
Hi,
i want to get all the values on "ListNumber", how can i loop it using php? thanks in advance :)
[ListNumbersList] => SimpleXMLElement Object
(
[Record] => SimpleXMLElement Object
(
[Returned] => 1
)
[ListNumber] => Array
(
[0] => 1
...
I am trying to unmarshall data from an XML object in Java using SimpleXML. The point of the whole thing was to convert an API from JAXB to SimpleXML. Therefore, I used the annotation way of parsing the document. Here is some code:
In the User class:
@Element(name="created", required=false)
private Date created;
The programmer who wro...
I have the following part of my xml:
<book number="AB 123" type="SCI"> <info> <type code="FIC"><![CDATA[Fiction]]></status> <publish-time><![CDATA[20090110214000]]></publish-time> </info> </book>
If i do:
echo $key->info->type;
I get nice and easy "Fiction"
BUT if i do:
echo $key->info->publish-time;
I get "0". I thought i has to do ...