Writing FORMATTED XML to a file

Results 1 to 2 of 2

Thread: Writing FORMATTED XML to a file

  1. #1
    Join Date
    Dec 1969

    Default Writing FORMATTED XML to a file

    I just read the article about "Saving HTML Form Data to XML" <BR>by Michael Qualls, and I tried the examples on my web server.<BR><BR>On page 1, the MyXMLDoc.xml should come out like:<BR><BR>&#060;?xml version="1.0"?&#062;<BR>&#060;rootElement&#062;<BR > &#060;childElement1 /&#062;<BR> &#060;childElement2 /&#062;<BR>&#060;/rootElement&#062;<BR><BR>However, when I try it, it doesn&#039t come out formatted, I get:<BR><BR>&#060;?xml version="1.0"?&#062;<BR>&#060;rootElement&#062;&#0 60;childElement1/&#062;&#060;childElement2/&#062;&#060;/rootElement&#062;<BR><BR>I&#039ve done some other examples, and they come out with the<BR>entire XML tree dumped onto one line. Is there an easy way<BR>to get it to print out with formatting? (I&#039ve asked this<BR>question on the messageboards before, and never saw a response.)<BR><BR>I&#039ve done XML work before, but with Visual C++. All of their<BR>print functions do the same thing (dump it all to one long<BR>line), so I wrote my own that traverses the tree and prints<BR>each node, making it look all nice and pretty. I have noticed<BR>that when an XML file is read in VC++, the newlines and extra<BR>spaces for indentation are inserted into the tree as text<BR>nodes. When creating a tree from scratch, I&#039d really rather<BR>not have to insert and remove text nodes with newlines and<BR>indent spaces all over the place.<BR><BR>Thanks a bunch!<BR><BR>John<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Writing FORMATTED XML to a file

    Use XSL to transform your XML file to a readable XML file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts