Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSXML Attributes / VB

Status
Not open for further replies.

BigGreenBox

Programmer
Mar 13, 2007
15
GB
I've written a small function to add attributes to my XML which is this:

Sub AddAttribute(AttribName, AttribValue)
Dim AttribNode

Set AttribNode = XMLFile.createAttribute(AttribName)
MyNode(NodeCount - 1).Attributes.setNamedItem AttribNode
AttribNode.Value = AttribValue
Set AttribNode = Nothing
End Sub

If I add a node called Dealtrak, then use my function to add an attribute called Mode with the value NewApp, I get the desired result which is:

<Dealtrak Mode="NewApp">

However, I've got to achieve this:

<Dealtrak xsi:noNamespaceSchemeLocation=" xmlns:xsi="
But when I use my function, it complains and I get an error saying "Attempt to modify a read-only node".

I've tried to have a good hunt around for a solution, but nothing seems to be working for me! Has anyone got any other ideas?

Cheers!
 
[0] It involves quite a number of global/defined-elsewhere variables that we can only suppose done correctly.
[1] As an aside, it is xsi:noNamespaceSchem[red]a[/red]Location. You might tell the forum it is a typos.
[2] Before calling AddAttribute(), check XMLFile.readystate. What number does it show?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top