![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - RE: Attributes problem Attributes problemTo: NULL Date: 4/1/2004 7:46:00 PM Hi
I'm having a problem with setting an attribute to a node without it also setting it to childnodes. The code I'm using is below.
xmlDoc.loadXML "<checklist/>
Set root = xmlDoc.documentElemen
root.setAttribute "xmlns", "http://tempuri.org/Checklist.xsd
Dim ThisVariable As Long, ThisCriteria As Long, ThisPase As Lon
With rstva
.MoveFirs
Do While .EOF = Fals
Set nodePhase = xmlDoc.createElement("phase"
root.appendChild nodePhas
Set cName = xmlDoc.createAttribute("phaseID"
Set nodeThisOne = root.childNodes.Item(ThisVariable
cName.Value = !I
nodeThisOne.setAttributeNode cNam
nodeThisOne.setAttribute "xmlns", "http://tempuri.org/Checklist.xsd
Set nodeDescription = xmlDoc.createElement("name"
Set ThisNode = root.childNodes.Item(ThisVariable
ThisNode.appendChild nodeDescriptio
ThisNode.lastChild.Text = Nz(!PhaseName, ""
Set nodeDescription = xmlDoc.createElement("startDate"
ThisNode.appendChild nodeDescriptio
ThisNode.lastChild.Text = Nz(!Start, 0
Set nodeDescription = xmlDoc.createElement("endDate"
ThisNode.appendChild nodeDescriptio
ThisNode.lastChild.Text = Nz(!End, 0
What results is
<checklist xmlns="http://tempuri.org/Checklist.xsd"><phase phaseID="1" xmlns="http://tempuri.org/Checklist.xsd"><name xmlns="">Phase One</name><startDate xmlns="">0</startDate><endDate xmlns="">0</endDate
NOTE the empty xmlns attributes in name, startDate and endDate. I only want the attribute on checklist and phase
Any help appreciated
Thanks
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
