Share via

Creating an XML document using DOMDocument60 with the use of the xmlns attribute

Anonymous
2023-03-06T14:02:20+00:00

Hello,

With Access 2021, I am trying to create an XML document using DOMDocument60.

After creating the first element with the <xmlns> attribute and its value, I see that the added child element also has the attribute name.

If I change the <xmlns> attribute name to another value or if the namespace is followed in prefix (xmlns:abc), I don't have this problem.

How to solve this problem?

Is this the correct way to handle the <xmlns> attribute for the first element?

Here is my test code.


Private Sub cmdEssai_Click()

Dim xmlDomRuban As New DOMDocument60

Dim xmlElement1 As IXMLDOMElement

Dim xmlElement2 As IXMLDOMElement

Set xmlElement1 = xmlDomRuban.createElement("customUI")

xmlDomRuban.appendChild xmlElement1

xmlElement1.setAttribute "xmlns", "http://schemas.microsoft.com/office/2009/07/customui"

Set xmlElement2 = xmlDomRuban.createElement("ribbon")

xmlElement1.appendChild xmlElement2

Debug.Print xmlDomRuban.XML

End Sub


Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-03-06T16:40:48+00:00

    I am currently developing a ribbon creation program in access.

    From my ribbon configuration form (attributes, procedures), I create the XML code to place in the <USysRibbons> table.

    Was this answer helpful?

    0 comments No comments
  2. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2023-03-06T14:15:13+00:00

    Why are you creating this Ribbon xml from scratch? You can use any xml or text editor.

    Mine starts like this:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="ribbonLoaded"> The 2009 schema should work as well.

    Was this answer helpful?

    0 comments No comments