• I removed the www from the URL, please update your bookmarks and pay attention to the bottom of the screen if using Google Chrome to allow push notifications again.

Cannot close an element

nadakhou

New member
Joined
Sep 13, 2017
Messages
2
Programming Experience
3-5
Dear Sir,
I am reading from a databse to fill an xml file,here is the code and the results
my problem is that i am not beeing able to close the element "address"
what is missing in my code?any help? thanks in advance


' Loop over employees in array.
For Each dataRow1 As DataRow In dt1.Rows
writer.WriteStartElement("applications")
writer.WriteStartElement("application")
writer.WriteAttributeString("createdBy", "CTL Card Tech Services Ltd(Cyprus)")

writer.WriteStartElement("customer")
writer.WriteAttributeString("name", dataRow1("GNP27NAM"))
writer.WriteAttributeString("templateCode", dataRow1("GNP27TCD"))
writer.WriteAttributeString("number", dataRow1("GNP27CUI"))

writer.WriteStartElement("addresses")
writer.WriteStartElement("address")
writer.WriteAttributeString("addressType", dataRow1("GNP27ATP"))
writer.WriteAttributeString("location", dataRow1("GNP27LOC"))
writer.WriteAttributeString("lastName", dataRow1("GNP27LNM"))
writer.WriteAttributeString("firstName", dataRow1("GNP27FNM"))
writer.WriteAttributeString("address1", dataRow1("GNP27AD1"))
writer.WriteAttributeString("address2", dataRow1("GNP27AD2"))
writer.WriteAttributeString("zip", dataRow1("GNP27ZIP"))
writer.WriteAttributeString("state", dataRow1("GNP27STT"))
writer.WriteAttributeString("city", dataRow1("GNP27CTY"))
writer.WriteAttributeString("country", dataRow1("GNP27CNT"))
writer.WriteAttributeString("title", dataRow1("GNP27TTL"))

Next
writer.WriteEndElement()
writer.WriteEndDocument()


xml result :


<?xml version="1.0" encoding="UTF-8"?>
<bridge xmlns="[url]http://CTL.COM.SERVICES.BRIDGE.DataEntities">[/URL]
<applications>
<application createdBy="CTL Card Tech Services Ltd(Cyprus)">
<customer number="368266 " templateCode="CCU1 " name="Khoury">
<addresses>
<address title="MLE" country=" " city=" " state=" " zip=" " address2="AL BIARA " address1="GERANIUM " firstName="NADA " lastName="KHOURY " location=" " addressType="TT "/></addresses>
</customer>
</application>


<people id=" "/></applications></bridge>
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,277
Location
Norway
Programming Experience
10+
They are both closed, can't you see the forward slash before end bracket?
 
Top Bottom