Why is the XML output is encoded?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is our effort, to produce an xml file from an html content that 
we parse.  How can I stop PHP from encoding my html tags into &lts 
and $gts?

To explain what we get now and what is desired, I am provided a 
color-coded snippets of the xml files. The PHP code is also provided 
for your critical eyes.

 
Thank you for your help in advance.
 

<pre >

<!â?"Bad form -->

<ProBody>

&lt;unsortedlist&gt;
&lt;list&gt;
&lt;anchor href="../news/pr_2005/rm_printing.html"&gt;Rocky Mountain 
icecream Strengthens Short Run code Capabilities With my station 
Nexress Optima Solution&lt;/anchor&gt;

&lt;/list&gt;&lt;list&gt;&lt;anchor 
href="../news/pr_2005/cmm.html"&gt;wish to see this item 
clear&lt;/anchor&gt;&lt;/list&gt;&lt;list&gt;&lt;anchor 
href="../news/pr_2005/print1.html"&gt;same text goes here but not 
showing 5634 DI System&lt;/anchor&gt;&lt;/list&gt;&lt;list&gt;

</ProBody>

 

<!â?"Desired form-->

<ProBody>

  <list>
  <anchor>Repeat some stuff here.</anchor>
</list>
  <list>
  <anchor>Some Anchor text goes here</anchor>
</list>
  <list>
  <anchor>PRINT1 DIRECT Saves Time, Reduces Waste With KPG 
DirectPress 5634 DI System</anchor>
</list>

</ProBody>
</pre>

The code that produces the bad form is provided for your comments.

<code>
// Creates an instance of the DOMImplementation class
$imp = new DOMImplementation;
//          Creates a DOMDocumentType instance
$DocTDT = $this->m_pageType;
$dtd = $imp->createDocumentType($DocTDT, '', $DocTDT . '.dtd');
// Creates a DOMDocument instance
$doc = $imp->createDocument("", "", $dtd);
// Set other properties
$doc->encoding = $this->xmlencoding;
if(trim($this->xmlstandalone) == 'true')
            $doc->standalone = true;
else
            $doc->standalone = false;
// we want a nice output
if($this->xmlformatOutput == 'true')
            $doc->formatOutput = true;
else
            $doc->formatOutput = false;
$root = $doc->createElement($this->xmlDocRoot);
// create titleNode with text
$titleNode = $doc->createElement($this->xmlTitle);
$titleNode = $root->appendChild($titleNode);
$titleNodeText = $doc->createTextNode($this->productTitle);
$titleNodeText = $titleNode->appendChild($titleNodeText);
//          -- end of element 
// Start Body Parsing
$this->RFText = getConverted2ClientTags($RFText);
echo "\nConverted html tags to Client tags (i.e <td> to <cell>: " , 
$this->RFText;
echo "\n";
// end Body Parsing
// create ProdBody with text
$bodyNode = $doc->createElement($this->xmlProdBody);
$bodyNode = $root->appendChild($bodyNode);
$bodyNodeText = $doc->createTextNode($this->RFText);
$bodyNodeText = $bodyNode->appendChild($bodyNodeText);
//          -- end of element 
$root = $doc->appendChild($root);
// if directory does not exist, create it. 
$this->mkdirr($this->m_outDir, '0777');
$this->m_outFile = $this->m_outDir. '/' .$this->m_outFile;
echo "\nWrote $this->m_outFile: " . $doc->save($this->m_outFile) . ' 
bytes' ."\n";

</code>









PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux