VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes
VB6 xml How to set attributes VB6 xml How to set attributes
VB6 xml How to set attributes
Go Back  Xtreme Visual Basic Talk > > > VB6 xml How to set attributes


Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2014, 07:25 PM
mhnxtrvb mhnxtrvb is offline
Newcomer
 
Join Date: Aug 2014
Posts: 2
Default VB6 xml How to set attributes


I am inserting a node into a xml file using the following:

Dim xmlDoc As msxml2.DOMDocument40
Set xmlDoc = New msxml2.DOMDocument
Dim root As IXMLDOMElement
Dim newNode As IXMLDOMNode
Dim currNode As IXMLDOMNode
xmlDoc.async = False
xmlDoc.Load ("C:myfile.xml")
Set root = xmlDoc.documentElement
xmlDoc.setProperty "SelectionLanguage", "XPath"


Set newNode = xmlDoc.createNode(NODE_ELEMENT, "VIDEOS", "Version=22")
'Set newNode = xmlDoc.createNode(NODE_ELEMENT, "VIDEOS", "Version=" & Chr(34) & "33" & Chr(34)) 'This produces an error loading into viewer

'Set currNode = root.insertBefore(newNode, root.childNodes.Item(1))
Set currNode = root.insertBefore(newNode, xmlDoc.selectSingleNode("//DVDMarkers[@ClassID='efb6b9f5-5b1c-4eaa-83ef-d6f93b0cac79']"))


xmlDoc.save ("C:myfileOut.xml")

The problem is that the output is wrong, I get
<VIDEOS xmlns= "Version=22"/>
This will not work

I need to get:
<VIDEOS Version="22"/>

If I use the line commented out that places chr(34) around the value, I get
"Required white space is missing" when my xml viewer attempts to load the output.

Thanks for any help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes VB6 xml How to set attributes
VB6 xml How to set attributes
VB6 xml How to set attributes
 
VB6 xml How to set attributes
VB6 xml How to set attributes
 
-->