Changing XML attribute in Access VBA

R

RickBeddoe

Hello,

This might be outside the scope of this discussion group, but I'll give it a
try.

I have the following XML data:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root xmlns:link="http://foo.com">
<sub xmlns:attr="foo">
</sub>
</root>

I would like to change the value of the 'xmlns:attr' attribute in the 'sub'
element. When I use the code below, I get the error "Attempt to modify a
read-only node".

If I remove the xmlns prefix from the attribute, it works. Any suggestions?


Set testNode = doc.getElementsByTagName("sub").Item(0)
testNode.Attributes.getNamedItem("xmlns:attr").nodeValue = "fi"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top