473,699 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Append XML document

Hi,

I posted this in "microsoft.publ ic.xml.msxml-webrelease" but now
realize it should probably have been in the ASP group. Sorry if that
causes any problems.

I have an XML document like:
<MainNode>
<Value>First Value</Value>
</MainNode>
<MainNode>
<Value>Second Value</Value>
</MainNode>
<MainNode>
<Value>Third Value</Value>
</MainNode>
<MainNode>
<Value>Fourth Value</Value>
</MainNode>
</dataroot>

I need to append information to this file using ASP. How do I do this?
I am just starting out in XML so sample code would really help.

Also, I may need to remove a node from this file ... is that possible?
If so, how?

Thanks!!
- Gary

Dec 12 '06 #1
4 3415

<gl****@yahoo.c omwrote in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Hi,

I posted this in "microsoft.publ ic.xml.msxml-webrelease" but now
realize it should probably have been in the ASP group. Sorry if that
causes any problems.

I have an XML document like:
<MainNode>
<Value>First Value</Value>
</MainNode>
<MainNode>
<Value>Second Value</Value>
</MainNode>
<MainNode>
<Value>Third Value</Value>
</MainNode>
<MainNode>
<Value>Fourth Value</Value>
</MainNode>
</dataroot>

I need to append information to this file using ASP. How do I do this?
I am just starting out in XML so sample code would really help.

Also, I may need to remove a node from this file ... is that possible?
If so, how?

Thanks!!
- Gary
Have a run through this tutorial:-

http://www.w3schools.com/dom/default.asp

also:-

http://www.w3schools.com/xpath/default.asp
Dec 12 '06 #2
Thanks, I'll go through it.

- Gary
------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------

Anthony Jones wrote:
<gl****@yahoo.c omwrote in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Hi,

I posted this in "microsoft.publ ic.xml.msxml-webrelease" but now
realize it should probably have been in the ASP group. Sorry if that
causes any problems.

I have an XML document like:
<MainNode>
<Value>First Value</Value>
</MainNode>
<MainNode>
<Value>Second Value</Value>
</MainNode>
<MainNode>
<Value>Third Value</Value>
</MainNode>
<MainNode>
<Value>Fourth Value</Value>
</MainNode>
</dataroot>

I need to append information to this file using ASP. How do I do this?
I am just starting out in XML so sample code would really help.

Also, I may need to remove a node from this file ... is that possible?
If so, how?

Thanks!!
- Gary

Have a run through this tutorial:-

http://www.w3schools.com/dom/default.asp

also:-

http://www.w3schools.com/xpath/default.asp
Dec 12 '06 #3
gl****@yahoo.co m wrote:
Hi,

I posted this in "microsoft.publ ic.xml.msxml-webrelease" but now
realize it should probably have been in the ASP group. Sorry if that
causes any problems.

I have an XML document like:
<MainNode>
<Value>First Value</Value>
</MainNode>
<MainNode>
<Value>Second Value</Value>
</MainNode>
<MainNode>
<Value>Third Value</Value>
</MainNode>
<MainNode>
<Value>Fourth Value</Value>
</MainNode>
</dataroot>
this is not legal xml - it's missing a <dataroottag. I will assume the
xml actually starts with that tag.
>
I need to append information to this file using ASP. How do I do
this? I am just starting out in XML so sample code would really help.

Also, I may need to remove a node from this file ... is that possible?
If so, how?
Where is this xml coming from? A file? Are you building it in code? I
will assume it is contained in a file:

<%
dim xmldoc, root, node
set xmldoc=createob ject("msxml2.do mdocument")
xmldoc.load("fi lename.xml")
set root = xmldoc.document element

'To add a MainNode with "Fifth Value", do this:
set node = xmldoc.createel ement("MainNode ")
node.text = "Fifth Value"
root.appendchil d node
response.write xmldoc.xml & "<br><hr>"

'To remove the "Second Value" node:
set node=nothing
set node = xmldoc.selectsi nglenode("//MainMode[. = 'Second Value']")
if not node is nothing then
root.removechil d node
end if
response.write xmldoc.xml & "<br><hr>"
%>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 12 '06 #4
Bob,

Yes, the <dataroottag is in the XML file, I just removed it for the
posting.

Thanks for the help!!

- Gary
--------------------------------------------------------------------------------------------------------

Bob Barrows [MVP] wrote:
gl****@yahoo.co m wrote:
Hi,

I posted this in "microsoft.publ ic.xml.msxml-webrelease" but now
realize it should probably have been in the ASP group. Sorry if that
causes any problems.

