XML Parse Error
| From: | VamVan | Date: | Fri, 21 Dec 2007 18:12:13 +0000 |
| Subject: | XML Parse Error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-266214@lists.php.net to get a copy of this message | ||
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.
Thanks,
Vamsee Vanaparthy