473,748 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with DOMXML get_attribute() error message

Hi

Please forgive the length of this post and bear with me. I am having
trouble between two different servers and the same DOMXML code.

Basically I am trying to run a script that will:

1) load an XML file as a variable object ($xml_doc):
$xml_doc = domxml_open_fil e("menu.xml", DOMXML_LOAD_DON T_KEEP_BLANKS);
2) locate the first node as a variable object ($node):
$root = $xml_doc->document_eleme nt ();
$node = $root->first_child ();
3) output all node and siblings in sequence:
while ($node)
{
echo "<p>" . $node->get_attribut e ("htext") . "</p>";

$node->next_sibling ();
}
Below is the XML file (very basic):
<?xml version="1.0" encoding="iso-8859-1"?>
<menu>
<opt htext="Home" />
<opt htext="News" />
<opt htext="Products &amp; Services" />
<opt htext="Find us" />
<opt htext="Faq" />
<opt htext="Contact us" />
</menu>
Now, on my test server it works without any problems and all the nodes
are output in sequence. However, when I run it on the actual server
that I will be running the site from, it give me the following results:

Home

Fatal error: Call to undefined function: get_attribute() in
/data/httpd/VirtualHosts/csp/_testing/test_menu07.php on line 51
Notice how the first node (Home) is output so I can maybe assume the
following:

- that $xml_doc and $node are instantiated ok
- $node is able on the first (while) loop to call the get_attribute
function so $node as an object has been instatiated correctly
- It enters the while loop again so $node is present but for some
reason it doesnt have the get_attribute function.
Is there anyway that I can get a little more information about $node
everytime it is put through the while loop again that might tell me why
it has lost refererence to its functions (in this instance, the
get_attribute function)?
I dont have a great deal of knowledge about servers and the IT guys at
my work dont fully understand the syntax / programming methods of
DOMXML, is there anything that we can look into (versions,
configurations etc.) that may be causing this?
Is there anything that I should be aware about with traversing an XML
tree in this manner (using the state of $node to control a while loop
while outputing an attribute)?
Is there, well, anything other that I could be looking into (problems
with whitespacing, server configurations etc)?

I understand that there may be many factors that could be at play but
if any help would be much appreciated. Thanks

Burnsy

Jun 19 '06 #1
1 1803
Sorry, just noticed I'd made a mistake in my post:

3) output all node and siblings in sequence:

while ($node)
{
echo "<p>" . $node->get_attribut e ("htext") . "</p>";

$node = $node->next_sibling ();
}
This is the code I have been using that doesnt work on the final server
but does on the test one.

Jun 19 '06 #2

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

Similar topics

12
12890
by: Ghislain Benrais | last post by:
Hello, My "problem" : install php's XSLT API. 1)I installed Sablotron (with the rpm) : ok 2) I read every where that the next step was to compile php with option --with-xslt-sablot. Since I have php's rpm, I wonder if I can use it directly and tell the rpm command to use this compilation option. Is it possible ? If not, that's no problem since I can download php and compile, but still I'm wondering if rpms can be used with such options....
0
2160
by: Terence | last post by:
The XML (expat) extension to PHP contains specific functions for accessing detailed error information when an error occurs parsing an XML packet. All be it convoluted, even the XSLT (Sablotron) extension will provide access to detailed error information. I can't seem to figure out how to access this information in DOMXML Does anyone have and light to shed on this aspect?
3
3234
by: srommens | last post by:
Hello, When I try to do : URI = <xsl:value-of select="//@URI"/><br/> <xsl:if test = "//@URI != '5-42922'">not equal</xsl:if><br/> <xsl:if test = "//@URI = '5-42922'">equal</xsl:if><br/> The result is :
4
4221
by: webguynow | last post by:
need the straight dope on domxml for Windows ! Is it bundled or are DLL's necessary ? Also, what changes are needed in php.ini ? My setup: WXP, PHP 5.0.2 as an Apache Module, libxml v2.6.11 or so it says. I see there's been quite a bit of posting on mailing.www.php-dev Re: phpinfo() mis-reporting domxml enabled. I had a post re: this also on: php.windows
0
2036
by: bissatch | last post by:
Hi, I have installed Apache2. I have installed PHP4.3.0. All is working fine. I have now went and tried to install DOMXML into PHP by simply uncommenting the extension = php_domxml.dll (or something like that) in php.ini. Unfortuntely I get the following error at a part of my PHP page where I try to load a xml file:
3
4026
by: bissatch | last post by:
Hi, I have recently installed PHP4 with Apache2. Currently I am trying to install the DOMXML extension. According to what I have read, if I uncomment the extension=php_domxml.dll line in php.ini (ensuring that extension_dir is correct and that the file is definitely in that folder) and then restart apache this should install domxml in PHP. Now! when I do phpinfo() it tells me that domxml is enabled (good). Unfortunetely, when I try...
5
3992
by: bissatch | last post by:
Hi, I have just managed to install DOMXML on my apache/PHP setup. I am running PHP 4.3.0 and Apache2. $xmldoc = domxml_open_file("inc/menu.xml", DOMXML_LOAD_DONT_KEEP_BLANKS); When I try to load an XML file using the above, it gives me the following error:
2
1448
by: KubixKiller | last post by:
Hello, I use the following XML-file to store some useless facts I want to display using PHP. I wrote some PHP code to generate HTML, because I do not have any knowledge of stylesheets etc etc. The problem arises that the php-function next_sibling from the DOMXML library doesn't seem to do what it should. See the code later in this message. Look at the lines below the comment line : # Cycle all item-elements
1
2003
by: dhiraaj1983 | last post by:
I have been trynig to implement the Google Adwords API in my account. For this i downloaded their API library with PHP scripts to run the projexct. It required me to uncomment php_curl.dll and php_domxml.dll in the php.ini settings. when i did that it gave me ample of errors. Then I read various forums and pertaining to that I downloaded the following dll files afterwhich only one error is ther related to domxml. The dll files i downloaded and...
0
8983
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9236
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4592
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.