Hi All, I am trying to write out the following:
<environments>
<environment name="CB001" description="cluster build 001">
<envvariable name="ROLE.CLUSTERNODE1">GB8644TD3T</envvariable>
</environment>
</environments>
using the XmlTextReader
this is fine:
xmlTextWriter.WriteStartElement("environments")
xmlTextWriter.WriteStartElement("environment")
xmlTextWriter.WriteAttributeString("name", strEnvironmentName)
xmlTextWriter.WriteAttributeString("description", strEnvironmentName & " build")
but i get stuck with the element string entry
'this doesnt allow to assign a element value, or at least i cant figure out how to
xmlTextWriter.WriteStartElement("envvariable")
xmlTextWriter.WriteAttributeString("name", "ROLE.CLUSTERNODE")
'this errors when trying to set an AttributeString
xmlTextWriter.WriteElementString("envvariable", "GB8644TD3T")
xmlTextWriter.WriteAttributeString("name", "ROLE.CLUSTERNODE")
I can write it out using WriteRaw but i figure it is cheating (and seems to stuff up my EndElement indenting
'xmlTextWriter.WriteRaw(vbCrLf)
'xmlTextWriter.WriteRaw(" <envvariable name=" & Chr(34) & "MS.HELLO1" & Chr(34) & ">" & "testXXX" & "</envvariable>")
'xmlTextWriter.WriteRaw(vbCrLf)
<environments>
<environment name="CB001" description="cluster build 001">
<envvariable name="ROLE.CLUSTERNODE1">GB8644TD3T</envvariable>
</environment>
</environments>
using the XmlTextReader
this is fine:
xmlTextWriter.WriteStartElement("environments")
xmlTextWriter.WriteStartElement("environment")
xmlTextWriter.WriteAttributeString("name", strEnvironmentName)
xmlTextWriter.WriteAttributeString("description", strEnvironmentName & " build")
but i get stuck with the element string entry
'this doesnt allow to assign a element value, or at least i cant figure out how to
xmlTextWriter.WriteStartElement("envvariable")
xmlTextWriter.WriteAttributeString("name", "ROLE.CLUSTERNODE")
'this errors when trying to set an AttributeString
xmlTextWriter.WriteElementString("envvariable", "GB8644TD3T")
xmlTextWriter.WriteAttributeString("name", "ROLE.CLUSTERNODE")
I can write it out using WriteRaw but i figure it is cheating (and seems to stuff up my EndElement indenting
'xmlTextWriter.WriteRaw(vbCrLf)
'xmlTextWriter.WriteRaw(" <envvariable name=" & Chr(34) & "MS.HELLO1" & Chr(34) & ">" & "testXXX" & "</envvariable>")
'xmlTextWriter.WriteRaw(vbCrLf)