Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / July 2007

Tip: Looking for answers? Try searching our database.

Copy Element and Create New?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lucius - 25 Jul 2007 12:57 GMT
I have an XML document that was a .NET DataSet originally, with schema
information at the top.

Could someone show how, using MSXML v2 "createobject", to copy an
element (that has n attributes) to a new element? Also, how to create
a new element so I can put new attribute data inside?

Thanks.
WenYuan Wang [MSFT] - 26 Jul 2007 09:18 GMT
Hello Lucius

We need to perform more research on this issue . We will reply here as soon
as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!
Best regards,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 26 Jul 2007 12:56 GMT
Hello Lucius,
Thanks for your wait.

I think you need a JavaScript example in Web Application. Please correct me
if I misunderstand anything here. Thanks.

1) Using MSXML object to Copy an element, you may refer the following code.

var doc = new ActiveXObject("Msxml2.DOMDocument");
doc.loadXML("<?xml version=\"1.0\"
encoding=\"utf-8\"?><root><a>aaaaa</a></root>");
var root = doc.documentElement;
var m = doc.selectSingleNode("/root/a").cloneNode(true);
root.appendChild(m);
alert(doc.xml);

2) Using MSXML object to create a new element: you may refer the following
code.

var doc = new ActiveXObject("Msxml2.DOMDocument");
doc.loadXML("<?xml version=\"1.0\"
encoding=\"utf-8\"?><root><a>aaaaa</a></root>");
var o = doc.createElement("newElement");
var r = doc.createAttribute("id");
r.value="test";
o.setAttributeNode(r);
root.appendChild(o);
alert(doc.xml);

Hope this helps. Please try the above method and let me know if this is
what you need. We will follow up.
Best regards,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 30 Jul 2007 12:13 GMT
Hello Lucius,

This is Wen Yuan. I just want to check if there is anything we can help
with.
Have you resolved the issue so far?
Please feel free to update here if you have any concern. We are glad to
assist you.

Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.