473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

xml format problem

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="xr*****@hotmail.com"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" />
</userlist>
I need the result to look like this: with </amouserinstead of />

<?xml version="1.0" encoding="UTF-8"?>
<userlist ACTION="redirectuser" VENDORNAME="H2Digital">
<amouser AMOAID="bb224c2a-fe8a-4c3f-acf4-6c0986b8cf78"
VENDORUSERNAME="xr*****@hotmail.com"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" </amouser>
</userlist>

Does anyone know what I'm doing wrong here?
Thanks,
Cindy
Jun 27 '08 #1
2 966

"CindyH" <ch*******@new.rr.comkirjoitti viestissä
news:e2**************@TK2MSFTNGP03.phx.gbl...
I need the result to look like this: with </amouserinstead of />

<?xml version="1.0" encoding="UTF-8"?>
<userlist ACTION="redirectuser" VENDORNAME="H2Digital">
<amouser AMOAID="bb224c2a-fe8a-4c3f-acf4-6c0986b8cf78"
VENDORUSERNAME="xr*****@hotmail.com"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" </amouser>
</userlist>
This example is not valid XML. Maybe there is just missing character
before </amouser>?
amouser.Attributes.Append(newAtt)
If the character was just accidentally forgotten, try to add this code above
that line I quoted:

amouser.InnerText = ""

-Teemu

Jun 27 '08 #2
opps - ok thanks.
"Teemu" <ts*****@hotmail.comwrote in message
news:bt*****************@reader1.news.saunalahti.f i...
>
"CindyH" <ch*******@new.rr.comkirjoitti viestissä
news:e2**************@TK2MSFTNGP03.phx.gbl...
>I need the result to look like this: with </amouserinstead of />

<?xml version="1.0" encoding="UTF-8"?>
<userlist ACTION="redirectuser" VENDORNAME="H2Digital">
<amouser AMOAID="bb224c2a-fe8a-4c3f-acf4-6c0986b8cf78"
VENDORUSERNAME="xr*****@hotmail.com"
AMOATOKEN="hx0gH6e8PvswEzaA8oXPoVIY/KvnbP2/" </amouser>
</userlist>

This example is not valid XML. Maybe there is just missing character
before </amouser>?
>amouser.Attributes.Append(newAtt)

If the character was just accidentally forgotten, try to add this code
above that line I quoted:

amouser.InnerText = ""

-Teemu

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bernd Lambertz | last post by:
I have a problem with bcp and format files. We changed our databases from varchar to nvarchar to support unicode. No problems so fare with that. It is working fine. But now I need a format...
2
by: amith | last post by:
hi I have written javascript for comparing two dates in US format and finding out whether the start date is greater than the end date and vice versa. In this attempt i have instantiated the...
1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
8
by: Ishbel Kargar | last post by:
Since upgrading from old laptop (Windows 98) to new laptop (Windows XP), my mail-merge letters are doing strange things with date formats. For instance, my reminder letter for lapsed subs carries...
1
by: Wayne Aprato | last post by:
I have a client who is running several Access 97 databases that I have written for them. They are about to upgrade to Access 2003. Is the default file format of Access 2003 still Access 2000 the...
5
by: Ataru Morooka | last post by:
Hi, my table has to have a column with the months names (january, february...). When I order it by month it is ordered alphabetically and that's not what I need. Reading this ng I found someone...
2
by: Pat | last post by:
Here is my problem that I am having with a current project. I went and backed up all my hard drives to DVD's. After backing up the drives, I used a batch file to get all the file names from the...
9
by: insomniux | last post by:
Hi, I am having a problem with formatting the default value of a date field. It has been discussed earlier in many topics, but still I cannot solve the problem. What's happening: I have various...
3
by: karthikla | last post by:
Hi Experts, Could you please help me on how to get access 2002 file format exactly while doing conversion from Access 97 file format by DBEngine.CompactDatabase() function? Code: Private...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.