Menu
Home
Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Database
XML
Cannot close an element
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="nadakhou" data-source="post: 180182" data-attributes="member: 55033"><p>Dear Sir,</p><p>I am reading from a databse to fill an xml file,here is the code and the results</p><p>my problem is that i am not beeing able to close the element "<span style="color: #990000">address"</span> </p><p>what is missing in my code?any help? thanks in advance</p><p></p><p></p><p> ' Loop over employees in array.</p><p> For Each dataRow1 As DataRow In dt1.Rows</p><p> writer.WriteStartElement("applications")</p><p> writer.WriteStartElement("application")</p><p> writer.WriteAttributeString("createdBy", "CTL Card Tech Services Ltd(Cyprus)")</p><p> </p><p> writer.WriteStartElement("customer")</p><p> writer.WriteAttributeString("name", dataRow1("GNP27NAM"))</p><p> writer.WriteAttributeString("templateCode", dataRow1("GNP27TCD"))</p><p> writer.WriteAttributeString("number", dataRow1("GNP27CUI"))</p><p> </p><p> writer.WriteStartElement("addresses")</p><p> writer.WriteStartElement("address")</p><p> writer.WriteAttributeString("addressType", dataRow1("GNP27ATP"))</p><p> writer.WriteAttributeString("location", dataRow1("GNP27LOC"))</p><p> writer.WriteAttributeString("lastName", dataRow1("GNP27LNM"))</p><p> writer.WriteAttributeString("firstName", dataRow1("GNP27FNM"))</p><p> writer.WriteAttributeString("address1", dataRow1("GNP27AD1"))</p><p> writer.WriteAttributeString("address2", dataRow1("GNP27AD2"))</p><p> writer.WriteAttributeString("zip", dataRow1("GNP27ZIP"))</p><p> writer.WriteAttributeString("state", dataRow1("GNP27STT"))</p><p> writer.WriteAttributeString("city", dataRow1("GNP27CTY"))</p><p> writer.WriteAttributeString("country", dataRow1("GNP27CNT"))</p><p> writer.WriteAttributeString("title", dataRow1("GNP27TTL"))</p><p></p><p>Next</p><p> writer.WriteEndElement()</p><p> writer.WriteEndDocument()</p><p></p><p></p><p>xml result :</p><p></p><p></p><p><span style="color: blue"><?xml version="1.0" encoding="UTF-8"?></span></p><p><a href="http://file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"><<span style="color: #990000">bridge</span> <span style="color: red">xmlns</span>="<span style="color: red"><strong>[url]http://CTL.COM.SERVICES.BRIDGE.DataEntities</strong></span></a>">[/URL]</p><p><a href="http://file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"><<span style="color: #990000">applications</span>></a></p><p><a href="http://file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"><<span style="color: #990000">application</span> <span style="color: #990000">createdBy</span>="<span style="color: black"><strong>CTL Card Tech Services Ltd(Cyprus)</strong></span>"></a></p><p><a href="http://file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"><<span style="color: #990000">customer</span> <span style="color: #990000">number</span>="<span style="color: black"><strong>368266 </strong></span>" <span style="color: #990000">templateCode</span>="<span style="color: black"><strong>CCU1 </strong></span>" <span style="color: #990000">name</span>="<span style="color: black"><strong>Khoury</strong></span>"></a></p><p><a href="http://file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"><<span style="color: #990000">addresses</span>></a></p><p><<span style="color: #990000">address</span> <span style="color: #990000">title</span>="<span style="color: black"><strong>MLE</strong></span>" <span style="color: #990000">country</span>="<span style="color: black"><strong> </strong></span>" <span style="color: #990000">city</span>="<span style="color: black"><strong> </strong></span>" <span style="color: #990000">state</span>="<span style="color: black"><strong> </strong></span>" <span style="color: #990000">zip</span>="<span style="color: black"><strong> </strong></span>" <span style="color: #990000">address2</span>="<span style="color: black"><strong>AL BIARA </strong></span>" <span style="color: #990000">address1</span>="<span style="color: black"><strong>GERANIUM </strong></span>" <span style="color: #990000">firstName</span>="<span style="color: black"><strong>NADA </strong></span>" <span style="color: #990000">lastName</span>="<span style="color: black"><strong>KHOURY </strong></span>" <span style="color: #990000">location</span>="<span style="color: black"><strong> </strong></span>" <span style="color: #990000">addressType</span>="<span style="color: black"><strong>TT </strong></span>"/><span style="color: blue"></<span style="color: #990000">addresses</span>></span></p><p><span style="color: blue"></<span style="color: #990000">customer</span>></span></p><p><span style="color: blue"></<span style="color: #990000">application</span>></span></p><p></p><p></p><p><<span style="color: #990000">people</span> <span style="color: #990000">id</span>=" "/><span style="color: blue"></<span style="color: #990000">applications</span>></span><span style="color: blue"></<span style="color: #990000">bridge</span>></span></p></blockquote><p></p>
[QUOTE="nadakhou, post: 180182, member: 55033"] 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 "[COLOR=#990000]address"[/COLOR][COLOR=#0000ff] [/COLOR][COLOR=#990000][/COLOR] 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 : [COLOR=blue]<?xml version="1.0" encoding="UTF-8"?>[/COLOR] [URL="file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"]<[COLOR=#990000]bridge[/COLOR] [COLOR=red]xmlns[/COLOR]="[COLOR=red][B][url]http://CTL.COM.SERVICES.BRIDGE.DataEntities[/B][/COLOR][/url][COLOR=red][B][/B][/COLOR]">[/URL] [URL="file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"]<[COLOR=#990000]applications[/COLOR]>[/URL] [URL="file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"]<[COLOR=#990000]application[/COLOR] [COLOR=#990000]createdBy[/COLOR]="[COLOR=black][B]CTL Card Tech Services Ltd(Cyprus)[/B][/COLOR]">[/URL] [URL="file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"]<[COLOR=#990000]customer[/COLOR] [COLOR=#990000]number[/COLOR]="[COLOR=black][B]368266 [/B][/COLOR]" [COLOR=#990000]templateCode[/COLOR]="[COLOR=black][B]CCU1 [/B][/COLOR]" [COLOR=#990000]name[/COLOR]="[COLOR=black][B]Khoury[/B][/COLOR]">[/URL] [URL="file:///C:/Users/NKHOURY/Documents/Cards_Bridge.xml#"]<[COLOR=#990000]addresses[/COLOR]>[/URL] <[COLOR=#990000]address[/COLOR] [COLOR=#990000]title[/COLOR]="[COLOR=black][B]MLE[/B][/COLOR]" [COLOR=#990000]country[/COLOR]="[COLOR=black][B] [/B][/COLOR]" [COLOR=#990000]city[/COLOR]="[COLOR=black][B] [/B][/COLOR]" [COLOR=#990000]state[/COLOR]="[COLOR=black][B] [/B][/COLOR]" [COLOR=#990000]zip[/COLOR]="[COLOR=black][B] [/B][/COLOR]" [COLOR=#990000]address2[/COLOR]="[COLOR=black][B]AL BIARA [/B][/COLOR]" [COLOR=#990000]address1[/COLOR]="[COLOR=black][B]GERANIUM [/B][/COLOR]" [COLOR=#990000]firstName[/COLOR]="[COLOR=black][B]NADA [/B][/COLOR]" [COLOR=#990000]lastName[/COLOR]="[COLOR=black][B]KHOURY [/B][/COLOR]" [COLOR=#990000]location[/COLOR]="[COLOR=black][B] [/B][/COLOR]" [COLOR=#990000]addressType[/COLOR]="[COLOR=black][B]TT [/B][/COLOR]"/>[COLOR=blue]</[COLOR=#990000]addresses[/COLOR]>[/COLOR] [COLOR=blue]</[COLOR=#990000]customer[/COLOR]>[/COLOR] [COLOR=blue]</[COLOR=#990000]application[/COLOR]>[/COLOR] <[COLOR=#990000]people[/COLOR] [COLOR=#990000]id[/COLOR]="[COLOR=black][B] [/B][/COLOR]"/>[COLOR=blue]</[COLOR=#990000]applications[/COLOR]>[/COLOR][COLOR=blue]</[COLOR=#990000]bridge[/COLOR]>[/COLOR] [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
Database
XML
Cannot close an element
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom