473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XML, RSS and PHP simplexml

given the following code:

<?xml version="1.0" encoding="utf-8" ?>
<rss version="0.91">
<config>
<status>exists</status>
</config>
</rss>

why is <rss version="0.91"></rss> required to get it to print out with
the following php code:

<?php
$s = simplexml_load_file('default/config.xml');
print $s->config->status . "\n";
?>

i've visited a few tutorials that didn't even mention rss and, of
course, their examples didn't work. the above code does work. remove
rss and it doesn't work.

how come?

Feb 14 '06 #1
2 1319


Skeets wrote:

<?php
$s = simplexml_load_file('default/config.xml');
print $s->config->status . "\n";
?>

remove
rss and it doesn't work.


You need
$s->status
then I guess.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 14 '06 #2
martin, thanks, that worked. i guess there is no reason to call out
the doc level tag. i didn't pick this up from the tutorials i visited,
but that's probably my deficiency.

thanks again.

Feb 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: archi | last post by:
dear all, what would be the most simple way to multisort the (HTML) output from a simplexml file. imagine i have loaded a simplexml file with names & addresses & much more, and i would like...
1
by: hwcowan | last post by:
Hello, I have started using SimpleXML and can do most things, but there are a couple of things that I can't seem to figure out. Currently, I can: 1. Open & load an XML file 2. Manually...
3
by: theboss3 | last post by:
Take, for example a typical RSS 2.0 feed (like http://lorelle.wordpress.com/feed/) and tell me how I access the tags like 'content:encoded' and 'wfw:commentRSS' using SimpleXML. I've searched far...
1
by: root | last post by:
Hi folks - hope someone can help me. Firstly, my apologies for crossposting this to alt.php (and not properly crossposting either). I have an XML file with some elements like those below ...
2
by: mandric | last post by:
Hello, Can someone please enlighten me on how to preserve the <!]> element when parsing an xml file or string with simplexml. I'm using libxml 2.6.16 and php 5.1.4. I tried a few variations,...
2
by: whisher | last post by:
Hi. I'm taking my first steps with xml and SimpleXML functions. xml.php (It could be made dynamically with a mysql result I post this snippet for example ) PHP Code xml.php: <?php $xmlstr...
1
by: Andy | last post by:
Hi, I'm running in to a little issue with SimpleXML, and wondered if anyone knew if it was normal implementation for SimpleXML, or I'm not using a correct flag, or even it's a an issue that...
3
by: bleen | last post by:
I'm trying to use SimpleXML but I've run into a conundrum. Every day an XML file is generated that this script grabs and manipulates. How can I check that the XML has no problems before creating...
0
by: ty | last post by:
I have a script that takes a xml template then adds data into it using SimpleXMLElement. I then save it using asXML into a mysql database. On my development machine at home it works fine. ...
7
by: dimo414 | last post by:
So I'm trying to use SimpleXML to get some attribute information about some nodes in my XML document, but it seems like SimpleXML ignores attributes for elements with no children, For instance:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.