Skip to Content

Menu from XML

Hi. I suggest you a little game.

Given an XML file defining a menu :

<?xml version="1.0" encoding="UTF-8"?>

<Application>

<Menus>

<action type="add">

<Menu Checked="0" Enabled="1" FatherUID="43520" Position="13" String="Miscellaneous Demo" Type="2" UniqueID="99999">

<Menus>

<action type="add">

<Menu Checked="0" Enabled="1" FatherUID="99999" Position="0" String="Custom Form" Type="1" UniqueID="menuCustomForm" />

</action>

</Menus>

</Menu>

</action>

</Menus>

</Application>

why this code create the menu

Private Sub AddMenuItems()

Dim oXmlDoc As New MSXML2.DOMDocument

Call oXmlDoc.load("MyMenu.xml")

Call m_app.LoadBatchActions(oXmlDoc.xml)

End Sub

and this other no?

Private Sub AddMenuItems()

Dim x As XmlDocument = New System.Xml.XmlDocument

x.Load("MyMenu.xml")

m_app.LoadBatchActions(x.InnerXml)

End Sub

Who give me the answer wins my many thanks.

Ciao. Nicola

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 09:02 PM

    As a stab in the dark, is it because the first one uses the xml() method where as the second uses the InnerXml() method?

    What errors are you getting (if any)?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Nicola Martella

      I only use the second way, and it works like a charm... 😊

      I'm using C#.Net though...

      But, what the problem could be, a while ago, when I tried LoadBatchActions(myXmlDoc.InnerXML);</i> C# did throw me an error before compiling. Something about <i>myXmlDoc.InnerXML</i> was not allowed directly in <i>LoadBatchActions</i>. So try this:

      <b>Code (C#)</b>

      private void AddMenuItems()
      {
        /* New XML document */
        XmlDocument x = new System.Xml.XmlDocument();
      
        /* Load the xmfile and put it's content in a string */
        x.Load("MyMenu.xml");
        string sXML = x.InnerXml;
      
        /* Load the xml into the SBO application */
        SBO_Application.LoadBatchActions(sXML);
      }

      Probatly that wil work.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.