473,653 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a XML Document with asp.net 2.0

How can i create a XMLDocument??

This is what i have:

Dim objNode As XmlNode

Dim objAttrib As XmlAttribute
objNode = objXML.Document Element("Person ")

objAttrib = objXML.CreateAt tribute("PERSON ID")
objAttrib.Value = "p7"
objNode.Attribu tes.SetNamedIte m(objAttrib)
objXML.Document Element.AppendC hild(objNode)

Then i get an error like this:

System.NullRefe renceException: Object reference not set to an instance
of an object.

Can somebody help me out?

Aug 21 '06 #1
3 4815


Dikkuuhh wrote:
How can i create a XMLDocument??
Dim xmlDoc As New System.Xml.XmlD ocument()

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 21 '06 #2
Now this is my code:

Dim objXML As New System.Xml.XmlD ocument()
Dim objNode As XmlNode
Dim objAttrib As XmlAttribute
objNode = objXML.Document Element("Person ")

objAttrib = objXML.CreateAt tribute("PERSON ID")
objAttrib.Value = "p7"
objNode.Attribu tes.SetNamedIte m(objAttrib)
objXML.Document Element.AppendC hild(objNode)

But i`m still getting the same error....
Martin Honnen wrote:
Dikkuuhh wrote:
How can i create a XMLDocument??

Dim xmlDoc As New System.Xml.XmlD ocument()

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 22 '06 #3


Dikkuuhh wrote:

Dim objXML As New System.Xml.XmlD ocument()
This line creates the XmlDocument instance but it is empty, you can
either load existing XML into it with the Load method to load from a URL
or stream (or the LoadXml method if you have a string with the XML
markup) or you need to populate the document with nodes by first
creating them and inserting them as needed e.g. (watch out for line
breaks VB does not allow but the news posting might have)

Dim rootElement As XmlElement =
objXML.CreateEl ement("some-element-name")
Dim someElement as XmlElement =
objXML.CreateEl ement("another-element-name")
someElement.Set Attribute("attr ibute-name", "attribute value")
rootElement.App endChild(someEl ement)
objXML.AppendCh ild(rootElement )

objXML.Save("fi le.xml")

If you still have problems then I suggest microsoft.publi c.dotnet.xml is
a better place than comp.text.xml.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 22 '06 #4

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

Similar topics

2
13509
by: obsidian8 | last post by:
Hi All, I have looked around for an answer to this question, but haven't found one as of yet. I'm trying to use javascript to dynamically create raido buttons. I am able to create them easily enough but they aren't clickable. It doesn't matter if I set them as checked or not, you can't manipulate them at all. The code I'm using appears below: function test(){ componentMainTable = document.getElementById("mycomponent");
3
9138
by: takarimasu | last post by:
How can i create an input object (text area,select) at runtime ? B.
3
5381
by: Richard Fritzler | last post by:
I was given the task of designing a complete web based document prep system. In simplest terms (using a msword explanation) create a database of merge fields, and a library of templates. Allow the webuser to select the template, merge his DB record, and produce a formatted document that can be printed or downloaded. We need to do this without specialized software on the client, since it will be universally available to webusers. We...
3
479
by: di | last post by:
I have a Access Database, and I would like to create a word document that (preferable would filter)links to ACCESS table or query. I would like to print the word document on the filtered record that I have selected in Access. for example if I have customer number (201) that I would like to merge over to a Word document. The word document is a template that I would like to use regularly. Thanks so Much for anyone that can WALK me thru...
3
12359
by: sloesch | last post by:
I am working with VS.net 2003, framework 1.1, developing with VB.net, and ASP.net, and I would like to know how you can create a dynamic hyperlink on the fly to a document stored in a SQL database? I would like to create a VB.net function that would do this, and I found this class *System.Web.UI.WebControls.HyperLink*, but I can not find any examples on generate a dynamic hyperlink. Basically, I want my function to generate an embedded...
0
3221
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want to register new customer or companies they will enter the information in Windows Form and the program automaticaly creates the WORD document under specific folder under application path. Once the empty word file created than ask user if they want...
4
12427
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
10
3963
by: SM | last post by:
Hello I'm trying to create a multi dimensional array in JavaScript, but after some reading i still can't figure out how to apply it to my model. Here it is: I have a list A and for each item in the list A i want to associate an undetermined number of items. The complication for me is the fact that the items to associate in list A are undetermined.
4
8271
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my problems and this one is really getting to me... I have a page that allows you to Browse Authors. There are three drop down boxes that auto-populate via AJAX. I have a file which it calls and returns the dynamically built XML file in the boxes...
14
5179
RMWChaos
by: RMWChaos | last post by:
Firebug is reporting "too much recursion" when I attempt to create a child element in a parent that doesn't exist yet. The script should automatically create the missing parent before going on to create the child element. At the point where the script is supposed to call itself with the new properties to create the parent, it gives me the error and looks like it's looping the function continuously. It seems that "id : attrib" (line 192) is...
0
8370
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8283
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8704
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8590
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.