[phpXML] Re: [phpXML] RE: [phpXML] Answers to Olivers three questions
Brought to you by:
bs_php,
nigelswinson
From: <nig...@us...> - 2001-10-08 18:17:54
|
RE: [phpXML] Re: xml.php locationHmm, damn. First bug. Change to "_setContent" It must just be a case sensitive issue. Nigel =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb ----- Original Message -----=20 From: o.t...@ab...=20 To: us...@li...=20 Sent: Tuesday, September 25, 2001 9:14 AM Subject: [phpXML] RE: [phpXML] Answers to Olivers three questions I get this message: Fatal error: Call to undefined function: _setcontent() in XPath.class.php= on line 903 What to do? Oliver -----Original Message----- From: nig...@us... [mailto:nig...@us...u= rceforge.net] Sent: dinsdag 25 september 2001 3:36 To: us...@li... Subject: [phpXML] Answers to Olivers three questions The first thing you need to do is go get the latest version, ie 1.N.5. = Available from phpxml's 1.N.X's home at http://www.sourceforge.net/project= s/phpxmldb How do I save an altered XML document using PHPXML?=20 Use the exportToFile() method function exportToFile($fileName, $absoluteXPath=3D'', $xmlHeader=3D= '<?xml version=3D"1.0"?>') http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.ph= p#exportToFile How to add a node to an XML file. add_node does not seem to work.=20 Please advise.=20 Use the appendData() method function appendData($absoluteXPath, $value) Note that the parameter is an "absolute X Path" expression, not just an= y old x path expression, so it must address 1 unique node. ie "/root[1]/re= cords[4]" not "/root/record[4]". http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.ph= p#appendData How do I get attributes by the XPath function in phpxml?=20 I want to do something like in this code:=20 $results =3D $xml->evaluate("//users/user[@us_workspace=3D$workspace]= /product[@us_prname=3D$product]");=20 file://Display user in list=20 $attributes =3D array();=20 foreach ($results as $users) {=20 file://username=20 $attributes =3D $xml->get_attributes("parent::".$users);=20 Use the getAttributes method function getAttributes($absoluteXPath, $attribute =3D '') Note again the absolute X path expression. If you pass an array in, th= en it won't work. If you want just the one attribute, then you can specify= it, otherwise you get all the attributes in an array. http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.ph= p#getAttributes Cheers Nigel =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D For the most recent version of phpxml, V1.N.X, and an archive of this l= ist visit: http://www.sourceforge.net/projects/phpxmldb -- This message has been sent through the <phpXML/> user discussion list. To u= nsubscribe, please visit https://sslsites.de/mailinglisten/user/user@lists.= phpxml.org/ |