phpxpath-users Mailing List for Php.XPath (Page 4)
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: Nigel S. <nig...@us...> - 2003-03-08 21:42:45
|
Because you are using the XML_OPTION_CASE_FOLDING option, you need to = do: $fdata =3D &$xPath->getNode('/LIBRARY[1]/BOOK[1]'); Sorry for the confusion. Cheers Nigel =20 ----- Original Message -----=20 From: Ji Tao=20 To: Nigel Swinson=20 Cc: php...@li...=20 Sent: Saturday, March 08, 2003 5:35 PM Subject: Re: New use need your help Hi Nigel, Thanks for your reply. I tried what you said '/library[1]/book[1]', = but it still return nothing. Can you try to run this small sample? It must be something else. but I don't know. |
From: Ji T. <ji...@to...> - 2003-03-08 17:36:27
|
SGkgTmlnZWwsDQpUaGFua3MgZm9yIHlvdXIgcmVwbHkuIEkgdHJpZWQgd2hhdCB5b3Ugc2FpZCAn L2xpYnJhcnlbMV0vYm9va1sxXScsIGJ1dCBpdCBzdGlsbCByZXR1cm4gbm90aGluZy4NCkNhbiB5 b3UgdHJ5IHRvIHJ1biB0aGlzIHNtYWxsIHNhbXBsZT8NCkl0IG11c3QgYmUgc29tZXRoaW5nIGVs c2UuIGJ1dCBJIGRvbid0IGtub3cuDQoNClRoYW5rcywNCkppIFRhbw0KICAtLS0tLSBPcmlnaW5h bCBNZXNzYWdlIC0tLS0tIA0KICBGcm9tOiBOaWdlbCBTd2luc29uIA0KICBUbzogSmkgVGFvIA0K ICBDYzogcGhweHBhdGgtdXNlcnNAbGlzdHMuc291cmNlZm9yZ2UubmV0IA0KICBTZW50OiBTdW5k YXksIE1hcmNoIDA5LCAyMDAzIDE6MDIgQU0NCiAgU3ViamVjdDogUmU6IE5ldyB1c2UgbmVlZCB5 b3VyIGhlbHANCg0KDQogICAgVGhlIGRvY3VtZW50IHNhaWQgaXQgbmVlZHMgYW4gYWJzb2x1dGUg WFBhdGggYW5kIHRoZSBkZWZhdWx0IHBhcmFtZXRlciBpcyB0aGUgJ3N1cGVyLXJvb3QnLCANCg0K ICAgIElzbid0ICIvbGlicmFyeS9ib29rWzFdIiBhIGFib2x1dGUgWHBhdGg/DQoNCiAgTm9wZSBz b3JyeSwgaXQncyBjbG9zZSwgYnV0IHlvdSBuZWVkIHRvIHVzZToNCg0KICAiL2xpYnJhcnlbMV0v Ym9va1sxXSINCg0KICBFdmVuIHRob3VnaCB0aGVyZSBjYW4gYmUgb25seSBvbmUgcm9vdCBub2Rl LCB0aGUgWzFdIGlzIG5lZWRlZC4NCg0KICBDaGVlcnMNCg0KICBOaWdlbA== |
From: Nigel S. <nig...@us...> - 2003-03-08 17:01:21
|
The document said it needs an absolute XPath and the default parameter = is the 'super-root',=20 Isn't "/library/book[1]" a abolute Xpath? Nope sorry, it's close, but you need to use: "/library[1]/book[1]" Even though there can be only one root node, the [1] is needed. Cheers Nigel |
From: Ji T. <ji...@to...> - 2003-03-08 16:54:35
|
SGVsbG8sDQpJIGp1c3Qgc3RhcnQgdHJ5aW5nIHRoZSB4cGF0aCAzLjMgYnV0IGdvdCBhIHJlYWwg cHJvYmxlbS4NCg0KSSBoYXZlIGEgc2ltcGxlIHRlc3RpbmcgeG1sIG5hbWVkICdsaWIueG1sJw0K PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PQ0KPD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8bGlicmFyeT4NCiA8Ym9vaz4N CiAgPHRpdGxlPkhhbm5pYmFsPC90aXRsZT4NCiAgPGF1dGhvcj5UaG9tYXMgSGFycmlzPC9hdXRo b3I+DQogIDxnZW5yZT5TdXNwZW5zZTwvZ2VucmU+DQogIDxwYWdlcz41NjQ8L3BhZ2VzPg0KICA8 cHJpY2U+OC45OTwvcHJpY2U+DQogIDxyYXRpbmc+NDwvcmF0aW5nPg0KIDwvYm9vaz4NCiA8Ym9v az4NCiAgPHRpdGxlPlJ1bjwvdGl0bGU+DQogIDxhdXRob3I+RG91Z2xhcyBFLiBXaW50ZXI8L2F1 dGhvcj4NCiAgPGdlbnJlPlRocmlsbGVyPC9nZW5yZT4NCiAgPHBhZ2VzPjM5MDwvcGFnZXM+DQog IDxwcmljZT43LjQ5PC9wcmljZT4NCiAgPHJhdGluZz41PC9yYXRpbmc+DQogPC9ib29rPg0KPC9s aWJyYXJ5Pg0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT0NCg0KSSB3YW50IHRvIGtub3cgd2hhdCBhIE5vZGUgcmVh bGx5IGxvb2sgbGlrZSBzbyBJIHdyaXRlIHRoaXMgY29kZSB3aXRoIHBocA0KYW5kIHRyeSB0byB1 c2UgZ2V0Tm9kZSgpIG1ldGhvZC4NCg0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NCjw/cGhwDQogICAgaW5jbHVk ZSAoJ1hwYXRoLmNsYXNzLnBocCcpOw0KICAgICR4bWxPcHRpb25zID0gYXJyYXkoWE1MX09QVElP Tl9DQVNFX0ZPTERJTkcgPT4gVFJVRSwgWE1MX09QVElPTl9TS0lQX1dISVRFID0+IFRSVUUpOw0K ICAgICR4UGF0aCA9JiBuZXcgWFBhdGgoRkFMU0UsICR4bWxPcHRpb25zKTsNCiAgICANCiAgICAk ZnAgPSBmb3BlbignbGliLnhtbCcsJ3InKTsNCiAgICAkeG1sU291cmNlID0gZnJlYWQoJGZwLDQw OTYpOw0KICAgIGZjbG9zZSgkZnApOw0KICAgIA0KICAgIGlmICghJHhQYXRoLT5pbXBvcnRGcm9t U3RyaW5nKCR4bWxTb3VyY2UpKSB7IGVjaG8gJHhQYXRoLT5nZXRMYXN0RXJyb3IoKTsgZXhpdDsg fQ0KICAgIA0KICAgIC8vbm93IGxldCdzIHRyeSB0byBnZXQgYSBub2RlDQogICAgJGZkYXRhPSYk eFBhdGgtPmdldE5vZGUoJy9saWJyYXJ5L2Jvb2tbMV0nKTsNCiAgICBpZighZW1wdHkoJGZkYXRh KSkgDQogICAgew0KICAgICAgZWNobyAnPHByZT4nOw0KICAgICAgcHJpbnRfcigkZmRhdGEpOw0K ICAgIH0NCiAgICBlbHNlDQogICAgew0KICAgICAgICBlY2hvICdObyBkYXRhJzsNCiAgICAgfQ0K DQo/Pg0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09DQpJdCBhbHdheXMgcHJpbnQgb3V0ICdObyBkYXRhJy4NCg0K dGhlbiBJIHRyeSB0byBjYWxsIHRoaXMgbWV0aG9kIHdpdGggZGVmYXVsdCBwYXJhbWV0ZXINCg0K JGZkYXRhPSYkeFBhdGgtPmdldE5vZGUoKTsNCkl0IG5vdyBwcmludHMgYSBsYXJnZSBhcnJheSBp bmNsdWRlIGV2ZXJ5IGVsZW1lbnQgb2YgdGhlIHhtbCBmaWxlLg0KDQoNClRoZSBkb2N1bWVudCBz YWlkIGl0IG5lZWRzIGFuIGFic29sdXRlIFhQYXRoIGFuZCB0aGUgZGVmYXVsdCBwYXJhbWV0ZXIg aXMgdGhlICdzdXBlci1yb290JywgDQoNCklzbid0ICIvbGlicmFyeS9ib29rWzFdIiBhIGFib2x1 dGUgWHBhdGg/DQoNCldoYXQgc2hvdWxkIGJlIHRoZSBhYm9sdXRlIHhwYXRoIGlmIEkgd2FudCB0 byBnZXQgdGhlIGZpcnN0IGJvb2sgbm9kZT8NCg0KUmVhbGx5IGNvbmZ1c2VkIGFuZCBuZWVkIHlv dXIgaGVscC4NCg0KVGhhbmtzLA0KSmkgVGFvDQoNCg== |
From: Dan A. <da...@mo...> - 2003-02-21 20:48:27
|
> Hi Joseph. > > Sorry it took so long to reply, I moved house this last month, my PDA died, > my desktop died, and my hard drive was dying, so I'm still finding my > feet... > > Sorry, no there is no easy way to do this. The exportAsXml() wants a node, > and returns both start and end tags. A regular expression should do the > trick though, something like: > > $XmlResult2 = preg_replace("/^[^>]*>(.*)<[^<]*$/", "\\1", $XmlResult); No, I am not dead, just damn busy. Anyway, I had to interject. It would be must better to use a backreference here in the regexp. $XmlResult2 = preg_replace('/<(mytag).*?>(.*?)<\/\1>/', '\2', $XmlResult); Dan -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Allen, <da...@mo...> http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Chaos reigns within. Reflect, repent, and reboot. Order shall return. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
From: Nigel S. <nig...@us...> - 2003-02-21 00:52:12
|
Hi Joseph. Sorry it took so long to reply, I moved house this last month, my PDA died, my desktop died, and my hard drive was dying, so I'm still finding my feet... Sorry, no there is no easy way to do this. The exportAsXml() wants a node, and returns both start and end tags. A regular expression should do the trick though, something like: $XmlResult2 = preg_replace("/^[^>]*>(.*)<[^<]*$/", "\\1", $XmlResult); Cheers Nigel ========================================== See full example below: <? require_once '../XPath.class.php'; $xPath = new XPath(); $rootPath = $xPath->importFromFile('Junk.xml'); // Output what we start with. echo "<pre>"; echo htmlspecialchars($xPath->exportAsXml()); echo "</pre>"; echo "<hr>"; // Seems to find only one node. $aResults = $xPath->match("//content_dictionary/content_item"); print_r($aResults); echo "<hr>"; // Seems to find only one node. $XmlResult = $xPath->exportAsXml($aResults[0]); print_r(htmlspecialchars($XmlResult)); echo "<hr>"; $XmlResult2 = preg_replace("/^[^>]*>(.*)<[^<]*$/", "\\1", $XmlResult); print_r(htmlspecialchars($XmlResult2)); echo "<hr>"; // And output just for clarity echo "<pre>"; echo htmlspecialchars($xPath->exportAsXml()); echo "</pre>"; ?> |
From: Joseph M. F. <jos...@co...> - 2003-02-05 19:26:25
|
Hello all. I have, what I hope to be, a simple question. What I am doing is extracting XHTML fragments from an XML document. For (a very quick) example: <?xml version="1.0"?> <content_dictionary> <content_item>This is a <b>content</b> test <hr/></content_item> </content_dictionary> If I evaluate the XPath expression of "//content_dictionary/content_item", I recieve the following with an exportAsXML(): <content_item>This is a <b>content</b> test <hr/></content_item> Is there any way that I can obtain the following without having to manually remove the <content_item/>? This is a <b>content</b> test <hr/> Any help would be greatly appreciated. Thank you. --Joseph |
From: Nigel S. <nig...@us...> - 2003-01-29 00:41:10
|
Attached are a couple of sources that show how to do this using the replaceChild() method. The line of interest is: // When you pass in a valid XML "string", it is parsed into a "node" // and inserted into the tree $xPath->replaceChild($aResults[0], "<a>something<b/> something else</a>"); You might also want to check out the replaceData() and replaceChildByData() Cheers Nigel =========================== For the most recent version of Php.XPath, and an archive of this list visit: http://www.sourceforge.net/projects/phpxpath |
From: James H. <ja...@oc...> - 2003-01-28 23:15:04
|
Eric, One thing that I have noticed with phpxpath is there is not any real=20 shortcuts, you have to read up on everything. Basically what you would=20= have to do is something like, <? if ($editnode=3D=3D1){ $newpath=3D$_GET["newpath"]; #what you passed from your form, in this case, telling you what node=20 you are dealing with ?> Now if you want to strip all your children and recreate new ones you can <? $xpath->removeChild($newpath); #this would remove BBB all together, then #you have to get your original node back, so you can $array=3Dsplit($newpath, "/");#check before you use, this might be some=20= incorrect split usage $newpath=3D"/".$array[1]; #which should give something like /aaa $newpath=3D$xpath->appendChild($newpath, $array[2], 0);#which should=20 create bbb again $xpath->setAttribute($newpath, "FOO", "bar", 0); } ?> This should get you started, if you have anymore problems, let me know.=20= So far I have written a firewall interface with xpath, that modifies=20= an xml file that will automatically update the firewall on the fly. If=20= you need additional help, it would help to know what type of results=20 you are trying to achieve, on what type of application. --James On Tuesday, Jan 28, 2003, at 16:31 America/New_York, Eric Wallet wrote: > Hello, > > I want to replace the content of a node and its childs node with a new=20= > xml content. > > For example : > <?Process_Instruction test=3D"=A9=A0All right reserved" ?> > <AAA FOO=3D"bar"> =A0=A0=A0=A0,,1,, ..1.. <![CDATA[ bla bla newLine = blo blo ]]>=20 > =A0=A0=A0 > <BB>Step 1. Insert new node</BB> =A0=A0=A0 > <BBB FOO=3D"bar"> =A0=A0=A0=A0=A0=A0=A0 > <CCC>Step 1. Append new node</CCC> =A0=A0=A0=A0=A0=A0=A0=A0..2.. = =A0=A0=A0=A0=A0=A0=A0 > <CCC>Step 2. Append new node</CCC> =A0=A0=A0=A0=A0=A0=A0 > <CCC>Step 3. Append new node</CCC> =A0=A0=A0 > </BBB> =A0=A0=A0=A0"Some new text"..3.. =A0=A0=A0 > <DDD>Replaced last BB</DDD> =A0=A0=A0 > <CC/> =A0=A0=A0=A0..4.. > </AAA> > > I would replace /AAA/BBB[@FOO=3D'bar'] by xml content .. > How can i do ? > > ReplaceData method just insert datas but doesn't replace subchilds... > please help me > Thanks > Eric > _____________________________________________________________________=20= > Envie de discuter en "live" avec vos amis ? T=C8l=C8charger MSN = Messenger=20 > http://www.ifrance.com/_reloc/m la 1=CBre messagerie instantan=C8e de=20= > France ------------------------------------------------------- This=20 > SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM +=20= > LinuxWorld =3D Something 2 See! http://www.vasoftware.com=20 > _______________________________________________ Phpxpath-users mailing=20= > list Php...@li...=20 > https://lists.sourceforge.net/lists/listinfo/phpxpath-users=20= |
From: Eric W. <er...@if...> - 2003-01-28 21:31:54
|
Hello,<br> <br> I want to replace the content of a node and its childs node with a new xml content.<br> <br> For example :<br> <?Process_Instruction test="© All right reserved" ?> <br> <AAA FOO="bar"> ,,1,, ..1.. <![CDATA[ bla bla newLine blo blo ]]> <br> <BB>Step 1. Insert new node</BB> <br> <BBB FOO="bar"> <br> <CCC>Step 1. Append new node</CCC> ..2.. <br> <CCC>Step 2. Append new node</CCC> <br> <CCC>Step 3. Append new node</CCC> <br> </BBB> "Some new text"..3.. <br> <DDD>Replaced last BB</DDD> <br> <CC/> ..4.. <br> </AAA><br> <br> I would replace /AAA/BBB[@FOO='bar'] by xml content ..<br> How can i do ?<br> <br> ReplaceData method just insert datas but doesn't replace subchilds...<br> please help me<br> Thanks<br> Eric<br> _____________________________________________________________________ Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France |
From: Ben Sth. <ben...@or...> - 2002-10-11 12:13:27
|
>> just wondering wether this is a serious warning/error or not worth >> mentioning: >> >> Warning: Call-time pass-by-reference has been deprecated - argument passed >> by value; If you would like to pass it by reference, modify the > declaration >> of method_exists(). If you would like to enable call-time > pass-by-reference, >> you can set allow_call_time_pass_reference to true in your INI file. >> However, future versions may not support this any longer. in >> xxx/xpath/xpath.class.php on line 3156 >> >> I get this error when including the xpath class. I once read about >> performance reasons why to use this pass-by-reference thing. but in fact I >> do not know a lot about it... > > I personally never really got a good handle on this issue, but I don't think > it is serious. I think there was a change in philosophy at php.net and they > planned to remove call-time-pass-by-reference, but then brought it back in > again in later versions. > > What version of PHP are you using, and what version of Php.XPath are you > using? I'm using 4.1.1 (Win32) and have allow_call_time_pass_reference set > to on. And my production server is 4.2.3 (Linux) and also has > allow_call_time_pass_reference set to on. > > Hope this is of some help, and if were lucky someone else on the list will > clarify for the both of us... :o) > > Nigel > already more I needed to know ;-) we use phpxpath 3.3, php4.1.2 on linux. call-time-pass-by-reference is on via htaccess since this morning, and everything works very ok... thanks ben |
From: Nigel S. <nig...@us...> - 2002-10-10 12:31:01
|
> just wondering wether this is a serious warning/error or not worth > mentioning: > > Warning: Call-time pass-by-reference has been deprecated - argument passed > by value; If you would like to pass it by reference, modify the declaration > of method_exists(). If you would like to enable call-time pass-by-reference, > you can set allow_call_time_pass_reference to true in your INI file. > However, future versions may not support this any longer. in > xxx/xpath/xpath.class.php on line 3156 > > I get this error when including the xpath class. I once read about > performance reasons why to use this pass-by-reference thing. but in fact I > do not know a lot about it... I personally never really got a good handle on this issue, but I don't think it is serious. I think there was a change in philosophy at php.net and they planned to remove call-time-pass-by-reference, but then brought it back in again in later versions. What version of PHP are you using, and what version of Php.XPath are you using? I'm using 4.1.1 (Win32) and have allow_call_time_pass_reference set to on. And my production server is 4.2.3 (Linux) and also has allow_call_time_pass_reference set to on. Hope this is of some help, and if were lucky someone else on the list will clarify for the both of us... :o) Nigel |
From: Ben Sth. <ben...@or...> - 2002-10-10 09:38:24
|
hi list just wondering wether this is a serious warning/error or not worth mentioning: Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of method_exists(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in xxx/xpath/xpath.class.php on line 3156 I get this error when including the xpath class. I once read about performance reasons why to use this pass-by-reference thing. but in fact I do not know a lot about it... cheers ben |
From: Nigel S. <nig...@us...> - 2002-10-07 00:15:15
|
Release notes: https://sourceforge.net/project/shownotes.php?group_id=36731&release_id=1148 85 Project home page: http://sourceforge.net/projects/phpxpath 10 bug fixes that have been reported since 3.2. Unless you happened to be hit by one of them, then it's probably not worth upgrading, but have a quick gander at the list just to check. This release was largely done to facilitate a version 1.0 release of the http://sourceforge.net/projects/phpxmldb project, which some of you may find interesting if you want to host data without paying for SQL... As always, any bug reports are gratefully appreciated, and if you don't report it, then there's a very high chance that it'll never get fixed :o) Cheers Nigel =========================== For the most recent version of Php.XPath, and an archive of this list visit: http://www.sourceforge.net/projects/phpxpath |
From: Bernardo J. <ra...@ro...> - 2002-09-03 15:09:08
|
__________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com |
From: Nigel S. <nig...@us...> - 2002-08-30 12:08:25
|
Have a play with this: http://www.carrubbers.org/scripts/php/xpath/doc/#setSkipWhiteSpaces The problem with skipping whitespaces is that it slows performance down a bit. So it partly depends on how big your xml file is as to if this is a good idea. It's possible that once upon a time if you were not skipping whitespaces, that we guessed some suitable whitespace, which would make it look pretty. Based on the indent level etc. But this got dropped with the V3 internal restructure. Perhaps we should put it back in... Hmmmm Nigel =========================== For the most recent version of Php.XPath, and an archive of this list visit: http://www.sourceforge.net/projects/phpxpath ----- Original Message ----- From: "James Hughbanks" <ja...@oc...> To: <php...@li...> Sent: Thursday, August 29, 2002 5:26 AM Subject: New topic, Creating nodes and the strange formatting of you xml > Greetings Nigel, all, > > I have completed my project with the exception of getting the creation > of nodes to format correctly in my xml file. > > Right now if I do a > $xpath->insertChild(_GET["newpath"], $newnode); > > The child is created, but it is right next to the other node. I mean > <newnode /><oldnode> > content > </oldnode> > > Is there a way to format this better? > > --James > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Jabber - The world's fastest growing > real-time communications platform! Don't just IM. Build it in! > http://www.jabber.com/osdn/xim > _______________________________________________ > Phpxpath-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpxpath-users > |
From: James H. <ja...@oc...> - 2002-08-29 04:27:02
|
Greetings Nigel, all, I have completed my project with the exception of getting the creation of nodes to format correctly in my xml file. Right now if I do a $xpath->insertChild(_GET["newpath"], $newnode); The child is created, but it is right next to the other node. I mean <newnode /><oldnode> content </oldnode> Is there a way to format this better? --James |
From: Nigel S. <nig...@us...> - 2002-08-28 23:29:13
|
> I am having slight problems with retrieving attributes. For example: > > if I do something like > $nodenames = $xpath->nodeName("$mypath/*") > while ($nodename = arrayshift($nodenames)){ > echo "This is my node".$nodename; > echo "<br>This is it > attributes".$xpath->getAttributes("$mypath/$nodename"); > } > > Now this works if the nodes are unique in name, but if they have the > same name, I get only the first attribute, but I do get every instance > of the nodes, just the wrong attribute. > > Thanks for any suggestions in advance. Your code looks fine, apart from the fact that you are trying to print an array. Might be better to do: echo "<br>This is it attributes"; print_r($xpath->getAttributes("$mypath/$nodename")); If it really does'nt seem like it is doing what you think it should, could you attach a short xml file and php file, and tell us what you expect the output to be and what the output is? That way we can quickly reproduce your issue and analyse/fix it. Also it would be helpful if you could tell us what version of the class you are using (or what CVS version if you have been using a version straight from CVS). Thanks Nigel |
From: James H. <ja...@oc...> - 2002-08-27 22:44:21
|
Greetings, I am having slight problems with retrieving attributes. For example: if I do something like $nodenames = $xpath->nodeName("$mypath/*") while ($nodename = arrayshift($nodenames)){ echo "This is my node".$nodename; echo "<br>This is it attributes".$xpath->getAttributes("$mypath/$nodename"); } Now this works if the nodes are unique in name, but if they have the same name, I get only the first attribute, but I do get every instance of the nodes, just the wrong attribute. Thanks for any suggestions in advance. --James |
From: Daniel L. <inf...@aj...> - 2002-08-14 07:28:11
|
Bonjour Daniel, Le mercredi 14 ao=FBt 2002 =E0 09:19:42, vous =E9criviez : DL> I have to do this : DL> exportAsXml( '', 'version=3D"1.0" encoding=3D"iso-8859-1" standalon= e=3D"no"'); DL> to obtain <?xml version=3D"1.0" encoding=3D"iso-8859-1" standalone=3D= "no"?> DL> but the <?xml and ?< are not output ? I respond to myself... it is of our responsability to give <?xml and ?> in the string ;-) --=20 Cordialement, Daniel mailto:inf...@aj... ---------- Support-Assistance PHP/MySql de =ABInternet Pour Tous=BB=20 http://www.i-p-t.com.fr/ :::XML/XSLT - Sablotron::: -- |
From: Daniel L. <inf...@aj...> - 2002-08-14 07:17:51
|
Hello phpxpath-users, 1) I have to do this : exportAsXml( '', 'version=3D"1.0" encoding=3D"iso-8859-1" standalone=3D= "no"'); to obtain <?xml version=3D"1.0" encoding=3D"iso-8859-1" standalone=3D"n= o"?> but the <?xml and ?< are not output ? 2) It's not possible with the class to output some <!DOCTYPE ? Thanks --=20 Cordialement, Daniel mailto:inf...@aj... ---------- Support-Assistance PHP/MySql de =ABInternet Pour Tous=BB=20 http://www.i-p-t.com.fr/ :::XML/XSLT - Sablotron::: -- |
From: Nigel S. <nig...@us...> - 2002-08-08 13:17:26
|
I dunno, "doofus" is a kinda cool word, I like it :o) I usually use the term "numpty", but "doofus" is cool too. A agree though on both accounts, the user is niether a doofus, nor is the subject any good, and won't really assist anyone in looking for "support" from reading the list archive. Nigel =========================== For the most recent version of Php.XPath, and an archive of this list visit: http://www.sourceforge.net/projects/phpxpath ----- Original Message ----- From: "Andreas Skoufis" <ts...@od...> To: <php...@li...> Sent: Thursday, August 08, 2002 2:16 PM Subject: RE: Am I a doofus? > Could you please change the subject in this conversation? > > I mean, it's clear the man is not a doofus, and it could have a more helpful > subject, like "appendData problem" or something ;) > > or maybe "I am not a doofus" ;) > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phpxpath-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpxpath-users > |
From: Andreas S. <ts...@od...> - 2002-08-08 13:12:48
|
Could you please change the subject in this conversation? I mean, it's clear the man is not a doofus, and it could have a more helpful subject, like "appendData problem" or something ;) or maybe "I am not a doofus" ;) |
From: Nigel S. <nig...@us...> - 2002-08-08 12:58:19
|
> > I'm not really sure what isn't working if anything, or what it's meant to > > do.... but $resultarray is never set, so it will never execute any of the > > inside of the foreach($resultarray as ....) loop, hence the above code isn't > > really going to do a whole lot... > > Okay, my fault, I forgot to mention that I snipped parts of the code away to shorten it and to focus > attention on the matter in hand. An honourable intention. For which I am thankful. Better still is to snip away as much as possible, but then confirm that it still runs and fails as you expect :o). > > > It would be most helpful if you could attach .php/.xml/.html > > files that I can copy out and run and examine the output against your output > > to a) see if I get the same results and then b) work out if those results > > are "correct". > > Oh, I didn't do that in the first place - I reckoned you got tons of mails like this and wanted to > spare you the troubles. I do get a fair few mails, but if I get mails with php inline in the email, then all I end up doing is creating a junk.php file and pasting the php in then running it, so it's actually much easier if you just mail .php/.xml files in their entirity. What is annoying is getting php snippets with no xml to run them against. That means I have do debug by "inspection" which is much harder than by "iteration". There is however no need to mail me the XPath.class.php, as I have access to the source for that. Mentioning the cvs version of the file should be all that's necessary. > Anyhoo, I've attached 'bot_db.xml', 'cms_searchengine_createindex2.php', as > well as the 'xpath.class.php' I'm using. I've commented the code slightly. If I've left something in > a blur, I'll be happy and ready to clear things up. Ok I made a one line change to get rid of the index errors. You had: $myindex->appendData($myindex->appendChild($xmlpage,"item"),$itemvalue); Which should have read: $myindex->appendData($myindex->appendChild($xmlpage,"<item/>"),$itemvalue); And then I hit the 30 second execution time limit. So I trimmed the bot_db.xml down to just the first and last "pages" then re-ran and produced search_index.xml. Without studying the code in detail, search_index.xml looks "roughly" right. Is it? If not could you manufacture a small input .xml file, and then show me what the output.xml file should look like? Nigel |
From: Nigel S. <nig...@us...> - 2002-08-07 23:15:24
|
> first off I want to thank you Nigel for the tremendous effort you put into this and I want you to > know that it's greatly appreciated. Keep up the good work. Thanks for your kind comments. :o) > Just to comment on Daniels problems: > > > XPath error in XPath.class.php:1586 In importFromString(): XML error > > in given string on line 1 column 0. Reason:syntax error > > I get the same sort of error - that is varying 'XPath.class.php:####' errors followed by the 'line 1 > column 0' hint. Means you probably need to convert from "tag" to "<tag/>" in your calls to appendChild() etc? > One further problem is in the code below. I know it's a bit lengthy - I hope you won't mind it. > - Begin code ----- > $myindex = new xpath(); > $myindex->setSkipWhiteSpaces($onOff=TRUE); > $myindex->setXmlOption('XML_OPTION_TARGET_ENCODING', 'UTF-8'); > $myindex->importFromString("<searchindex/>"); > $searchindex = $myindex->evaluate("searchindex"); > foreach ($resultarray as $page => $pagename) > { > $xmlpage = $myindex->appendChild("searchindex","<$page/>"); > foreach ($pagename as $itemkey => $itemvalue) > { > $myitem = $myindex->appendChild($xmlpage,"<item/>"); > } > } > $myindex->exportToFile("../search_index.xml"); > - End code ----- > The problem is, that the child in the line '$myitem = $myindex->appendChild($xmlpage,"<item/>");' > doesn't seem to work. Now, if placed outside the foreach loop it does work, which strikes me as odd. > I've tried with manual as well as automatic reindexing, which doesn't seem to have an influence. > I am presented with a blank screen when running the script - no error messages. I'm not really sure what isn't working if anything, or what it's meant to do.... but $resultarray is never set, so it will never execute any of the inside of the foreach($resultarray as ....) loop, hence the above code isn't really going to do a whole lot... > Thank you very much for your time. No problem. It would be most helpful if you could attach .php/.xml/.html files that I can copy out and run and examine the output against your output to a) see if I get the same results and then b) work out if those results are "correct". Cheers, Nigel |