C
CindyH
Hi
I'm using the following code to create xml string:
Dim Doc As New System.Xml.XmlDocument
Dim newAtt As System.Xml.XmlAttribute
Dim dec As System.Xml.XmlDeclaration
dec = Doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
dec.Encoding = "UTF-8"
Doc.AppendChild(dec)
Dim DocRoot As System.Xml.XmlElement = Doc.CreateElement("userlist")
newAtt = Doc.CreateAttribute("ACTION")
newAtt.Value = vAction
DocRoot.Attributes.Append(newAtt)
newAtt = Doc.CreateAttribute("VENDORNAME")
newAtt.Value = vVendorName
DocRoot.Attributes.Append(newAtt)
Doc.AppendChild(DocRoot)
Dim amouser As System.Xml.XmlNode = Doc.CreateElement("amouser")
newAtt = Doc.CreateAttribute("AMOAID")
newAtt.Value = vAMOAID
amouser.Attributes.Append(newAtt)
newAtt = Doc.CreateAttribute("VENDORUSERNAME")
newAtt.Value = vH2UserName
amouser.Attributes.Append(newAtt)
newAtt = Doc.CreateAttribute("AMOATOKEN")
newAtt.Value = vAMOAToken
amouser.Attributes.Append(newAtt)
DocRoot.AppendChild(amouser)
Dim xmlstring = Doc.OuterXml
The result looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<userlist ACTION="redirectuser" VENDORNAME="H2Digital">
<amouser AMOAID="bb224c2a-fe8a-4c3f-acf4-6c0986b8cf78"
VENDORUSERNAME="(e-mail address removed)"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" />
</userlist>
I need the result to look like this: with </amouser> instead of />
<?xml version="1.0" encoding="UTF-8"?>
<userlist ACTION="redirectuser" VENDORNAME="H2Digital">
<amouser AMOAID="bb224c2a-fe8a-4c3f-acf4-6c0986b8cf78"
VENDORUSERNAME="(e-mail address removed)"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" </amouser>
</userlist>
Does anyone know what I'm doing wrong here?
Thanks,
Cindy
I'm using the following code to create xml string:
Dim Doc As New System.Xml.XmlDocument
Dim newAtt As System.Xml.XmlAttribute
Dim dec As System.Xml.XmlDeclaration
dec = Doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
dec.Encoding = "UTF-8"
Doc.AppendChild(dec)
Dim DocRoot As System.Xml.XmlElement = Doc.CreateElement("userlist")
newAtt = Doc.CreateAttribute("ACTION")
newAtt.Value = vAction
DocRoot.Attributes.Append(newAtt)
newAtt = Doc.CreateAttribute("VENDORNAME")
newAtt.Value = vVendorName
DocRoot.Attributes.Append(newAtt)
Doc.AppendChild(DocRoot)
Dim amouser As System.Xml.XmlNode = Doc.CreateElement("amouser")
newAtt = Doc.CreateAttribute("AMOAID")
newAtt.Value = vAMOAID
amouser.Attributes.Append(newAtt)
newAtt = Doc.CreateAttribute("VENDORUSERNAME")
newAtt.Value = vH2UserName
amouser.Attributes.Append(newAtt)
newAtt = Doc.CreateAttribute("AMOATOKEN")
newAtt.Value = vAMOAToken
amouser.Attributes.Append(newAtt)
DocRoot.AppendChild(amouser)
Dim xmlstring = Doc.OuterXml
The result looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<userlist ACTION="redirectuser" VENDORNAME="H2Digital">
<amouser AMOAID="bb224c2a-fe8a-4c3f-acf4-6c0986b8cf78"
VENDORUSERNAME="(e-mail address removed)"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" />
</userlist>
I need the result to look like this: with </amouser> instead of />
<?xml version="1.0" encoding="UTF-8"?>
<userlist ACTION="redirectuser" VENDORNAME="H2Digital">
<amouser AMOAID="bb224c2a-fe8a-4c3f-acf4-6c0986b8cf78"
VENDORUSERNAME="(e-mail address removed)"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" </amouser>
</userlist>
Does anyone know what I'm doing wrong here?
Thanks,
Cindy