xml question?

vs

No. The first example has the items as attributes of the Service node.

The second example is invalid XML. You could instead write it like this:

<Service> <Name>Service</Name> <ID>stage ID</ID> </Service>

I create an xml document from a string and perform additions / deletions / updates to the document…
When I’m done I need to export that document to disk as a formatted text file.

dim s as string = "<Server port=""80"" />" dim xmldoc as new XmlDocument(s) dim s a string DumpXml(xmldoc.firstChild, 0, s)
I needed to create a formatted text document from the xmldocument.
ToString works but the output is not readable by humans…

// There is something wrong with this code that probably has something to do with text attributes, but I can’ figure out what…

[code]Sub DumpXml(n as XmlNode, level as integer, byref s as String)
Dim xAtt As XmlAttribute
dim ts, ts1 as string // Tabs or spaces
dim i as integer

for i=0 to level-1
ts = ts + " " //chr(9)
next
ts1 = ts + " "

if n IsA XmlTextNode then
s = s + ts + trim(n.Value)
else

s = s + ts+"<"+trim(n.Name)+">" + EndOfLine.Unix

for i=0 to n.AttributeCount-1
  xAtt = n.GetAttributeNode(i)
  s = s + ts1 + trim(xAtt.Name) + "=" + chr(34) + trim(xAtt.Value) + chr(34) + EndOfLine.Unix
next

for i=0 to n.ChildCount-1
  DumpXml(n.Child(i), level+1, s)
next

s = s + ts + "</" + trim(n.Name) + ">" + EndOfLine.Unix   

end

End Sub[/code]

XmlDocument.Transform has an example of how to use XSL to format the XML:

http://documentation.xojo.com/index.php/XMLDocument.Transform

In what way is ToString not readable?