I have an XML document like:
<MainNode>
<Value>First Value</Value>
</MainNode>
<MainNode>
<Value>Second Value</Value>
</MainNode>
<MainNode>
<Value>Third Value</Value>
</MainNode>
<MainNode>
<Value>Fourth Value</Value>
</MainNode>
</dataroot>

this is not legal xml - it's missing a <dataroottag. I will assume the
xml actually starts with that tag.

I need to append information to this file using ASP. How do I do
this? I am just starting out in XML so sample code would really help.

Also, I may need to remove a node from this file ... is that possible?
If so, how?
Where is this xml coming from? A file? Are you building it in code? I
will assume it is contained in a file:

<%
dim xmldoc, root, node
set xmldoc=createob ject("msxml2.do mdocument")
xmldoc.load("fi lename.xml")
set root = xmldoc.document element

'To add a MainNode with "Fifth Value", do this:
set node = xmldoc.createel ement("MainNode ")
node.text = "Fifth Value"
root.appendchil d node
response.write xmldoc.xml & "<br><hr>"

'To remove the "Second Value" node:
set node=nothing
set node = xmldoc.selectsi nglenode("//MainMode[. = 'Second Value']")
if not node is nothing then
root.removechil d node
end if
response.write xmldoc.xml & "<br><hr>"
%>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 12 '06 #5

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

Similar topics

1
15308
by: Koms Bomb | last post by:
document.write will flush current document content. I've found I can use DOM to append some element to the document, but I think append html text directly is better. Is it possible to append html text to current document? -- Koms Bomb *****Pardon my poor English*****
2
26778
by: brian | last post by:
user input accepted via a input in the form. this value needs to be appended to the current url (explained below) ie say present url is www.xyz.com and the user is asked to enter his string and say he enters "john" a hyper link needs to be created by appending this string, like <a href="http://www.xyz.com/john"></a> (the string "john" was the one input by the user in the input field)
3
1881
by: J Krugman | last post by:
This question refers to the DOM. I would like to dynamically append some small amount of text to the all-text content of a <pre> node. I suppose that I could extract the existing content, and replace the <pre> node in question with a new <pre> node that has the extended content. But the existing content is longish, and it seems to me wasteful to rewrite it all just to have a small amount of text tacked on to the end. Is there a way to...
3
23952
by: Jonathan Buckland | last post by:
Can someone give me an example how to append data without having to load the complete XML file. Is this possible? Jonathan
2
12906
by: Matrix | last post by:
Greetings I want to append records in a XML file,I use XMLTextWriter,but i found it only create a XML file,not append records in exist XML file.why? ------------------------------------------------- XmlTextWriter myXmlTextWrite = new XmlTextWriter(@"C:\myconfig.xml"); myXmlTextWrite.WriteStartDocument(); myXmlTextWrite.WriteStartElement("Record"); myXmlTextWrite.WriteStartElement("Topic"); myXmlTextWrite.WriteString(XMLTopic);
8
2889
by: Kelly Sellers | last post by:
Short version: is it possible to set OutputTo so that it will append to an existing RTF document instead of creating a new document each time? (I'm using Access XP) Full scenario: I generate 11 related reports every two weeks (bowling league stats), from various and sundry recordsets. These reports must be combined into a single document, which is then sent on its way as an e-mail attachment.
3
1321
by: barry | last post by:
I have the following: function(NAMED) { sString.Append("document.forms.NAMED.style.visibility = 'hidden'") } and would like to convert the NAMED into the object it represents - for example in this case it represents the name of an image called card17 thanks
3
6101
by: juicy | last post by:
I have create 4 check box, every check on the check box will append text in textarea and any uncheck on check box will remove text in text area. Please give some guide on how to control this.
1
1494
by: mentor | last post by:
I tried this way, but don't work. in current document, first get the node var aNode = document.getElementById("anode"); then, import the node to the other target document, and append it, newNode = targetdocument.importNode(aNode); targetdocument.body.appendChild(newNode); IE6 reports the method importNode() not supported. Is there any other way? thanks
0
2953
by: Hags007 | last post by:
I have a XML file I am working with. This file has been created by hand and I now need to develop a PHP script that will create it in the same format. Here is what I have thus far: $query = "select * from " . $table_name . " ORDER BY stateID ASC"; $result = mysql_query($query, $connection) or die("Could not complete database query"); $num = mysql_num_rows($result); if ($num != 0) {
0
9173
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...
1
8911
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
8882
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...
0
7748
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6533
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...
0
5872
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.