phpxpath-users Mailing List for Php.XPath (Page 8)
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...> - 2002-06-14 21:38:08
|
> if I pass in NULL, it uses the default, which in this case I don't > want. IMO > 1. exportAsXml and exportToFile should do the same > 2. if there is an input file (i.e. this is a change, not a create > new), then use header from input file unless override param > 3. if not (i.e. this is a new file), use a default <?xml ...> header > unless override param Ok have updated all this. Now the class will use the following preference order in the _export() function, that is called by both exportToFile() and exportAsXml(). 1) The xmlHeader you supply as an argument 2) The xmlHeader that it parsed at import time 3) A default of <?xml version="1.0"?> I presume this is what we want? If not please get in touch. > Whilst testing this, I came across another, um, feature. If you have 2 > exports one after the other, for example > ... > print $xml->exportAsXml(); > print $xml->exportAsXml(); > ... > the first one will have the header, the second and subsequent will > not. I take it this is a bug and not intentional? Seems to have > something to do with the node index, though putting reindexNodeTree() > between the 2 exports had no effect. I forgot to try to reproduce this before I made the fix, and now can't reproduce it, so I presume that I fixed it on the way. If not then I'm sure we'll find out some time... Cheers, Nigel |
From: Peter R. <php...@pe...> - 2002-06-07 17:58:50
|
On Wednesday 05 Jun 2002 00:00, Nigel Swinson wrote: > > However, whilst investigating this, I came across another > > phpxpath feature that I wasn't aware of before. Why does the > > handling of the xml PI and other header info such as dtd differ > > between exportAsXml and exportToFile? As default, exportAsXml > > keeps it, whereas exportToFile drops it. Is not the main > > difference between these 2 functions that exportToFile, er, well, > > writes the xml to a file? > > Well you could pass in the third argument as NULL and that would > prevent it from overwriting the PI. I'm not sure why it's the way > it is. Perhaps Sam has a comment? If not then perhaps we should > only add the "default" PI if none is present. if I pass in NULL, it uses the default, which in this case I don't want. IMO 1. exportAsXml and exportToFile should do the same 2. if there is an input file (i.e. this is a change, not a create new), then use header from input file unless override param 3. if not (i.e. this is a new file), use a default <?xml ...> header unless override param Whilst testing this, I came across another, um, feature. If you have 2 exports one after the other, for example ... print $xml->exportAsXml(); print $xml->exportAsXml(); ... the first one will have the header, the second and subsequent will not. I take it this is a bug and not intentional? Seems to have something to do with the node index, though putting reindexNodeTree() between the 2 exports had no effect. |
From: Sam B. <bs...@us...> - 2002-06-05 16:37:24
|
> before exportToFile > XPath error in XPath.class.php:966 Couldn't get an exclusive lock on the > /...../Elenco_Pratiche.xml file. > after exportToFile - - Hi Franco Found a bug repport on that problem in the PHP bug DB. File locking isn't supported with Windows 95/98. I tried to modify the code to ignore file lockings when using windows 95/98. Could you try out the passed version and give me a feedback. I will then add the update to sourceforge. Cheers -- Sam Blum <bs...@us...> =========================== For the most recent version of PHP.XPath and an archive of this list visit: http://sourceforge.net/projects/phpxpath |
From: Pozzer F. <fra...@in...> - 2002-06-05 11:50:16
|
> Thanks for all. I hope to explain well my problem. I try again to work with XPath Class in W98. I have install Apache 1.3.24 and PHP 4.2.1. PHP work as CGI. The document_root it is C:\Programmi\Apache Group\Apache\htdocs I have this code in my PHP: echo"0<br>"; copy("../../pratiche/modello.xml","../../pratiche/".$nomePratica.".xml"); echo"1<br>"; $xmlOptions = array(XML_OPTION_SKIP_WHITE => TRUE); echo"2<br>"; $XpathPratica = new XPath(FALSE, $xmlOptions); echo"3<br>"; global $elenco_pratExt; echo"4<br>"; $XpathPratica->importFromFile($elenco_pratExt."Elenco_Pratiche.xml"); echo"5<br>"; $xPathQuery='/*/*[last()]'; echo"6<br>"; $xPathSet = $XpathPratica->match($xPathQuery); echo"7<br>"; $clone = $XpathPratica->cloneNode($xPathSet[0]); echo"8<br>"; $XpathPratica->replaceData($xPathQuery."/Cod_Pratica[1]","$nomePratica"); echo"9<br>"; $XpathPratica->replaceData($xPathQuery."/Mod_Base[1]","I1"); echo"10<br>"; $XpathPratica->replaceData($xPathQuery."/Denominazione[1]","Pratica_$nomePratica"); echo"11<br>"; $dataCreazione=date("Y")."-".date("m")."-".date("d")." ".date("H").":".date("i").":".date("s"); echo"12<br>"; $XpathPratica->replaceData($xPathQuery."/Ultimo_Agg[1]","$dataCreazione"); echo"13<br>"; $XpathPratica->appendChild('/Elenco_Pratiche[1]', $clone, $shiftRight=FALSE); echo"before exportToFile<br>"; $XpathPratica->exportToFile($elenco_pratExt."Elenco_Pratiche.xml"); echo"after exportToFile<br>"; In bold line after I have an error. To the browser have this comment: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 before exportToFile XPath error in XPath.class.php:966 Couldn't get an exclusive lock on the c:/programmi/apache group/apache/htdocs/fedraxpath/pratiche/Elenco_Pratiche.xml file. after exportToFile > I do not undestand the problems. Please replay to me in NG but also from my e-mail. Thanks very much for all. fra...@in... > > |
From: Nigel S. <nig...@us...> - 2002-06-05 10:56:39
|
Please send us your error.xml file. It sounds likely that there is more than one error node with an @id attribute of -100. Without seeing the xml file, then we can only guess... Please also tell us what version of the class you are using. Thanks, Nigel =========================== For the most recent version of Php.XPath, V2.x, and an archive of this list visit: http://www.sourceforge.net/projects/phpxpath ----- Original Message ----- From: narmataru To: php...@li... Sent: Wednesday, June 05, 2002 10:14 AM Subject: error :"string does not uniquely describe"... hello, when i use an XPath object into another php class, it always print the error : "The supplied string does not uniquely describe a node in the xml document: " even if i'm sure that my request must give only one node since i use an id into my xml tags. there is the with the getAttributes(), getData and with the getDataParts() function too ! it looks strange, no ? thank tou for your answer. from :: nar...@ho... /***************************************************************** that works good require_once("XPath.class.php"); $xpath = new XPath(); $xpath->importFromFile("error.xml"); $xreq = "file://error[@id='-100']"; $attribute = $xpath->match($xreq); print_r($attribute."<hr>"); print("value : ".$attribute[0]."<br>"); print("attrib : ".$attribute["type"]."<br>"); /***************************************************************** /***************************************************************** it doesn't work ! class toto{ ... function nextError(){ // get datas into the xml file file://$xreq = "file://error[@id='-100']"; $attribute = $this->_xPathObj->getAttributes($xreq); $value = $this->_xPathObj->getData($xreq); } ... } the error dispayed is : XPath error in XPath.class.php:868 The supplied string does not uniquely describe a node in the xml document: //error[@id='-100'] XPath error in XPath.class.php:1117 The //error[@id='-100'] does not evaluate to a single node in this document. |
From: narmataru <nar...@ho...> - 2002-06-05 09:09:09
|
hello, when i use an XPath object into another php class, it always print the = error : "The supplied string does not uniquely describe a node in the = xml document: " even if i'm sure that my request must give only one node = since i use an id into my xml tags.=20 there is the with the getAttributes(), getData and with the = getDataParts() function too ! it looks strange, no ?=20 thank tou for your answer. from :: nar...@ho... /***************************************************************** that = works good require_once("XPath.class.php"); $xpath =3D new XPath(); $xpath->importFromFile("error.xml"); $xreq =3D "file://error[@id=3D'-100']"; $attribute =3D $xpath->match($xreq); print_r($attribute."<hr>"); print("value : ".$attribute[0]."<br>"); print("attrib : ".$attribute["type"]."<br>"); /***************************************************************** /***************************************************************** it = doesn't work ! class toto{ ... function nextError(){ // get datas into the xml file file://$xreq =3D "file://error[@id=3D'-100']"; $attribute =3D $this->_xPathObj->getAttributes($xreq); $value =3D $this->_xPathObj->getData($xreq); } ... } the error dispayed is : XPath error in XPath.class.php:868 The supplied string does not uniquely = describe a node in the xml document: //error[@id=3D'-100'] XPath error in XPath.class.php:1117 The //error[@id=3D'-100'] does not = evaluate to a single node in this document. |
From: Sam B. <bs...@us...> - 2002-06-05 07:54:55
|
> ?: > As default, exportAsXml keeps it, whereas > exportToFile drops it. Is not the main difference between these 2 > functions that exportToFile, er, well, writes the xml to a file? > Nigel: > Well you could pass in the third argument as NULL and that would prevent > it from overwriting the PI. I'm not sure why it's the way it is. Perhaps Sam > has a comment? If not then perhaps we should only add the "default" PI if > none is present. Hi, This is a leftover 'feature' from V1 of Php.XPath. V1 used to ignor the header, so the idea was to replace it by <?xml version="1.0"?> by default when exporting to a file. Then in V2 the user had the option to overwrite it and in V3 we're able to keep the header 'as is' but exportToFile() would still overwite it by default. We could change the behaver but it could break ppls code. -- Sam Blum <bs...@us...> =========================== For the most recent version of PHP.XPath and an archive of this list visit: http://sourceforge.net/projects/phpxpath |
From: Nigel S. <nig...@us...> - 2002-06-04 23:23:41
|
> I have a problem with the Predefined General Entites of XML (' < > etc...) and the evaluate function. > > > Here is my problem: > ---------------- > 1/ I have a XML file with an entity like this: > > <ProductColor nameKey="BLEU D'iles"nameKeyType="String"> bla bla > </ProductColor> > > > 2/ In my DataBase, the stored value is "BLEU D'iles". > > > 3/ When I try to use the XPath evaluate function as below, it doesn't > work of course: > $xPath->evaluate("//ProductColor[@nameKey='Bleu d'iles']"); > > I have also tried : > $xPath->evaluate("//ProductColor[@nameKey='Bleu d'iles']"); > > It doesn't work too. Try: $xPath->evaluate("//ProductColor[@nameKey='BLEU D'iles']"); Sadly XPath does not natively support case insensitivity yet and we haven't coded a fudge round this hole yet. > My Questions: > ------------ > I tried to read carefully the documentation but I didn't find anything > for this. Many thanks :o) > I also tries to use to the decodeEntities function but it's > only for HTML entities and not XML entities which are not exactly the same. > > - Is there a function to evaluate with an automatic XML entities encoding. > - Or did I miss something ? Yeah there's another thread going on relating to this kind of thing just now. It might be that we support a way to read in the XML file and have entitites parsed out. At the moment they go in as is, so hence you have to search for ' rather than '. Hopefully this is ok for your work to continue just now. Cheers, Nigel |
From: Nigel S. <nig...@us...> - 2002-06-04 22:58:56
|
> However, whilst investigating this, I came across another phpxpath > feature that I wasn't aware of before. Why does the handling of the > xml PI and other header info such as dtd differ between exportAsXml > and exportToFile? As default, exportAsXml keeps it, whereas > exportToFile drops it. Is not the main difference between these 2 > functions that exportToFile, er, well, writes the xml to a file? Well you could pass in the third argument as NULL and that would prevent it from overwriting the PI. I'm not sure why it's the way it is. Perhaps Sam has a comment? If not then perhaps we should only add the "default" PI if none is present. Nigel |
From: Breton Y. <Y.B...@le...> - 2002-06-04 15:49:01
|
Hello, I have a problem with the Predefined General Entites of XML (' < etc...) and the evaluate function. Here is my problem: ---------------- 1/ I have a XML file with an entity like this: <ProductColor nameKey="BLEU D'iles"nameKeyType="String"> bla bla </ProductColor> 2/ In my DataBase, the stored value is "BLEU D'iles". 3/ When I try to use the XPath evaluate function as below, it doesn't work of course: $xPath->evaluate("//ProductColor[@nameKey='Bleu d'iles']"); I have also tried : $xPath->evaluate("//ProductColor[@nameKey='Bleu d'iles']"); It doesn't work too. My Questions: ------------ I tried to read carefully the documentation but I didn't find anything for this. I also tries to use to the decodeEntities function but it's only for HTML entities and not XML entities which are not exactly the same. - Is there a function to evaluate with an automatic XML entities encoding. - Or did I miss something ? Thanks ! Yann -- ============================== Yann BRETON R&D Lectra Systemes y.b...@le... ============================== |
From: Pozzer F. <fra...@in...> - 2002-06-03 08:16:16
|
Thanks very much Peter. This it is the line of code PHP where I have problem: $XpathPratica->importFromFile("http://localhost/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml"); I have change this line in two way: 1. $document_root = getenv('DOCUMENT_ROOT'); $XpathPratica->importFromFile($document_root."/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml"); oppure 2. $document_root = getenv('DOCUMENT_ROOT'); $fp = fopen($document_root."/FEDRADOM/SV/PHP/XML/Elenco_Pratiche.xml", "w+" ); $XpathPratica->importFromFile($fp); Let me to ask of all what it is better for the performance 1. or 2. Now I try to change in all my PHP code the path. After this I try again to test XPtah V.3.0 in W98 and W95 also. Thanks for all. If you have same help to test XPtah in W95 send me e-mail, please, with how to do I have to make. Ciao Franco. Peter Robins wrote: > it looks like you're trying to read a local file with a url which it > can't find. All the other errors are coming because of that. > > 1. does this url actually exist? :-) (can you view it in your > browser?) > 2. is allow_url_fopen on? it generally is, but you never know . . . > 3. if all you are doing is reading local files, it would be much > better/faster to read from local filesystem rather than using http > > On Wednesday 29 May 2002 10:00, Pozzer Franco wrote: > > > Thanks for all. I hope to explain well my problem. > > > > > > I have to make same little code PHP to use XPtah for to > > > understand how work it in the XML structure. > > > > > > I have two ENV where I try XPath: WinNT and W98. I describe it: > > > > > > 1. WinNT Server PII AcerPower4100; 250Mhrz; 132MB of RAM > > > In this ENV I have Apache 1.3.24 from the apache.org and PHP > > > 4.2.1 from php.net. > > > I do not use tools for Windows system like PHPTRIAD > > > (www.phpgeek.com) > > > > > > In this ENV XPTAH work fine and the performance are enough good ( > > > I compare it with DOM API Class from this site > > > http://devil.medialab.at/projects/phpdom/doc/phpDOM_Demo.html). > > > > > > In this ENV not problems, > > > now................................................. > > > > > > 2. W98 P133 Unisys 32MB of RAM . > > > Also in this ENV I have Apache 1.3.24 from the apache.org and PHP > > > 4.2.1 from php.net and I do not use any Windows tools for Apache > > > and PHP. > > > > > > In this ENV the same sample and code PHP that work fine in the > > > WinNT ENV do not work. > > > > > > The error that I have it is this: > > > > > > XPath error in Xpath.class.php:1333 In importFromFile(): > > > The url > > > 'http://localhost/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml' > > > could not be found or read. > > > > > > Warning: Invalid argument supplied for foreach() in > > > C:\Programmi\Apache > > > Group\Apache\htdocs\FEDRAXPATH\SV\PHP\CLASSUTILITY\mieProve\Xpath > > >.class.php on line 1860 > > > > > > XPath error in Xpath.class.php:4224 The supplied xPath-query > > > '/Elenco_Pratiche[1]' does not match *any* node in the xml > > > document. > > > > > > XPath error in Xpath.class.php:966 Couldn't get an exclusive lock > > > on the c:/programmi/apache > > > group/apache/htdocs/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml > > > file. > > > > > > Before to close my msg I have see a very strangeness. > > > > > > At the start the XML file Elenco_Pratiche.XML it is like this: > > > > > > <?xml version="1.0" ?> > > > <Elenco_Pratiche> > > > <RECORD> > > > <Cod_Pratica>null</Cod_Pratica> > > > <Mod_Base>null</Mod_Base> > > > <Denominazione>null</Denominazione> > > > <Ultimo_Agg>null</Ultimo_Agg> > > > <Ultimo_Scar>null</Ultimo_Scar> > > > <Tipo_Scar>null</Tipo_Scar> > > > </RECORD> > > > </Elenco_Pratiche> > > > > > > I want to clone this NODE and CHILD with the field and with there > > > value of the HTML page generated by PHP code. > > > > > > After to execute my code PHP and when I have a error the file XML > > > Elenco_Pratiche.xml are empty > > > > > > Thanks all for response. I like if the Fiends of the NG write me > > > also directly. Thanks. > > > > > > Ciao e grazie. Franco > > > > www.infocamere.it > > fra...@in... > > > > > > > > > > > > > > _______________________________________________________________ > > > > Don't miss the 2002 Sprint PCS Application Developer's Conference > > August 25-28 in Las Vegas -- > > http://devcon.sprintpcs.com/adp/index.cfm > > > > _______________________________________________ > > Phpxpath-users mailing list > > Php...@li... > > https://lists.sourceforge.net/lists/listinfo/phpxpath-users |
From: Peter R. <php...@pe...> - 2002-05-31 19:35:55
|
On Thursday 23 May 2002 09:25, Peter Robins wrote: > > ok, I will try and get this done (and tested!) next week. have looked further into this and find there is no problem. In fact, it looks like the PHP manual is wrong. What the source encoding function in expat does is _override_ the encoding given in the file. So, if your xml file is defined as utf-8, it will be read in and processed as utf-8. As I can't think of any reason why you would want to override the file encoding, I see no reason for writing a function to do it! However, whilst investigating this, I came across another phpxpath feature that I wasn't aware of before. Why does the handling of the xml PI and other header info such as dtd differ between exportAsXml and exportToFile? As default, exportAsXml keeps it, whereas exportToFile drops it. Is not the main difference between these 2 functions that exportToFile, er, well, writes the xml to a file? This is neatly illustrated by the test suite. Take for example the simple-test files provided. These are defined as latin1, and if you change them using >127 characters such as accented ones, according to the display the encoding in the output file is latin1. However if you look at the actual file created, you find the encoding has disappeared, in other words it is now supposedly in utf-8. This should mean the display is screwy if you load this file in the test suite, but doesn't because the script doesn't define the html charset, so if your browser, like mine, uses latin1 as default, the display looks correct - in other words, the 2 errors cancel each other out. nice one :-) |
From: Pozzer F. <fra...@in...> - 2002-05-31 08:55:47
|
Thanks Peter for your response. I try to replay if your msg and I add same consideration. To the first the problems it is unresolved! Peter Robins wrote: > it looks like you're trying to read a local file with a url which it > can't find. All the other errors are coming because of that. > > 1. does this url actually exist? :-) (can you view it in your > browser?) Yes. It it my desktop localhost. The Path it is: C:\Programmi\Apache Group\Apache\htdocs\FEDRAXPATH\SV\PHP\XML In the httpd.conf I have: ServerRoot "C:/Programmi/Apache Group/Apache" and DocumentRoot "C:/Programmi/Apache Group/Apache/htdocs". If I want to display XMl file Elenchi_Pratiche.xml I f true it to the path of the web_server. I tue it and I can to see it from the browser. > 2. is allow_url_fopen on? it generally is, but you never know . . . Yes. PHP work as apache module. PHP.INI it is in the Windows/system ad all .Dlls are in windows/system. In the PHP.INI I have the doc_root = C:/Programmi/Apache Group/Apache/htdocs and extension_dir = C:/Php/php-4.2.1-Win32/extensions > 3. if all you are doing is reading local files, it would be much > better/faster to read from local filesystem rather than using http Ok this it is very interesting and I think of it about. But the very important I thinks it is the Elenco_Partiche.xml I find after the execute code. It is empty. I have lost all this content: <?xml version="1.0" ?> <Elenco_Pratiche> <RECORD> <Cod_Pratica>null</Cod_Pratica> <Mod_Base>null</Mod_Base> <Denominazione>null</Denominazione> <Ultimo_Agg>null</Ultimo_Agg> <Ultimo_Scar>null</Ultimo_Scar> <Tipo_Scar>null</Tipo_Scar> </RECORD> </Elenco_Pratiche> I am very afrait for this. My last try it is to configure PHp as CGI instead Apache module and at ent ad re-install w98 and Apache and PHP and I try again XPath. Please, replay to my also at my e-mail. Ciao Franco. > > > On Wednesday 29 May 2002 10:00, Pozzer Franco wrote: > > > Thanks for all. I hope to explain well my problem. > > > > > > I have to make same little code PHP to use XPtah for to > > > understand how work it in the XML structure. > > > > > > I have two ENV where I try XPath: WinNT and W98. I describe it: > > > > > > 1. WinNT Server PII AcerPower4100; 250Mhrz; 132MB of RAM > > > In this ENV I have Apache 1.3.24 from the apache.org and PHP > > > 4.2.1 from php.net. > > > I do not use tools for Windows system like PHPTRIAD > > > (www.phpgeek.com) > > > > > > In this ENV XPTAH work fine and the performance are enough good ( > > > I compare it with DOM API Class from this site > > > http://devil.medialab.at/projects/phpdom/doc/phpDOM_Demo.html). > > > > > > In this ENV not problems, > > > now................................................. > > > > > > 2. W98 P133 Unisys 32MB of RAM . > > > Also in this ENV I have Apache 1.3.24 from the apache.org and PHP > > > 4.2.1 from php.net and I do not use any Windows tools for Apache > > > and PHP. > > > > > > In this ENV the same sample and code PHP that work fine in the > > > WinNT ENV do not work. > > > > > > The error that I have it is this: > > > > > > XPath error in Xpath.class.php:1333 In importFromFile(): > > > The url > > > 'http://localhost/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml' > > > could not be found or read. > > > > > > Warning: Invalid argument supplied for foreach() in > > > C:\Programmi\Apache > > > Group\Apache\htdocs\FEDRAXPATH\SV\PHP\CLASSUTILITY\mieProve\Xpath > > >.class.php on line 1860 > > > > > > XPath error in Xpath.class.php:4224 The supplied xPath-query > > > '/Elenco_Pratiche[1]' does not match *any* node in the xml > > > document. > > > > > > XPath error in Xpath.class.php:966 Couldn't get an exclusive lock > > > on the c:/programmi/apache > > > group/apache/htdocs/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml > > > file. > > > > > > Before to close my msg I have see a very strangeness. > > > > > > At the start the XML file Elenco_Pratiche.XML it is like this: > > > > > > <?xml version="1.0" ?> > > > <Elenco_Pratiche> > > > <RECORD> > > > <Cod_Pratica>null</Cod_Pratica> > > > <Mod_Base>null</Mod_Base> > > > <Denominazione>null</Denominazione> > > > <Ultimo_Agg>null</Ultimo_Agg> > > > <Ultimo_Scar>null</Ultimo_Scar> > > > <Tipo_Scar>null</Tipo_Scar> > > > </RECORD> > > > </Elenco_Pratiche> > > > > > > I want to clone this NODE and CHILD with the field and with there > > > value of the HTML page generated by PHP code. > > > > > > After to execute my code PHP and when I have a error the file XML > > > Elenco_Pratiche.xml are empty > > > > > > Thanks all for response. I like if the Fiends of the NG write me > > > also directly. Thanks. > > > > > > Ciao e grazie. Franco > > > > www.infocamere.it > > fra...@in... > > > > > > > > > > > > > > _______________________________________________________________ > > > > Don't miss the 2002 Sprint PCS Application Developer's Conference > > August 25-28 in Las Vegas -- > > http://devcon.sprintpcs.com/adp/index.cfm > > > > _______________________________________________ > > Phpxpath-users mailing list > > Php...@li... > > https://lists.sourceforge.net/lists/listinfo/phpxpath-users |
From: Nigel S. <nig...@us...> - 2002-05-30 23:56:00
|
Peter brought this bug up a while back, but we'd forgotten about it. It has been fixed now. The brief story is that double predicates like /*[last()][@Attr='X'] will now work. If you want more background then you can read on some of Peter and my discussion from this evening... I think it is unlikely that this bug affects you. I think most XPath users only use one [] not two or more [][], but thought I should post to the list just in case it does. :o) Nigel > On Thursday 30 May 2002 20:41, Nigel Swinson wrote: > > > > > Also, it looks like the double predicate problem (my 'last tango > > > in Paris' example) is still outstanding - is that correct? > > > > I had to go and research this but I what I found was going to > > http://www.zvon.org:9001/saxon/cgi-bin/XLab/XML/extras.html?stylesh > >eetFile=X SLT/xpath.xslt (Link doesn't seem to be working right just > > now) that //*[last()] could return more than one node, so it seemed > > that we were implementing last() right. > > > > There does however seem to be a second issue todo with > > /nodetest[][] double predicates, which DOES NOT seem to be working. > > I don't know if it's meant to though. Is it? If it is then it > > seems we still have a bug... > > > > Can you confirm? > > yes, these are 2 two different things. The problem is not with last > but with >1 predicates. Look at say the company structure xml in the > useCases testbench. If you do //employee[last()] it will fetch the > last employee node in each parent (dept), 5 of them in this case, > which is correct. If you do //employee[@gender='m'], it will fetch > all the male employees. But if you try and combine the 2, i.e. a > 2-stage process: fetch the male employees and then give me the last > one //employee[@gender='m'][last()] it brings an error that it can't > find a gender function. > The example in the xpath spec is para[@type="warning"][5] > In my tango example, you can fetch all the tangos in Paris, and all > the last tangos, but not the two together. > > These positional ones are not too difficult to work around, as you can > simply read all the first predicate into an array and then use php to > fish out the one you want, but at least in principle, you can have > any predicate and any number of predicates, tho in practice I doubt > whether anyone would have much use for this. > > I don't think this is a bug btw, I don't think it was ever coded :-) > |
From: Peter R. <php...@pe...> - 2002-05-30 08:04:17
|
just a guess on my part: is register_globals on or off? I'm using 4.1.1 without problem, and the default for this is something that has changed with 4.2. otherwise, would suggest asking on php lists. Even if these 2 are now deprecated, they should still work. On Thursday 30 May 2002 07:05, Tim Uckun wrote: > At 09:14 PM 5/29/2002 +0200, you wrote: > > > It seems like my version of php (4.12 running on > > > freebsd) is puking on the error messages and complaining about > > > the __LINE__ and __FILE__ barewords. Is there a > > > setting or something I need to tweak? > > > >The "Magical Constant" __LINE__ and __FILE__ should just work. > > Have never heard of a problem. But you might try a PHP update. > > According to the bug reports there was a problem with __FILE__ in > > PHP version 4.1.2 > > I am using the latest version of php (4.2.1) I went to the > documentation on the web and the link to the __LINE__ and __FILE__ > constants were disabled. I wonder if this means these have been > depriciated. |
From: Tim U. <ti...@di...> - 2002-05-30 05:00:29
|
At 09:14 PM 5/29/2002 +0200, you wrote: > > It seems like my version of php (4.12 running on > > freebsd) is puking on the error messages and complaining about the > > __LINE__ and __FILE__ barewords. Is there a > > setting or something I need to tweak? > >The "Magical Constant" __LINE__ and __FILE__ should just work. Have >never heard of a problem. But you might try a PHP update. According to the >bug reports there was a problem with __FILE__ in PHP version 4.1.2 I am using the latest version of php (4.2.1) I went to the documentation on the web and the link to the __LINE__ and __FILE__ constants were disabled. I wonder if this means these have been depriciated. ---------------------------------------------- Tim Uckun Mobile Intelligence Unit. ---------------------------------------------- "There are some who call me TIM?" ---------------------------------------------- |
From: Sam B. <bs...@us...> - 2002-05-29 19:13:47
|
> It seems like my version of php (4.12 running on > freebsd) is puking on the error messages and complaining about the > __LINE__ and __FILE__ barewords. Is there a > setting or something I need to tweak? The "Magical Constant" __LINE__ and __FILE__ should just work. Have never heard of a problem. But you might try a PHP update. According to the bug reports there was a problem with __FILE__ in PHP version 4.1.2 -- Sam Blum <bs...@us...> =========================== For the most recent version of PHP.XPath and an archive of this list visit: http://sourceforge.net/projects/phpxpath |
From: Peter R. <php...@pe...> - 2002-05-29 17:29:53
|
it looks like you're trying to read a local file with a url which it can't find. All the other errors are coming because of that. 1. does this url actually exist? :-) (can you view it in your browser?) 2. is allow_url_fopen on? it generally is, but you never know . . . 3. if all you are doing is reading local files, it would be much better/faster to read from local filesystem rather than using http On Wednesday 29 May 2002 10:00, Pozzer Franco wrote: > > Thanks for all. I hope to explain well my problem. > > > > I have to make same little code PHP to use XPtah for to > > understand how work it in the XML structure. > > > > I have two ENV where I try XPath: WinNT and W98. I describe it: > > > > 1. WinNT Server PII AcerPower4100; 250Mhrz; 132MB of RAM > > In this ENV I have Apache 1.3.24 from the apache.org and PHP > > 4.2.1 from php.net. > > I do not use tools for Windows system like PHPTRIAD > > (www.phpgeek.com) > > > > In this ENV XPTAH work fine and the performance are enough good ( > > I compare it with DOM API Class from this site > > http://devil.medialab.at/projects/phpdom/doc/phpDOM_Demo.html). > > > > In this ENV not problems, > > now................................................. > > > > 2. W98 P133 Unisys 32MB of RAM . > > Also in this ENV I have Apache 1.3.24 from the apache.org and PHP > > 4.2.1 from php.net and I do not use any Windows tools for Apache > > and PHP. > > > > In this ENV the same sample and code PHP that work fine in the > > WinNT ENV do not work. > > > > The error that I have it is this: > > > > XPath error in Xpath.class.php:1333 In importFromFile(): > > The url > > 'http://localhost/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml' > > could not be found or read. > > > > Warning: Invalid argument supplied for foreach() in > > C:\Programmi\Apache > > Group\Apache\htdocs\FEDRAXPATH\SV\PHP\CLASSUTILITY\mieProve\Xpath > >.class.php on line 1860 > > > > XPath error in Xpath.class.php:4224 The supplied xPath-query > > '/Elenco_Pratiche[1]' does not match *any* node in the xml > > document. > > > > XPath error in Xpath.class.php:966 Couldn't get an exclusive lock > > on the c:/programmi/apache > > group/apache/htdocs/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml > > file. > > > > Before to close my msg I have see a very strangeness. > > > > At the start the XML file Elenco_Pratiche.XML it is like this: > > > > <?xml version="1.0" ?> > > <Elenco_Pratiche> > > <RECORD> > > <Cod_Pratica>null</Cod_Pratica> > > <Mod_Base>null</Mod_Base> > > <Denominazione>null</Denominazione> > > <Ultimo_Agg>null</Ultimo_Agg> > > <Ultimo_Scar>null</Ultimo_Scar> > > <Tipo_Scar>null</Tipo_Scar> > > </RECORD> > > </Elenco_Pratiche> > > > > I want to clone this NODE and CHILD with the field and with there > > value of the HTML page generated by PHP code. > > > > After to execute my code PHP and when I have a error the file XML > > Elenco_Pratiche.xml are empty > > > > Thanks all for response. I like if the Fiends of the NG write me > > also directly. Thanks. > > > > Ciao e grazie. Franco > > www.infocamere.it > fra...@in... > > > > > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- > http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Phpxpath-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpxpath-users |
From: Tim U. <ti...@di...> - 2002-05-29 15:15:05
|
Hello All. I have been using an old version of phpxpath for a long time now thanks for a great tool. Yesterday I finally decided to upgrade to version three and tried to run a few tests. It seems like my version of php (4.12 running on freebsd) is puking on the error messages and complaining about the __LINE__ and __FILE__ barewords. Is there a setting or something I need to tweak? :wq Tim Uckun US Investigations Services/Due Diligence http://www.diligence.com/ |
From: Pozzer F. <fra...@in...> - 2002-05-29 08:53:13
|
> Thanks for all. I hope to explain well my problem. > I have to make same little code PHP to use XPtah for to understand > how work it in the XML structure. > > I have two ENV where I try XPath: WinNT and W98. I describe it: > > 1. WinNT Server PII AcerPower4100; 250Mhrz; 132MB of RAM > In this ENV I have Apache 1.3.24 from the apache.org and PHP 4.2.1 from > php.net. > I do not use tools for Windows system like PHPTRIAD (www.phpgeek.com) > > In this ENV XPTAH work fine and the performance are enough good ( I > compare it with DOM API Class from this site > http://devil.medialab.at/projects/phpdom/doc/phpDOM_Demo.html). > > In this ENV not problems, > now................................................. > > 2. W98 P133 Unisys 32MB of RAM . > Also in this ENV I have Apache 1.3.24 from the apache.org and PHP 4.2.1 > from php.net and I do not use any Windows tools for Apache and PHP. > > In this ENV the same sample and code PHP that work fine in the WinNT ENV > do not work. > > The error that I have it is this: > > XPath error in Xpath.class.php:1333 In importFromFile(): > The url 'http://localhost/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml' > could not be found or read. > > Warning: Invalid argument supplied for foreach() in > C:\Programmi\Apache > Group\Apache\htdocs\FEDRAXPATH\SV\PHP\CLASSUTILITY\mieProve\Xpath.class.php > on line 1860 > > XPath error in Xpath.class.php:4224 The supplied xPath-query > '/Elenco_Pratiche[1]' does not match *any* node in the xml document. > > XPath error in Xpath.class.php:966 Couldn't get an exclusive lock on the > c:/programmi/apache > group/apache/htdocs/FEDRAXPATH/SV/PHP/XML/Elenco_Pratiche.xml file. > > Before to close my msg I have see a very strangeness. > > At the start the XML file Elenco_Pratiche.XML it is like this: > > <?xml version="1.0" ?> > <Elenco_Pratiche> > <RECORD> > <Cod_Pratica>null</Cod_Pratica> > <Mod_Base>null</Mod_Base> > <Denominazione>null</Denominazione> > <Ultimo_Agg>null</Ultimo_Agg> > <Ultimo_Scar>null</Ultimo_Scar> > <Tipo_Scar>null</Tipo_Scar> > </RECORD> > </Elenco_Pratiche> > > I want to clone this NODE and CHILD with the field and with there value of > the HTML page generated by PHP code. > > After to execute my code PHP and when I have a error the file XML > Elenco_Pratiche.xml are empty > > Thanks all for response. I like if the Fiends of the NG write me also > directly. Thanks. > > Ciao e grazie. Franco www.infocamere.it fra...@in... > > > |
From: Peter R. <php...@pe...> - 2002-05-24 12:48:33
|
just been reading up a bit further on expat, and it seems if you do not set a character data handler but let it be handled by the default handler, this has the effect of not parsing/expanding internal entities. Just tested this in php briefly, and it's true. Might this be the way forward (of course it's perfectly possible it might screw something else up!)? Only set a character data handler if you want the entities parsed? It also seems expat can after all handle external DTDs and PEs, but you have to define this when you compile it. I see the latest versions of PHP now have handlers for namespaces, so perhaps they will get around to PEs eventually. On Friday 24 May 2002 11:30, Peter Robins wrote: > On Friday 24 May 2002 10:44, Sam Blum wrote: > > Assuming we would let expat parse the entity in the sample below > > <!ENTITY ourname "Perfect Programmers>"> > > <&ourname; > > > > and would generate a file with one of the export-functions of Php.XPath > > the result would be: > > <!ENTITY ourname "Perfect Programmers>"> > > <Perfect Programmers> > > > > All defined entities (plus the 5 xml entities) have been replaces and any > > changes to <!ENTITY ourname "Perfect Programmers"> in the exported file > > would have *no effect* any more! Even worse the < and > have been > > replaced too! > > ok, so this means if you are importing/parsing in order to change/rewrite > the file, then you don't want entities parsed (treat & as &); if for > outputing to some other medium such as html, then you do. So . . . can we > have it switchable please, passing over a y/n parameter to the import > functions. > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Phpxpath-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpxpath-users |
From: Peter R. <php...@pe...> - 2002-05-24 10:31:09
|
On Friday 24 May 2002 10:44, Sam Blum wrote: > Assuming we would let expat parse the entity in the sample below > <!ENTITY ourname "Perfect Programmers>"> > <&ourname; > > and would generate a file with one of the export-functions of Php.XPath the > result would be: > <!ENTITY ourname "Perfect Programmers>"> > <Perfect Programmers> > > All defined entities (plus the 5 xml entities) have been replaces and any > changes to <!ENTITY ourname "Perfect Programmers"> in the exported file > would have *no effect* any more! Even worse the < and > have been > replaced too! ok, so this means if you are importing/parsing in order to change/rewrite the file, then you don't want entities parsed (treat & as &); if for outputing to some other medium such as html, then you do. So . . . can we have it switchable please, passing over a y/n parameter to the import functions. |
From: Sam B. <bs...@us...> - 2002-05-24 09:43:41
|
Hi Peter, > To take a simple example: if you define the following at the front of your > xml file <!ENTITY ourname "Perfect Programmers"> then you can > reference &ourname; in the rest of the file Yes, I know about the that feature. But it has 2 sides. Assuming we would let expat parse the entity in the sample below <!ENTITY ourname "Perfect Programmers>"> <&ourname; and would generate a file with one of the export-functions of Php.XPath the result would be: <!ENTITY ourname "Perfect Programmers>"> <Perfect Programmers> All defined entities (plus the 5 xml entities) have been replaces and any changes to <!ENTITY ourname "Perfect Programmers"> in the exported file would have *no effect* any more! Even worse the < and > have been replaced too! After the XML has been parsed (and maybe modified by one of the included DOM functions) you wouldn't want this to happen when exporting to an XML-file. Note that the expat parser replaces the 5 xml entities plus all the entities that are defined by <!ENTITY ...> 'silently'. I see no simple solution to this problem and therefore I believe the way we handle it, be keeping the entities 'as is', is the best we can do. Regards -- Sam Blum <bs...@us...> =========================== For the most recent version of PHP.XPath and an archive of this list visit: http://sourceforge.net/projects/phpxpath |
From: Peter R. <php...@pe...> - 2002-05-24 08:26:54
|
yes, I read that, but don't see why all this is necessary or desirable. If you don't define an entity, how's the parser to know what to do with it? And if you don't want the parser to parse an entity, why use an entity at all? It's a pity that expat, as a non-validating parser, ignores external DTDs/PEs but, even so, entities have their uses. To take a simple example: if you define the following at the front of your xml file <!ENTITY ourname "Perfect Programmers"> then you can reference &ourname; in the rest of the file (such as "We are proud of &ourname;'s unrivaled modesty.") and, if the name changes at some point, you only need to change your entity definition and the parser will automatically reflect the change in all the references. expat parses this without any problem; phpxpath used to, but if looks like it no longer does. This is a simple example, but you can do clever things with entities if you preprocess the xml file to create them dynamically - a sort of templating system. (btw, there are actually 5 xml entities: apos is missing from the list :-) On Thursday 23 May 2002 10:54, Sam Blum wrote: > > Always's happy to have new ppl on board giving us a hand! ;o) > You seam to have some trouble with the Entity handling in Php.XPath. > I'm not quite sure if I understand the problem. But pleas read following > extract taken from Php.XPath's _translateAmpersand () function. > I think it's a good base to undersand the problematic. > > /** > * Translate all ampersands to it's literal entities '&' and back. > * > * I wasn't aware of this problem at first but it's important to > understand why we do this. * At first you must know: > * a) PHP's XML parser *translates* all entities to the equivalent char > E.g. < is returned as '<' * b) PHP's XML parser (in V 4.1.0) has > problems with most *literal* entities! The only one's that are * > recognized are &, < > and ". *ALL* others (like > © a.s.o.) cause an * XML_ERROR_UNDEFINED_ENTITY error. I reported > this as bug at http://bugs.php.net/bug.php?id=15092 * (It turned out not > to be a 'real' bug, but one of those nice W3C-spec things). * > * Forget position b) now. It's just for info. Because the way we will > solve a) will also solve b) too. * > * THE PROBLEM > * To understand the problem, here a sample: > * Given is the following XML: "<AAA> < > </AAA>" > * Try to parse it and PHP's XML parser will fail with a > XML_ERROR_UNDEFINED_ENTITY becaus of * the unknown litteral-entity > ' '. (The numeric equivalent ' ' would work though). * Next try > is to use the numeric equivalent 160 for ' ', thus "<AAA> <   > > </AAA>" * The data we receive in the tag <AAA> is " < > ". So we > get the *translated entities* and * NOT the 3 entities <   >. > Thus, we will not even notice that there were entities at all! * In > *most* cases we're not able to tell if the data was given as entity or as > 'normal' char. * E.g. When receiving a quote or a single space were not > able to tell if it was given as 'normal' char * or as or ". > Thus we loose the entity-information of the XML-data! * > * THE SOLUTION > * The better solution is to keep the data 'as is' by replacing the '&' > before parsing begins. * E.g. Taking the original input from above, this > would result in "<AAA> &lt; &nbsp; &gt; </AAA>" * The data we > receive now for the tag <AAA> is " < > ". and that's what we > want. * > * The bad thing is, that a global replace will also replace data in > section that are NOT translated by the * PHP XML-parser. That is comments > (<!-- -->), IP-sections (stuff between <? ? >) and CDATA-block too. * So > all data comming from those sections must be reversed. This is done during > the XML parse phase. * So: > * a) Replacement of all '&' in the XML-source. > * b) All data that is not char-data or in CDATA-block have to be > reversed during the XML-parse phase. * > */ |
From: Nigel S. <nig...@us...> - 2002-05-24 02:15:22
|
> what context/baseXPath does this new feature of being able to use an > XPathquery in say getData use? Does it always use the evaluate default, i.e. > the root node? If so, you should be able to check on presence of / or [ > If present, then it's a query, if not, it's a nodename. (er, I think, or am I > getting confused? :-) The first thing we do is to check to see if the $xPathQuery is actually an absoluteXPath. If it is not then we call evaluate/match treating it as a query. See setModMatch() and _resolveXPathQuery() for more detailed documentation of how the class operates. > I think we need to move away from the concept of locale/charset. If you're > using ucs, a file, or for that matter node, can contain characters from any > number of different languages/locales, and has nothing to do with what locale > the machine/operating system works under. I agree. But using the built in \w is a whole lot better than explicitly listing european characters in the [] regex. Suggestions for what to do with that test would be welcomed. Bascially the test needs to capture a string that could feasibly be an XML element name. Here's the references to the specs: http://www.w3.org/TR/xpath#NT-NameTest http://www.w3.org/TR/REC-xml-names#NT-NCName http://www.w3.org/TR/REC-xml#NT-Letter Cheers Nigel |