XML “view source” in browser all on one line

badk0re

New Member
I'm using PHP to create an XML file. The structure of the XML is correct but when I select "View Source" from within a browser all of the code is output on a single line. I have an error I'm trying to debug and it's pointing me the line of code (line 2) however that's not as helpful as if it were on multiple lines of code. I'm pulling data from a database and while the code works on a limited test scale, it is giving me an error when using all of the data.Error:\[quote\]\[code\]DOMDocument::schemaValidate() Generated Errors!Fatal Error 68: xmlParseEntityRef: no name in (/home2/path...)"\[/code\]\[/quote\]The below is the beginning of the PHP I am using to create the XML...\[code\]<?php/* create a dom document with encoding utf8 */$domtree = new DOMDocument('1.0', 'UTF-8');/* create the root element of the xml tree */$xmlRoot = $domtree->createElement('BatchDataSet');/* append it to the document created */$xmlRoot = $domtree->appendChild($xmlRoot);$xmlRoot->setAttribute("SchemaVersion","1.0");$xmlRoot->setAttribute("Quarter","2");$xmlRoot->setAttribute("Year","2012");// INSURER INFO: A INSURANCE$insurer = $domtree->createElement("Insurer");$insurer = $xmlRoot->appendChild($insurer);$insurer->appendChild($domtree->createElement('NAICNumber','12345'));$insurer->appendChild($domtree->createElement('Name','Example'));$contact = $domtree->createElement("Contact");$contact = $insurer->appendChild($contact);$contact->appendChild($domtree->createElement('FirstName', 'Kim'));$contact->appendChild($domtree->createElement('LastName','Smith'));$contact->appendChild($domtree->createElement('EmailAddress','[email protected]')); ......................\[/code\]
 
Back
Top