phpxpath-users Mailing List for Php.XPath (Page 17)
Brought to you by:
bs_php,
nigelswinson
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(346) |
Nov
(8) |
Dec
(21) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(30) |
Feb
(13) |
Mar
|
Apr
(3) |
May
(70) |
Jun
(26) |
Jul
(48) |
Aug
(22) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
|
2003 |
Jan
(3) |
Feb
(3) |
Mar
(11) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2004 |
Jan
(4) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(12) |
Aug
(8) |
Sep
(2) |
Oct
(2) |
Nov
(3) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2006 |
Jan
(3) |
Feb
(7) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: <nig...@us...> - 2001-10-08 18:22:32
|
Complete list of changes todate. ---------------------------------------------------------------------------= ----- 110c110 < return $this->exportAsXml($absoluteXPath[$index]); --- > return $this->exportAsXml($absoluteXPathArray[$index]); 219c219 < return setAttributes($absoluteXPath, $aNewAttributes); --- > return $this->setAttributes($absoluteXPath, $aNewAttributes); 221c221 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath, $attributes); 248c248 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath, $attributes); 537c537 < return evaluate($xPathQuery, $baseXPath); --- > return $this->evaluate($xPathQuery, $baseXPath); 560,561c560,561 < if(in_array($path,array_keys($this->nodes))) { < return array($path); --- > if(in_array($xPathQuery,array_keys($this->nodes))) { > return array($xPathQuery); 668c668 < * @param string $path Full document path of the node, the attribut= es --- > * @param string $xPathQuery Full document path of the node, the at= tributes 675c675 < return setAttributes($absoluteXPath, array($name =3D> $value)); --- > return $this->setAttributes($absoluteXPath, array($name =3D> $value)); 679,681c679,682 < * Version of setAttribute() that sets multiple windows. < *=20 < * @see setAttribute() --- > * Version of setAttribute() that sets multiple attributes. > * > * @param $attributes associative array of attributes to set. > * @see setAttribute() 683c684 < function setAttributes($absoluteXPath, $attribute) { --- > function setAttributes($absoluteXPath, $attributes) { 687,690c688,692 < if (isSet($this->nodes[$path]['attributes'])) { < $this->nodes[$path]['attributes'] =3D array_merge($this->nodes[$pat= h]['attributes'], $attributes); < } else {=20 < $this->nodes[$path]['attributes'] =3D $attributes; --- > if (isSet($this->nodes[$absoluteXPath]['attributes'])) { > $this->nodes[$absoluteXPath]['attributes'] =3D > array_merge($this->nodes [$absoluteXPath]['attributes'],$attribute= s); > } else { > $this->nodes[$absoluteXPath]['attributes'] =3D $attributes; 692c694,695 < }=20 --- > } >=20 712c715 < unset($this->nodes[$path]['attributes']); --- > unset($this->nodes[$absoluteXPath]['attributes']); 719c722 < unset($this->nodes[$path]['attributes'][$attribute]); --- > unset($this->nodes[$absoluteXPath]['attributes'][$attribute]); 725c728 < unset($this->nodes[$path]['attributes'][$name]); --- > unset($this->nodes[$absoluteXPath]['attributes'][$name]); 769c772 < return $this->nodes[$path]['text']; --- > return $this->nodes[$absoluteXPath]['text']; 816c819 < $ret =3D implode('', $this->nodes[$path]['text']); --- > $ret =3D implode('', $this->nodes[$absoluteXPath]['text']); 838c841 < return _setContent($absoluteXPath, $value); --- > return $this->_setContent($absoluteXPath, $value); 849c852 < * @param string $path Full document path of the node. *READONLY* --- > * @param string $xPathQuery Full document path of the node. *READO= NLY* 854c857 < return _setContent($absoluteXPath, $value, TRUE); --- > return $this->_setContent($absoluteXPath, $value, TRUE); 863c866 < * @param string $path Full document path of the node. *READONLY* --- > * @param string $xPathQuery Full document path of the node. *READO= NLY* 879c882 < _setContent($absoluteXPath, $newContent); --- > $this->_setContent($absoluteXPath, $newContent); 1997c2000 < if (ereg('^\w*$', $predicate)) { --- > if (ereg('^\w*$', $predicate)) {=20 3705c3708 < * @param string $path Full document path of the node. *READONLY* --- > * @param string $xPathQuery Full document path of the node. *READO= NLY* ---------------------------------------------------------------------------= ----- CVS was sick, so all these changes are as yet not in cvs... 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 -- 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/ |
From: <o.t...@ab...> - 2001-10-08 18:19:26
|
nope, not a case sensitive issue. Oliver -----Original Message----- From: nig...@us... [mailto:nig...@us...] Sent: dinsdag 25 september 2001 12:46 To: us...@li... Subject: [phpXML] Re: [phpXML] RE: [phpXML] Answers to Olivers three questions Hmm, damn. First bug. Change to "_setContent" It must just be a case sensitive issue. Nigel =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> ----- Original Message ----- From: o.t...@ab... <mailto:o.t...@ab...> To: us...@li... <mailto:us...@li...> 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...> [mailto:nig...@us...] Sent: dinsdag 25 september 2001 3:36 To: us...@li... <mailto: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/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> How do I save an altered XML document using PHPXML? Use the exportToFile() method function exportToFile($fileName, $absoluteXPath='', $xmlHeader='<?xml version="1.0"?>') http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#exp ortToFile <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ex portToFile> How to add a node to an XML file. add_node does not seem to work. Please advise. Use the appendData() method function appendData($absoluteXPath, $value) Note that the parameter is an "absolute X Path" expression, not just any old x path expression, so it must address 1 unique node. ie "/root[1]/records[4]" not "/root/record[4]". http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#app endData <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ap pendData> How do I get attributes by the XPath function in phpxml? I want to do something like in this code: $results = $xml->evaluate("//users/user[@us_workspace=$workspace]/product[@us_prname=$p roduct]"); file://Display <file://Display> user in list $attributes = array(); foreach ($results as $users) { file://username <file://username> $attributes = $xml->get_attributes("parent::".$users); Use the getAttributes method function getAttributes($absoluteXPath, $attribute = '') Note again the absolute X path expression. If you pass an array in, then 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.php#get Attributes <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ge tAttributes> Cheers Nigel =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
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/ |
From: <o.t...@ab...> - 2001-10-08 18:16:20
|
Nigel, It seems to be great improvements. However, some code I implemented before doesn't work anymore. For example the following code: $results = $xml->evaluate("//users/user[@us_username=$username and @us_password=$password and @us_workspace=$workspace]"); In the old situation it returned one node, but now the return value is empty. Please advise, Oliver Talens -----Original Message----- From: nig...@us... [mailto:nig...@us...] 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/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> How do I save an altered XML document using PHPXML? Use the exportToFile() method function exportToFile($fileName, $absoluteXPath='', $xmlHeader='<?xml version="1.0"?>') http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#exp ortToFile <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ex portToFile> How to add a node to an XML file. add_node does not seem to work. Please advise. Use the appendData() method function appendData($absoluteXPath, $value) Note that the parameter is an "absolute X Path" expression, not just any old x path expression, so it must address 1 unique node. ie "/root[1]/records[4]" not "/root/record[4]". http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#app endData <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ap pendData> How do I get attributes by the XPath function in phpxml? I want to do something like in this code: $results = $xml->evaluate("//users/user[@us_workspace=$workspace]/product[@us_prname=$p roduct]"); file://Display <file://Display> user in list $attributes = array(); foreach ($results as $users) { file://username <file://username> $attributes = $xml->get_attributes("parent::".$users); Use the getAttributes method function getAttributes($absoluteXPath, $attribute = '') Note again the absolute X path expression. If you pass an array in, then 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.php#get Attributes <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ge tAttributes> Cheers Nigel =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <o.t...@ab...> - 2001-10-08 18:15:28
|
thanks, but I know how to use XPath functions. I only don't know how to get the functions of xmlphp to work. For example the get_content functions returns nothing. The evaluate function works. regards, oliver -----Original Message----- From: gi...@bt... [mailto:gi...@bt...] Sent: woensdag 19 september 2001 12:00 To: us...@li... Subject: [phpXML] Re: [phpXML] RE: [phpXML] Re: [phpXML] xml.php location hi there are some good examples at : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/ht m/xmrefxpathexamples.asp regards girish ----- Original Message ----- From: <o.t...@ab...> To: <us...@li...> Sent: Wednesday, September 19, 2001 7:33 AM Subject: [phpXML] RE: [phpXML] Re: [phpXML] xml.php location > Thanks, > > Is there a place where I can find some good examples? I am familliar with > xml, but now I need to know how to use it in phpxml. > > Oliver. > > -----Original Message----- > From: se...@ww... [mailto:se...@ww...] > Sent: dinsdag 18 september 2001 9:50 > To: us...@li... > Subject: [phpXML] Re: [phpXML] xml.php location > > > Hello, > > You need to place it somewhere. And include it in every file this way: > > include("lib/xml.php"); // xmp.php placed in subfolder "lib" > > Serge. > > ----- Original Message ----- > From: o.t...@ab... <mailto:o.t...@ab...> > To: us...@li... <mailto:us...@li...> > Sent: Tuesday, September 18, 2001 4:38 PM > Subject: [phpXML] xml.php location > > > Hi, > > Can anybody tell me how to use the xml.php file. Do I have to place it on a > certain location, or do I have to include that in every file? > > > > > Thanks, > > Oliver Talens > **************************************************************** > Abyss I.T. Solutions > Mathildastraat 36B > 4901 HC Oosterhout > > http://www.Abyss.nl <http://www.Abyss.nl> > http://www.PanelPoint.nl <http://www.PanelPoint.nl> > > tel: +31 (0)162-439809 > fax: +31 (0)162-439882 > O.T...@Ab... > **************************************************************** > > > > -- > This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <o.t...@ab...> - 2001-10-08 18:13:32
|
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...] 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/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> How do I save an altered XML document using PHPXML? Use the exportToFile() method function exportToFile($fileName, $absoluteXPath='', $xmlHeader='<?xml version="1.0"?>') http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#exp ortToFile <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ex portToFile> How to add a node to an XML file. add_node does not seem to work. Please advise. Use the appendData() method function appendData($absoluteXPath, $value) Note that the parameter is an "absolute X Path" expression, not just any old x path expression, so it must address 1 unique node. ie "/root[1]/records[4]" not "/root/record[4]". http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#app endData <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ap pendData> How do I get attributes by the XPath function in phpxml? I want to do something like in this code: $results = $xml->evaluate("//users/user[@us_workspace=$workspace]/product[@us_prname=$p roduct]"); file://Display <file://Display> user in list $attributes = array(); foreach ($results as $users) { file://username <file://username> $attributes = $xml->get_attributes("parent::".$users); Use the getAttributes method function getAttributes($absoluteXPath, $attribute = '') Note again the absolute X path expression. If you pass an array in, then 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.php#get Attributes <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ge tAttributes> Cheers Nigel =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <o.t...@ab...> - 2001-10-08 18:12:00
|
Sorry, I just found out. I need to use quotes now. Thanks anyway, Oliver -----Original Message----- From: nig...@us... [mailto:nig...@us...] 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/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> How do I save an altered XML document using PHPXML? Use the exportToFile() method function exportToFile($fileName, $absoluteXPath='', $xmlHeader='<?xml version="1.0"?>') http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#exp ortToFile <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ex portToFile> How to add a node to an XML file. add_node does not seem to work. Please advise. Use the appendData() method function appendData($absoluteXPath, $value) Note that the parameter is an "absolute X Path" expression, not just any old x path expression, so it must address 1 unique node. ie "/root[1]/records[4]" not "/root/record[4]". http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#app endData <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ap pendData> How do I get attributes by the XPath function in phpxml? I want to do something like in this code: $results = $xml->evaluate("//users/user[@us_workspace=$workspace]/product[@us_prname=$p roduct]"); file://Display <file://Display> user in list $attributes = array(); foreach ($results as $users) { file://username <file://username> $attributes = $xml->get_attributes("parent::".$users); Use the getAttributes method function getAttributes($absoluteXPath, $attribute = '') Note again the absolute X path expression. If you pass an array in, then 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.php#get Attributes <http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ge tAttributes> Cheers Nigel =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <nig...@us...> - 2001-10-08 18:11:54
|
Many many thanks go to Sam Blum for not only coding most of the headline fe= atures of this release, but also for guiding me through the incredibly scar= y first steps of CVS and WinCvs. Available from: http://www.sourceforge.net/projects/phpxmldb <ExtractFromChangeLog> Phpxml version 1.N.X is technically a branch from the phpxml project avai= lable at http://www.phpxml.org/. Development seemed to be going much faster= than the new releases of phpxml were, ie 125 messages to the list in 3 wee= ks, so I took it upon myself to release 1.N.X versions in the mean time. I = am still hoping that Michael will "approve" the 1.N.X releases, and that th= ey will therefore become not a branch but 1.X releases instead. I suppose i= n some ways this is NOT a branch until a 1.1 release of phpxml comes out an= yway :o). Discussion for this module occurs on the us...@li... ma= illist. Known Bugs Outstanding: a.. Deleting elements is very slow: Removing element 9 in a list of 10 = will cause ALL node paths to be re-calculated, not just the 10th node which= needs to be. This becomes cripplingly slow as soon as your xml is of a se= nsible size.=20 Version 1.N.5 - 25th September a.. Text content is output in correct order: If you have "<P> A <B> B <= /B> C </P>" this will be output as "<P> A <B> B </B> C </P>" not "<P> A C <= B> B </B> </P>" as it used to be before this version. Our huge thanks go to= Sam Blum bs...@us... for this fix.=20 b.. 50% speed enhancements on reading and searching: The add_content fu= nction got a serious look over by Sam and has managed to make seriously vis= ible speed increases. Sam Blum bs...@us...=20 c.. New DOM style user interface The public interface was renamed to us= e DOM style function names. This should make the learning curve easier for = newcommers to the class. The old style interface is still supported, but is= unlikely to be in future releases.=20 d.. Class name change to XPath After some discussion and thought, it se= emed that XPath was a much better name than "XML"" for the class. XML doesn= 't really tell you what the class does, whereas XPath describes that it is = a class that will allow you to search using the XPath standard. ie exactly = what it is. The modification functions are kinda added 'cos the tree is alr= eady there, but principly this module is about searching using XPath and re= trieving the content.=20 e.. Filename changed to xpath.class.phpThe filename has also been chang= ed to reflect the change of name for the class=20 f.. Documentation added to the 1.N branch In the form of a perl script = that automatically produces an XML file, that is combined with an XSL to pr= oduce the documentation. This should allow you to quickly update the docume= ntation when you make your own changes.=20 g.. Stacks of style changes. Re-grouping of functions, comments change = to //, etc, etc.=20 </ExtractFromChangeLog> Cheers all 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 -- 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/ |
From: <nig...@us...> - 2001-10-08 18:10:21
|
Try $nn =3D $xml->add_node("/root[1]", "node"). "root" is not a "full" XPa= th address. "root[1]" is. The only function that would allow you to enter= "root" is evaluate(), and it returns you an array of paths. So you could do: $aArray =3D $xml->evaluate("/root"); $NewNodeFullPath =3D $add_xml->node($aArray[0], "node"); 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: se...@ww...=20 To: us...@li...=20 Sent: Thursday, September 06, 2001 3:31 AM Subject: [phpXML] add_node problem Hello all, =20=20=20 I'm trying to use PHPxml for working with XML document. Everyting works f= ine except adding the new nodes. Frankly speaking, method add_node doesn't = work. =20=20=20 It returns path for the new node, but when I'm trying to get the results = and show them or save it to file - I see NO new node that had been added. =20=20=20 Please take a look at my code: ---------------------------------------------------------------------------= --- <? // Include the <phpXML/> class. include("lib/xml.php"); =20=20=20 // Create an XML object for the XML file. $xml =3D new XML("some.xml"); =20=20=20 $nn =3D $xml->add_node("/", "node"); $fp =3D fopen("some2.xml","w+"); // characters translation $trans =3D get_html_translation_table(HTML_ENTITIES); $trans =3D array_flip($trans); $xs =3D strtr($xml->get_file(), $trans); // write fputs($fp, $xs); fclose($fp); =20=20=20 ?> ---------------------------------------------------------------------------= --- file SOME.XML: =20=20=20 <?xml version=3D"1.0" encoding=3D"UTF-8"?> <root/> ---------------------------------------------------------------------------= --- get_file methid returns original XML - simply <root/>. Note that I tried = different variations of path parameter string in add_node method. (ie "root= /", "/root", ".", "/", "/root/"... and so on) =20=20=20 When I 'm trying to get the path for the new created node I get a result = - root/node[1]. But there no new node in the xml. =20=20=20 Please, can you explain me why this happens? Or maybe I'm using add_node = not very correctly? =20=20=20 Serge. -- 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/ |
From: <fra...@vi...> - 2001-10-08 18:07:15
|
Ok, I find it out, hum had to read code, a couple of trim there and there I would like to make a greater function to support skipwhite and not skipwhite, but xml_parser_get_option can get this option value (I fill a bug report about it), good PHP! SO here my diff if you want to keep space in your cdata, note that if you patch your file you will get load_string too (look on passe post), make backup of your other one before doing it, this diff has been very low tested and it surely not supported by they maintainer!!!! Michael if you read this list, will you check to see if I don't broke anything. Thank you and cu. @@ -215,7 +215,7 @@ $parser = xml_parser_create(); // Set the options for parsing the XML data. - xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); + xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); // Set the object for the parser. @@ -246,6 +246,60 @@ $this->display_error("File %s could not be found or read.", $file); } } + + /** + * Reads a string and parses the XML data. + * + * This method reads the content of a XML string, tries to parse its + * content and upon success stores the information retrieved from + * the string into an array. + * + * @access public + * @author Francis Fillion <ffi...@in...> modified from Michael P. Mehl <mp...@ph...> + * @param string $content name of the string to be read and parsed. + * @see handle_start_element(), handle_end_element(), + * handle_character_data() + */ + function load_string ( $content ) + { + // Check whether content has been read. + if ( !empty($content) ) + { + // Create an XML parser. + $parser = xml_parser_create(); + + // Set the options for parsing the XML data. + xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + + // Set the object for the parser. + xml_set_object($parser, &$this); + + // Set the element handlers for the parser. + xml_set_element_handler($parser, "handle_start_element", + "handle_end_element"); + xml_set_character_data_handler($parser, + "handle_character_data"); + + // Parse the XML file. + if ( !xml_parse($parser, $content, true) ) + { + // Display an error message. + $this->display_error("XML error in file %s, line %d: %s", + $content, xml_get_current_line_number($parser), + xml_error_string(xml_get_error_code($parser))); + } + + // Free the parser. + xml_parser_free($parser); + } + + else + { + // Display an error message. + $this->display_error("This xml document was empty", $content); + } + } /** * Generates a XML file with the content of the current document. @@ -324,7 +378,7 @@ } // Add the attribute to the XML data. - $xml .= " ".$key."=\"".trim(stripslashes($value))."\""; + $xml .= " ".$key."=\"".stripslashes($value)."\""; // Check whether this attribute is highlighted. if ( in_array($root."/attribute::".$key, $highlight) ) @@ -917,7 +971,8 @@ $text = strtr($text, $this->entities); // Save the text. - $this->add_content($this->path, addslashes(trim($text))); + //$this->add_content($this->path, addslashes(trim($text))); + $this->add_content($this->path, addslashes($text)); } /** @@ -1114,9 +1169,9 @@ $after = substr($step, $end + 1); // Trim each string. - $before = trim($before); - $between = trim($between); - $after = trim($after); + //$before = trim($before); + //$between = trim($between); + //$after = trim($after); // Save the evaluated function. $axis["axis"] = "function"; @@ -1627,9 +1682,9 @@ $after = substr($predicate, $end + 1); // Trim each string. - $before = trim($before); - $between = trim($between); - $after = trim($after); + //$before = trim($before); + //$between = trim($between); + // $after = trim($after); // Check whether there's something after the bracket. if ( !empty($after) ) @@ -3382,4 +3437,4 @@ } } -?> \ No newline at end of file +?> fra...@vi... wrote: > > DOes somebody know why does when I put a 0 instead of 1 in the > XML_OPTION_SKIP_WHITE in the xml_parser_set_option it still skip white? > IN the xml.php file? > > xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); > > An other thing why do we need /test[1] shouldn't it be /test? For > <test>untest</test> > > -- > Francis Fillion, BAA SI > Broadcasting live from his linux box. > And the maintainer of http://www.windplanet.com > > -- > This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ -- Francis Fillion, BAA SI Broadcasting live from his linux box. And the maintainer of http://www.windplanet.com -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <o.t...@ab...> - 2001-10-08 18:05:43
|
After using setAttributes ($xml->setAttributes("/users[1]/Nodename[1]",array("atr1","atr2"));) I get the following incorrect result: <Nodename 0="atr1" 1="atr2"/> Where do the 0 and 1 come from? Oliver -----Original Message----- From: a.t...@fl... [mailto:a.t...@fl...] Sent: woensdag 26 september 2001 10:02 To: us...@li... Subject: [phpXML] Bug in setAttributes Hi, just patched phpxml 1.N.5: // OLD -------------------------------------------------- function setAttributes($absoluteXPath, $attribute) { // The attributes parameter should be an associative array. if (!is_array($attributes)) return; // Add the attributes to the node. if (isSet($this->nodes[$path]['attributes'])) { $this->nodes[$path]['attributes'] = array_merge($this->nodes[$path]['attributes'], $attributes); } else { $this->nodes[$path]['attributes'] = $attributes; } } Tell me where the $path variableis set and why the parameter $attribute is called $attributes in the function... // NEW -------------------------------------------------- function setAttributes($absoluteXPath, $attributes) { // The attributes parameter should be an associative array. if (!is_array($attributes)) return; // Add the attributes to the node. if (isSet($this->nodes[$absoluteXPath]['attributes'])) { $this->nodes[$absoluteXPath]['attributes'] = array_merge($this->nodes [$absoluteXPath]['attributes'], $attributes); } else { $this->nodes[$absoluteXPath]['attributes'] = $attributes; } } BTW, did anyone check the code before releasing it? How else could one miss those bugs like the "$this ->" thing and the setAttributes-function, that did not work at all. CU, Axel -- a.t...@fl... PS, soory for my bad english... -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <nig...@us...> - 2001-10-08 18:04:10
|
RE: [phpXML] Re: xml.php locationThe first thing you need to do is go get t= he latest version, ie 1.N.5. Available from phpxml's 1.N.X's home at http:= //www.sourceforge.net/projects/phpxmldb How do I save an altered XML document using PHPXML?=20 Use the exportToFile() method function exportToFile($fileName, $absoluteXPath=3D'', $xmlHeader=3D'<?x= ml version=3D"1.0"?>') http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ex= portToFile 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 any ol= d x path expression, so it must address 1 unique node. ie "/root[1]/record= s[4]" not "/root/record[4]". http://www.carrubbers.org/scripts/php/xmlphp/doc/PhpXmlDocumentation.php#ap= pendData 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]/pro= duct[@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, then i= t 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.php#ge= tAttributes 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 list = 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/ |
From: <o.t...@ab...> - 2001-10-08 18:02:35
|
Thanks, That fixed the problem. Can you give an example how to use addchild, because I don't get any result. Oliver -----Original Message----- From: nig...@us... [mailto:nig...@us...] Sent: woensdag 26 september 2001 0:51 To: us...@li... Subject: [phpXML] phpxml 1.N.5 "$this->" patch. Hmm, it appears that I missed out the "$this->" bit from 6 places in the code. Here's the places that you will want to fix from version 1.N.5 if you can't wait for the next release. _____ diff -r1.1 xpath.class.php 219c219 < return setAttributes($absoluteXPath, $aNewAttributes); --- > return $this->setAttributes($absoluteXPath, $aNewAttributes); 221c221 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath, $attributes); 248c248 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath, $attributes); 838c838 < return _setContent($absoluteXPath, $value); --- > return $this->_setContent($absoluteXPath, $value); 854c854 < return _setContent($absoluteXPath, $value, TRUE); --- > return $this->_setContent($absoluteXPath, $value, TRUE); 879c879 < _setContent($absoluteXPath, $newContent); --- > $this->_setContent($absoluteXPath, $newContent); _____ Oops :o/ Nigel =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <o.t...@ab...> - 2001-10-08 18:01:03
|
I think there are many more places where you forgot to add the $this-> for example in the setAttribute function. Oliver -----Original Message----- From: nig...@us... [mailto:nig...@us...] Sent: woensdag 26 september 2001 0:51 To: us...@li... Subject: [phpXML] phpxml 1.N.5 "$this->" patch. Hmm, it appears that I missed out the "$this->" bit from 6 places in the code. Here's the places that you will want to fix from version 1.N.5 if you can't wait for the next release. _____ diff -r1.1 xpath.class.php 219c219 < return setAttributes($absoluteXPath, $aNewAttributes); --- > return $this->setAttributes($absoluteXPath, $aNewAttributes); 221c221 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath, $attributes); 248c248 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath, $attributes); 838c838 < return _setContent($absoluteXPath, $value); --- > return $this->_setContent($absoluteXPath, $value); 854c854 < return _setContent($absoluteXPath, $value, TRUE); --- > return $this->_setContent($absoluteXPath, $value, TRUE); 879c879 < _setContent($absoluteXPath, $newContent); --- > $this->_setContent($absoluteXPath, $newContent); _____ Oops :o/ Nigel =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb <http://www.sourceforge.net/projects/phpxmldb> -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <Geo...@sq...> - 2001-10-08 17:59:30
|
IS ENYBODY WORKING WITH <phpXML/>. UNDER Windows NT ??????????? I am writing a php4-script using XML-files under Windows NT without using WEB-server. I was very interested by <phpXML/>.,but I can't start it with php.exe for Windows NT . PHP-interpreter gives warnings: "Undefined index " in function add_node ( $context, $name ). The function begins on line 430 in xml.php. Warnings are on lines 443, 456, 464 : 442: // Set the relative context and the position. 443: $position = ++$this->ids[$path]; ... 453: // Calculate the position for the following and preceding axis 454: // detection. 455: $this->nodes[$fullpath]["document-position"] = 456: $this->nodes[$context]["document-position"] + 1; ... 464: if ( !$this->nodes[$context]["children"][$name] ) For example on line 464 it is now: if ( !$this->nodes[$context]["children"][$name] ) It most be : if ( !isset($this->nodes[$context]["children"][$name]) ) But how must be changed the other lines ? Can you send me a revised version of xml.php compatible with php.exe for Windows NT?. Or - if it is easyer - can you pont me a Web-site to download a version of php4 for Windows NT compatible with the xml.php ? I will be happy to receive your answer. Yours Georgi Lazarov |
From: <flo...@co...> - 2001-10-08 17:57:55
|
Hi! > -----Original Message----- > From: it...@on... [mailto:it...@on...] > > they have implemented a=20 > reasonably complex > XML layout and I was wondering if your script could be=20 > tweaked to work with > it. I want to be able to run a script over the XML file and=20 > have it pull the > data out and insert the data into a MYSQL db...all in one go. >=20 Look at http://www.kzar.net/testxml.php for a working exwemple. You can insert datas in a db instead of displaying them. The script can be found at http://www.kzar.net/source.php?p=3D/testxml.php Regards, Florent Gilles. > Sent: Thursday, August 16, 2001 5:17 AM > To: us...@li... > Subject: [phpXML] XML parsing >=20 >=20 > Hi, > A part of the XML file is below. I would like to pull out=20 > every entitiy into > a db so I need to parse the file and probably include some=20 > INSERT statements > etc so that it can throw everything into a db. >=20 >=20 > ----------------------------------------------------------- > <AMROC> > <Version>1.0</Version> > <TITLES> > <CompanyCode>BBB</CompanyCode> > <TitleXref>BIGKBOST</TitleXref> > <CountryCode>AUS</CountryCode> > <Title>BIG KAHUNAS</Title> > <Artist>BOSTON BUN MUNCHERS, THE</Artist> > <GENRES> > <GenreCode>8</GenreCode> > </GENRES> > <Compilation>NO</Compilation> > <LabelCode>BLA</LabelCode> > <ProductTypeCode>A</ProductTypeCode> > <OriginalReleaseDate>28/07/1997</OriginalReleaseDate> > <PRODUCTS> > <CatalogNo>BBB</CatalogNo> > <ProductCountryCode>AUS</ProductCountryCode> > <MediaCode>21</MediaCode> > <PackageCode>49</PackageCode> > <ReleaseDate>28/07/1997</ReleaseDate> > <apn>9323190000188</apn> > <PRICES> > <PriceCode>BBB*BBB*C1808</PriceCode> > </PRICES> > <TRACKS> > <TrackXref>BUSTBOST</TrackXref> > <TrackNo>1</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>BUS TRUCKIN </TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>DESTBOST</TrackXref> > <TrackNo>2</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>DESTINY</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>ITSABOST:1</TrackXref> > <TrackNo>3</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>IT S A REAL THING</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>PRETBOST:1</TrackXref> > <TrackNo>4</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>PRETTY BOY</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>STILBOST:2</TrackXref> > <TrackNo>5</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>STILL RUNNIN</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>MOOCBOST</TrackXref> > <TrackNo>6</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>MOO COW</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>BUSTBOST:1</TrackXref> > <TrackNo>7</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>BUS TRUCKIN REHEARSAL</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>MYDRBOST</TrackXref> > <TrackNo>8</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>MY DREAM S OBSCENE</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>BOBSBOST</TrackXref> > <TrackNo>9</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>BOB S RHAPSODY NO. 1</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>TAKEBOST:1</TrackXref> > <TrackNo>10</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>TAKE THIS PILL</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>BENNBOST</TrackXref> > <TrackNo>11</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>BENNY S BACKDOOR BONANZA</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>WEREBOST:1</TrackXref> > <TrackNo>12</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>WE RE HERE FOREVER</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>BOBSBOST:1</TrackXref> > <TrackNo>13</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>BOB S REPRISE</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > <TRACKS> > <TrackXref>ATHEBOST</TrackXref> > <TrackNo>14</TrackNo> > <TrackLabelCode>BLA</TrackLabelCode> > <TrackTitle>A THEORY ON THE COLLECTIVE UNCONSCIOUS</TrackTitle> > <TrackArtist>BOSTON BUN MUNCHERS, THE</TrackArtist> > <isrc></isrc> > </TRACKS> > </PRODUCTS> > </TITLES> > </AMROC> >=20 > ---------------------------------------------------------------- >=20 >=20 > Kind Regards > Jason Savidge > IT Manager > One Stop Entertainment > Australia >=20 > -- > This message has been sent through the <phpXML/> user=20 > discussion list. To unsubscribe, please visit=20 > https://sslsites.de/mailinglisten/user/us...@li.../ >=20 -- 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/ |
From: <o.t...@ab...> - 2001-10-08 17:54:47
|
Thanks, Is there a place where I can find some good examples? I am familliar with xml, but now I need to know how to use it in phpxml. Oliver. -----Original Message----- From: se...@ww... [mailto:se...@ww...] Sent: dinsdag 18 september 2001 9:50 To: us...@li... Subject: [phpXML] Re: [phpXML] xml.php location Hello, You need to place it somewhere. And include it in every file this way: include("lib/xml.php"); // xmp.php placed in subfolder "lib" Serge. ----- Original Message ----- From: o.t...@ab... <mailto:o.t...@ab...> To: us...@li... <mailto:us...@li...> Sent: Tuesday, September 18, 2001 4:38 PM Subject: [phpXML] xml.php location Hi, Can anybody tell me how to use the xml.php file. Do I have to place it on a certain location, or do I have to include that in every file? Thanks, Oliver Talens **************************************************************** Abyss I.T. Solutions Mathildastraat 36B 4901 HC Oosterhout http://www.Abyss.nl <http://www.Abyss.nl> http://www.PanelPoint.nl <http://www.PanelPoint.nl> tel: +31 (0)162-439809 fax: +31 (0)162-439882 O.T...@Ab... **************************************************************** -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <nig...@us...> - 2001-10-08 17:53:15
|
Can anybody please help me with this? I think the removechild function doesn't work. THe XML file: =20=20=20=20=20 <snip> I have managed to fix the removeChild() function. It seemed to be in some = wierd quasi-state, but I've almost completely re-written it so not only doe= s it work now, it goes much faster than it did in the past. Previously whe= n you deleted a node, it re-wrote the entire tree, now it modifies the exis= ting tree so has to do less copy ops and takes less memory. =20 At this point I must warn that we are still lacking a DOM test harness, so = until we have that the chances of finding bugs is "higher" than is acceptab= le for production quality code, hence we are still waving the beta flag her= e. =20 I hope to release when I next get a couple of spare hours. If you can't wa= it until then, then you can get the latest version from the CVS repository,= linked from the phpxmldb site. Nigel =20 =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 -- 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/ |
From: <nig...@us...> - 2001-10-08 17:51:42
|
Ok, I have finished bouncing all the messages so far to this list to geocra= wler and there is now a searchable archive of this list dating back to the = weekend of it's creation. Sadly the search function doesn't seem to work and on the whole I am thorou= ghly unimpressed with the geocrawler website. However it works, and the me= ssages are there, so enjoy. DO NOT SEND ATTACHMENTS OVER 100KB PLEASE :o) The problem with the dropped messages was somewhat unsurprisingly due to la= rge attachments. Three messages had attachments over 100KB so could I plea= se ask (I shouldn't even need to ;o) that if you are going to send an attac= hment, that you compress it so that it is less than 100KB, or put it on an = FTP server somewhere. If you don't then it won't get archived. I have zip= ped and reposted the three large messages, luckly for you guys I work on a = mailserver and speak MIME :o) I think all the messages are there, if not forward others on to me and I'll= post them. The archived can be found either by following the list links from the phpxm= ldb project at sourceforge: http://sourceforge.net/projects/phpxmldb/ Or directly at geocrawler: http://www.geocrawler.com/lists/3/SourceForge/14600/0/ Please note that you do not need to do anything at all in order for your me= ssages to appear on this archive. It seems to re-archive the list at about 3AM GMT so there are some 20 messa= ges currently in the "queue" to be archived, so if you are wondering where = your message is, then check back the next day and it should appear there by= then. Ah! Now that that ordeal is over I can go back to developing PhpXML again := o) Nigel -- 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/ |
From: <nig...@us...> - 2001-10-08 17:50:08
|
Hmm, it appears that I missed out the "$this->" bit from 6 places in the co= de. Here's the places that you will want to fix from version 1.N.5 if you= can't wait for the next release. ---------------------------------------------------------------------------= -----diff -r1.1 xpath.class.php 219c219 < return setAttributes($absoluteXPath, $aNewAttributes); --- > return $this->setAttributes($absoluteXPath,=20 $aNewAttributes); 221c221 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath,=20 $attributes); 248c248 < return setAttributes($absoluteXPath, $attributes); --- > return $this->setAttributes($absoluteXPath,=20 $attributes); 838c838 < return _setContent($absoluteXPath, $value); --- > return $this->_setContent($absoluteXPath, $value); 854c854 < return _setContent($absoluteXPath, $value, TRUE); --- > return $this->_setContent($absoluteXPath, $value,=20 TRUE); 879c879 < _setContent($absoluteXPath, $newContent); --- > $this->_setContent($absoluteXPath, $newContent);-------------------------= ------------------------------------------------------- Oops :o/ 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 -- 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/ |
From: <se...@ww...> - 2001-10-08 17:48:35
|
Hello all, I'm trying to use PHPxml for working with XML document. Everyting works fin= e except adding the new nodes. Frankly speaking, method add_node doesn't wo= rk. It returns path for the new node, but when I'm trying to get the results an= d show them or save it to file - I see NO new node that had been added. Please take a look at my code: ---------------------------------------------------------------------------= ----- <? // Include the <phpXML/> class. include("lib/xml.php"); // Create an XML object for the XML file. $xml =3D new XML("some.xml"); $nn =3D $xml->add_node("/", "node"); $fp =3D fopen("some2.xml","w+"); // characters translation $trans =3D get_html_translation_table(HTML_ENTITIES); $trans =3D array_flip($trans); $xs =3D strtr($xml->get_file(), $trans); // write fputs($fp, $xs); fclose($fp); ?> ---------------------------------------------------------------------------= ----- file SOME.XML: <?xml version=3D"1.0" encoding=3D"UTF-8"?> <root/> ---------------------------------------------------------------------------= ----- get_file methid returns original XML - simply <root/>. Note that I tried di= fferent variations of path parameter string in add_node method. (ie "root/"= , "/root", ".", "/", "/root/"... and so on) When I 'm trying to get the path for the new created node I get a result - = root/node[1]. But there no new node in the xml. Please, can you explain me why this happens? Or maybe I'm using add_node no= t very correctly? Serge. -- 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/ |
From: <lu...@sa...> - 2001-10-08 17:48:09
|
Hello, I've some problems with xpath.class.php use and the new system The following piece of code works perfectly with xml.php 1N4 but no more with xpath.class.php xpath.class.php version is at : http://www.interpasnet.com/xmlprocess.xpath.php?screen=cachecache§ion=cachecache&file=cachecache.xml&id=1 xml.php 1N4 version is at http://www.interpasnet.com/xmlprocess.php?screen=cachecache§ion=cachecache&file=cachecache.xml&id=1 Error is : phpXML error: While parsing an XPath expression there was an error in the predicate "1", because it was the null string. If you wish to seach for the empty string, you must use ''. What am I supposed to change ? Luc ================== BEGIN ============================ $xml_file = 'xml_files/'.$section.'/'.$file; if ($file =="cachecache.xml"){ $xml_data = $tpl->fetch('../'.$xml_file); $xml = new XPath(); $xml->load_string ($xml_data); } else { $xml = new XPath($xml_file); } $array_article_entete= array(); $array_article_corps= array(); $array_article_listing = array(); $t = array(); $articles = $xml->evaluate('/article'); foreach ( $articles as $article ) { $category = $xml->get_content($article.'/category[1]'); $version = $xml->get_content($article.'/version[1]'); $source_url = $xml->get_content($article.'/source[1]/url[1]'); $source_livre = $xml->get_content($article.'/source[1]/livre[1]'); $source_commentaire = $xml->get_content($article.'/source[1]/commentaire[1]'); $copyright = $xml->get_content($article.'/copyright[1]'); $author_name = $xml->get_content($article.'/author[1]/name[1]'); $author_adress_name = $xml->get_content($article.'/author[1]/adress[1]/name[1]'); $author_adress_phone= $xml->get_content($article.'/author[1]/adress[1]/phone[1]'); $author_email = $xml->get_content($article.'/author[1]/email[1]'); $title = $xml->get_content($article.'/title[1]'); $abstract = $xml->get_content($article.'/abstract[1]'); array_push ($array_article_entete, array( 'category' =>$category, 'version' =>$version, 'source_url' =>$source_url, 'source_livre' =>$source_livre, 'source_commentaire'=>$source_commentaire, 'copyright' =>$copyright, 'author_name' =>$author_name, 'author_adress_name' =>$author_adress_name, 'author_adress_phone' =>$author_adress_phone, 'author_email' =>$author_email, 'article_title' =>$title, 'abstract' =>$abstract ) ); } if ( !empty($id) ) { $blocs = $xml->evaluate('//paragraph[@id='.$id.']'); } else { $blocs = $xml->evaluate('/article/paragraph'); } foreach ( $blocs as $bloc ) { $t = $xml->get_attributes( $bloc); $id = $t['id']; $title = $xml->get_content($bloc.'/title[1]'); $chapo = $xml->get_content($bloc.'/chapo[1]'); $text = $xml->get_content($bloc.'/text[1]'); array_push($array_article_corps, array('paragraph_id'=>$id, 'paragraph_title'=>$title, 'paragraph_chapo'=>$chapo, 'paragraph_text'=>$text ) ); } $blocs = $xml->evaluate('/article/paragraph'); foreach ( $blocs as $bloc ) { $t = $xml->get_attributes( $bloc); $id = $t['id']; $title = $xml->get_content($bloc.'/title[1]'); array_push($array_article_listing, array('paragraph_id'=>$id, 'paragraph_title'=>$title ) ); } ====================== END =========================== -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <o.t...@ab...> - 2001-10-08 17:44:55
|
Sam, For example, I want to sort on pr_name. (And when I insert a new product, I want this new node to be inserted in the correct order) Oliver Talens <products> <product pr_name="RIM Weighting" pr_workspace="RI" pr_root="/RI" /> <product pr_name="Peter Jonker" pr_workspace="SPSS" pr_root="/SPSS" /> <product pr_name="ATA" pr_workspace="RI" pr_root="/RI" /> <product pr_name="EZ graphmaker" pr_workspace="RI" pr_root="/RI" /> <product pr_name="Robeco" pr_workspace="RI" pr_root="/RI" /> </products> -----Original Message----- From: bs...@us... [mailto:bs...@us...] Sent: maandag 1 oktober 2001 9:23 To: us...@li... Subject: [phpXML] Re: [phpXML] RE: [phpXML] Bug in setAttributes >How do I sort in phpxml on a certain attribute? >Oliver Talens ?? be more specific. give an sample. -- Sam Blum <bs...@us...> =========================== For the most recent version of phpxml, V1.N.X, and an archive of this list visit: http://www.sourceforge.net/projects/phpxmldb -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <die...@ga...> - 2001-10-08 17:43:23
|
part of the problem is that the entities array is in the wrong order (as of the last version i downloaded). here are the entity de/encoding functions i am currently using. i also have added a class level boolean called 'encode', which i use to toggle whether i want phpxml to auto-encode or not. function encode_entities($text) { if($this->encode){ return htmlspecialchars($text); } return $text; } function decode_entities($text){ if($this->encode){ return strtr($text,array_flip($this->entities)); } return $text; } > -----Original Message----- > From: lu...@sa... [mailto:lu...@sa...] > Sent: Tuesday, July 24, 2001 12:24 AM > To: us...@li... > Subject: [phpXML] Re: Entities > > > Liz, > > I just tried, this doesn't work for me. I get good results only if this > array is empty... > > Luc > > At 06:24 24/07/01 +0000, you wrote: > > >Thankz Luc, > > > >I checked the lines that you pointed me to and I thought I'd let you know > >what I discovered: > > > >When reading though the file I thought !!! "wait a sec! HTML4.0 doesn't > >specify an entity encoding for the apostrophe." > > > >I did some research. And sure enough, it is not an HTML entity. > The simple ' > >character is good enough. Also, the " for " is not truly needed in > >HTML. > > > >By the way, in my file the semi-colon was missing in the ' entity > >conversion array. > > > >The browser still couldn't handle the ' with the ; inserted, so I > >adjusted the xml.php file to the ISO Latin set since I am not > sure if this > >conversion will be needed in another script that I write. > > > >122 /** > >123 * var $entities = array ( "&" => "&", "<" => "<", ">" => > >">", > >124 * "'" => "&apos", '"' => """ ); > >125 */ > >126 var $entities = array ( "&" => "&", "<" => "<", ">" => > >">", > >128 "'" => "'", '"' => """ ); > > > >Now the CDATA Sections seems to render fine in IE5+. :-) > > > >I wonder why the ISO Latin codes were not used in xmlphp. > Especially since > >ISO 8859/1 is the 8-bit single-byte coded graphic character set. > > > >Thankz again :-) > > > >Liz Bostetter > > > > > >-----Original Message----- > >From: lu...@sa... [mailto:lu...@sa...] > >Sent: Tuesday, July 24, 2001 12:12 AM > >To: us...@li... > >Subject: [phpXML] Re: phpxml Version 1.N.4 > > > > > >Liz, > > > >I use phpxml for the same reason. > > > >In order to have a correct output I had to empty the array entities (near > >line 123 > >var $entities = array ( ); > > > >Luc > > > >At 03:09 24/07/01 +0000, you wrote: > > >HI > > > > > >I am using xmlphp on a site that retreives an XML file from > another server. > > >The XML file contains > > >CDATA Sections. > > >When I try to display the contents of the XML file in a table > in HTML to a > > >browser all the apostrophe characters within the CDATA Section > are being > > >rendered as &apos as in (Picket's) (Picket&aposs). (I haven't > checked to > >see > > >if other General Entity type characters do this also.) > > >The results page's source code shows (Picket&aposs)..... missing > >semi-colon? > > > > > >In the original XML file, the character is typed as a ' and not as the > > >entity '. > > > > > >Any ideas out there of what is going on and how I could > correct the HTML > > >display? > > > > > >Thankz for any adive you can give. :-) > > > > > >Liz > > > -- > This message has been sent through the <phpXML/> user discussion > list. To unsubscribe, please visit > https://sslsites.de/mailinglisten/user/us...@li.../ > -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |
From: <tom...@di...> - 2001-10-08 17:42:59
|
I was initially thrown off by the 'trivialness' of the example but when I look at how you intend to process the file it seems to cry out for a different structure altogether. Is it not true that _if_ there are children _then_ the children should stand as elements of the parent? ((then the other 'content' is/are really attributes of the parent)) That would say to me that the example being discussed could (should?) better be constructed like <blah1 precursor="Text" postcursor="text."> <blah2>more</blah2> </blah> Wouldn't that be more parallel to the processing that you intend to do to the file? my 2cents Tom At 08:10 PM 7/4/01 +0000, ph...@pe... wrote: >absolutely right, Nigel. The problem has nothing to do with CDATA - call it >embedded structure, where the child(ren) is in the middle of the parent. Try >the following: ><text>There are 2 categories: ><category>1</category> ><category>2 which has <sub>a subcategory</sub> as well</category> >which have to be taken into account.</text> >etc etc. >The parser adds an extra element to the array for each segment of a node, but >phpxml's load_file ignores this and just adds the content to the node without >any indication that there was a child in that position. Consequently, it >loses information. (it also compounds the error by stripping the spaces >around the tags, so "<text>The spacing is <e>very</e> important.</text>" >comes out as "The spacingisimportant." :-) > >afaics, the only solution is to add an extra array to correspond to each >segment, so my example above would be stored as text[0] e[0] text[1]. It gets >pretty hairy though trying to put it back together again, as there is no >limit to the number or levels of the array. I gave up trying to use php's >parse_into_struct because my poor brain couldn't cope with navigating all the >arrays! > > >On Wednesday 04 July 2001 13:20, you wrote: > > > > I'm not sure that this actually solves the stated problem though as I think > > I am right in saying that this is a fix that goes into get_file(). > > Therefore if the datastructure can't describe "Before<tag>Middle</tag>End", > > then it's not going to be able to print it. > > > > This fix will cope with usage of the object that make calls to > > set_content("address","Some text <B>that</B> contains some markup."). But > > if the xml file that you read in already has "Some text <B>that</B> > > contains some markup." then the class is going to loose this structure in > > the parse. > > > > Basically phpxml's internal datastructure is lossy. You can't read to > > object and write back out to file and have two logically identical files. > > Ideally it ought to be. > > > > We need a more complete fix for this in the constructor or load_from_file > > function I think.... > > > > Nigel > > > > > How can I get around phpXML's tendency to place tags inside regular text > > > after the tag containing the text. > > > i.e., > > > <blah1> > > > Text<blah2>more</blah2>text. > > > </blah> > > > Comes out > > > > > > Text text.more > > > > -- > > This message has been sent through the <phpXML/> user discussion list. To > > unsubscribe, please visit > > https://sslsites.de/mailinglisten/user/us...@li.../ > >-- >This message has been sent through the <phpXML/> user discussion list. To >unsubscribe, please visit >https://sslsites.de/mailinglisten/user/us...@li.../ -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |