Re: [PHP] trouble parsing an XML document
hi, Sven wrote: take a look at http://www.php.net/manual/language.variables.php: A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. so, a minus isn't allowed in varnames! hth SVEN I agree with you but let me say the problem: I'm parsing some XML documents, I'm not the writer of them and of DTD, who wrote them used some tags like: REG-ORIG This is allowed in XML, but when I initialise varibles I need to use the same name of tags(also respect Case-sensitiveness). This is a big compatibility problem, how can I do? I cannot change all the XML docs and the DTD. bye Alfredo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
Alfredo schrieb: hi, Sven wrote: take a look at http://www.php.net/manual/language.variables.php: A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. so, a minus isn't allowed in varnames! hth SVEN I agree with you but let me say the problem: I'm parsing some XML documents, I'm not the writer of them and of DTD, who wrote them used some tags like: REG-ORIG This is allowed in XML, but when I initialise varibles I need to use the same name of tags(also respect Case-sensitiveness). This is a big compatibility problem, how can I do? I cannot change all the XML docs and the DTD. bye Alfredo hi alfredo, maybe you can workaround with arrays? for keys you can use any string. so $xml['REG-ORIG'] is valid in php. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
Sven wrote: hi alfredo, maybe you can workaround with arrays? for keys you can use any string. so $xml['REG-ORIG'] is valid in php. I'm not so expert with XML parsing, I just took examples from PHP manual..thanks ciao alfredo hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
thank you, but the error: Parse error: parse error, unexpected '$', expecting T_VARIABLE in (mypath)...on line... refers to the line whit the var ${'REG-ORIG'}; code, anyway I took the code by the PHP manual. bye Alfredo Raditha Dissanayake wrote: doesn't look like a xml parser problem. I haven't tried your code but i think the error is $this-$k alfredo wrote: Hello, I'm trying to parse a XML doc, but the doc has some tags like: REG-ORIG so when I try to initialize variables: class Documenti { var $FILE; //nomefile var $NUMERO; //numerodiserie var ${'REG-OR;IG'}; // here is the broblem function Documenti($aa) { foreach ($aa as $k=$v) $this-$k = $aa[$k]; } i have an error: Parse error: parse error, unexpected '$', expecting T_VARIABLE... I tryed changing the $ position: var {$'REG-ORIG'}; // here is the broblem does not change anything: Parse error: parse error, unexpected '{', expecting T_VARIABLE... thanks for any suggestion, Alfredo (Italy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
hi, Raditha Dissanayake schrieb: doesn't look like a xml parser problem. I haven't tried your code but i think the error is $this-$k no, why not a variable method depending on $k? alfredo wrote: Hello, I'm trying to parse a XML doc, but the doc has some tags like: REG-ORIG so when I try to initialize variables: class Documenti { var $FILE; //nomefile var $NUMERO; //numerodiserie var ${'REG-ORIG'}; // here is the broblem take a look at http://www.php.net/manual/language.variables.php: A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. so, a minus isn't allowed in varnames! hth SVEN function Documenti($aa) { foreach ($aa as $k=$v) $this-$k = $aa[$k]; } i have an error: Parse error: parse error, unexpected '$', expecting T_VARIABLE... I tryed changing the $ position: var {$'REG-ORIG'}; // here is the broblem does not change anything: Parse error: parse error, unexpected '{', expecting T_VARIABLE... thanks for any suggestion, Alfredo (Italy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trouble parsing an XML document
Hello, I'm trying to parse a XML doc, but the doc has some tags like: REG-ORIG so when I try to initialize variables: class Documenti { var $FILE; //nomefile var $NUMERO; //numerodiserie var ${'REG-ORIG'}; // here is the broblem function Documenti($aa) { foreach ($aa as $k=$v) $this-$k = $aa[$k]; } i have an error: Parse error: parse error, unexpected '$', expecting T_VARIABLE... I tryed changing the $ position: var {$'REG-ORIG'}; // here is the broblem does not change anything: Parse error: parse error, unexpected '{', expecting T_VARIABLE... thanks for any suggestion, Alfredo (Italy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
doesn't look like a xml parser problem. I haven't tried your code but i think the error is $this-$k alfredo wrote: Hello, I'm trying to parse a XML doc, but the doc has some tags like: REG-ORIG so when I try to initialize variables: class Documenti { var $FILE; //nomefile var $NUMERO; //numerodiserie var ${'REG-ORIG'}; // here is the broblem function Documenti($aa) { foreach ($aa as $k=$v) $this-$k = $aa[$k]; } i have an error: Parse error: parse error, unexpected '$', expecting T_VARIABLE... I tryed changing the $ position: var {$'REG-ORIG'}; // here is the broblem does not change anything: Parse error: parse error, unexpected '{', expecting T_VARIABLE... thanks for any suggestion, Alfredo (Italy) -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php