Re: XML Parse Error

From: Date: Sat, 22 Dec 2007 07:47:46 +0000
Subject: Re: XML Parse Error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-266223@lists.php.net to get a copy of this message
2007. 12. 21, péntek keltezéssel 10.12-kor VamVan ezt írta: > Hi All, > > Happy Christmas!!! > > Please see the code below: > > > $xml = ""; > $xml = '<?xml version="1.0" > encoding="UTF-8"?>'; > $xml .= '<request>'; > $xml .= '<emailAddress>'. > $this->xmlValueEncoding($post['Email']) .'</emailAddress>'; > $xml .= '<firstName>' . > $this->xmlValueEncoding($post['FirstName']) . '</firstName>'; > $xml .= '<lastName>' . > $this->xmlValueEncoding($post['LastName']) . '</lastName>'; > if (isset($post['Company']) && ($post['Company'] != > "")) > $xml .= '<company>' . > $this->xmlValueEncoding($post['Company']) .'</company>'; > if (isset($post['Title']) && ($post['Title'] != > "")) > $xml .= '<jobDesc>' . > $this->xmlValueEncoding($post['Title']) .'</jobDesc>'; > $xml .= '<password>' . > $this->xmlValueEncoding($post['Password']) . '</password>'; > if (isset($post['Address1']) && ($post['Address1'] != > "")) > $xml .= '<address1>' . > $this->xmlValueEncoding($post['Address1']) .'</address1>'; > if (isset($post['City']) && ($post['City'] != > "")) > $xml .= '<City>' . > $this->xmlValueEncoding($post['City']) > .'</City>'; > if (isset($post['State']) && ($post['State'] != > "")) > $xml .= '<State>' . > $this->xmlValueEncoding($post['State']) > .'</State>'; > if (isset($post['ZipCode']) && ($post['ZipCode'] != > "")) > $xml .= '<Zip>' . > $this->xmlValueEncoding($post['ZipCode']) > .'</Zip>'; > if (isset($post['Country']) && ($post['Country'] != > "")) > $xml .= '<ISOCountryCode>' . > $this->xmlValueEncoding($post['Country']) . '</ISOCountryCode>'; > if (isset($post['Phone']) && ($post['Phone'] != > "")) > $xml .= '<Phone>' . > $this->xmlValueEncoding($post['Phone']) > . '</Phone>'; > $xml .= '</request>'; > > function xmlValueEncoding($str) { > > return htmlspecialchars(trim($str), ENT_QUOTES, "UTF-8"); > > } > > I receive a XML parser errow when encoding the NON US Value like accent ` > etc. > > Can you please suggest me a solution? > > I am using SOAP to send these values to a webservice. I had the same problem with soap once, using htmlentities() on all the strings solved the issue greets Zoltán Németh > > Thanks, > Vamsee Vanaparthy

« previous php.general (#266223) next »