Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tidying up XML

Status
Not open for further replies.

markSaunders

Programmer
Jun 23, 2000
196
GB
i have the following code in my ASP and it succesfully creates a file containing the desired elements and their contents.

any ideas as to how i can best have the code appear tidy as opposed to how it currently does (as shown at the bottom of this post)?

cheers

[tt]code excert[/tt]
Code:
  Set oDetailsNode = oEntryNode.appendChild(oDOM.createElement("COMMON"))
  oDetailsNode.Text = sCommon
  
  Set oDetailsNode = oEntryNode.appendChild(oDOM.createElement("MRP"))
  oDetailsNode.Text = sMRP

' Now save the XML document 
' - NOTE !
'     The directory to save it to must have write permissions enabled!
  oDOM.Save Server.MapPath("productList.xml")

[tt]example output[/tt]
Code:
<STOCKFILE><STOCK date=&quot;27/03/01 15:39:12&quot;><STKNO>ATTEMPT1</STKNO><DESC1>description number 1</DESC1><DESC2>description number 1</DESC2><DESC3></DESC3><DESC4></DESC4><DESC5></DESC5><UNITS>Dozen</UNITS><BIN></BIN><LOC>(None)</LOC><COMMON>Yes</COMMON><MRP>M</MRP></STOCK><STOCK date=&quot;27/03/01 15:41:40&quot;><STKNO>ATTEMPT2</STKNO><DESC1>description number 11</DESC1><DESC2>description number 11</DESC2><DESC3></DESC3><DESC4></DESC4><DESC5></DESC5><UNITS>single</UNITS><BIN></BIN><LOC>(None)</LOC><COMMON>No</COMMON><MRP>S</MRP></STOCK><STOCK date=&quot;27/03/01 15:43:15&quot;><STKNO>ATTEMPT2</STKNO><DESC1>description number 11</DESC1><DESC2>description number 11</DESC2><LDESC1>this will be the</LDESC1><LDESC2>longer description</LDESC2><LDESC3>lines for the </LDESC3><LDESC4>product number</LDESC4><LDESC5>indicated in ID</LDESC5><UNITS>single</UNITS><BIN></BIN><LOC>(None)</LOC><COMMON>No</COMMON><MRP>S</MRP></STOCK></STOCKFILE>
Mark Saunders :)
 
Mark -

XML usually prefers the &quot;Big String&quot; approach to formatting. It's only us humans who like to see it indented nicely!

Try loading it into XMLSpy or one of the other XML tools.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top