473,387 Members | 1,465 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,387 software developers and data experts.

XMLDocument appendChild delema

Hi,
I have a an xmldocument that creates an entry but with a xmlns="" attached, And because I have a validating schema it fails on this node.

code is as follows

Dim oEmailNode As XmlElement = coGLobalXMLDoc.CreateElement("Email")
' add attributes to the node
oEmailNode.SetAttribute("DisplayName", oEmail.DisplayName)
oEmailNode.SetAttribute("to", oEmail.EmailTo)
oEmailNode.SetAttribute("subject", oEmail.Subject)
oEmailNode.SetAttribute("body", oEmail.Body)
oEmailNode.SetAttribute("enabled", clbGlobalEmails.GetItemChecked(i).ToString.ToLower )

'add node to xml document
xmlNode.AppendChild(oEmailNode)

coGLobalXMLDoc.Save(Path & "\XXXXXXXX.xml")

I should see this
<Email DisplayName="XXXXXX" to="XXXX.XXXXX@XXXX.XXX" subject="XXXXXX" body="test" enabled="true" />

but i get this
<Email DisplayName="XXXXXX" to="XXXX.XXXXX@XXXX.XXX" subject="XXXXX" body="test" enabled="true" xmlns="" />

I have tried removing the xmlns attribute after the append but that doesn't work.

What do I need to do to stop this from being put in.

Cheers :confused:
Feb 21 '06 #1
1 4952
For those who may have the smae problem

I created a node with out a namesapce and this by default adds xmls="" to the node as it doesn't have a name space.

I Changed
Dim oEmailNode As XmlElement = coGLobalXMLDoc.CreateElement("Email")

to be
Dim oEmailNode As XmlElement = coGLobalXMLDoc.CreateElement("Email", "XXXXXXX")

"XXXXXXX" being the namespace given in the rootNode xmlns:="XXXXXX"

this generates the node without it's own blank xmlns of xmlns=""

:D
Feb 21 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Mark | last post by:
Hi... A colleague just referred this question to me. He's getting an xml file from another party, which he's trying to process into another dom using an XmlTextReader and...
1
by: Casper JH Erasmus | last post by:
How do I save the contents of a TreeView to a XML Document?
1
by: Peter Nofelt | last post by:
Hey All, I'm running into this issue with parsing through an xml document by tag name. Below is an example xml document: File Name: things.xml <things> <people> <name>Peter</name>
4
by: Jesper Stocholm | last post by:
I have a database class that maintains data about customers i my system. The basic XML for this looks like: <Chunk> <Vendor> <Database/> </Vendor> </Chunk> When a user is to be registrered...
1
by: David | last post by:
I need to find a good online resource which teaches the use of the XmlDocument framework in more depth than is covered in MS's online doc. I need to create a multi-level XML document like the one...
4
by: aaa | last post by:
Can someone show me a snippet that creates a very simple XML doc with either a root and chilc nodes or root child nodes, and attributes. I have looked all around and every example I try I get an...
3
by: Mungo Jerrie | last post by:
Hi there :-) I have some problems with the same instance of my xmldocument across 3 different classes. See code below: class one { protected static XmlDocument doc = new XmlDocument(); ...
3
by: CodeRazor | last post by:
Hello, Simple question this one. How can I manually build a simple xmldocument in code. Lets say for example <Products> <Boat id="1"> <Price>9000</Price> </Boat>
3
by: Andy Fish | last post by:
Hi, I am creating a new XmlDocument from scratch, but I can't see how I can make a namespace declaration and associate a prefix with it. For instance in the following example: XmlDocument doc...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.