TypeError: Error #1088: The markup in the document following the root element must be well-formed.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

TypeError: Error #1088: The markup in the document following the root element must be well-formed.

serkan
This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;
           
            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();
           
            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }

           
            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {
               
            }
           
        ]]>
    </fx:Script>
   
    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%"  color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
                creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>

   
</s:Application>



Reply | Threaded
Open this post in threaded view
|

Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

Greg Dove

You might see this sort of  error during first use of XML in some browsers via the debug console. Royale's XML class uses some native parsing support in the browser, but because different browsers report parsing errors in different ways, an initial parsing test is done with a known error to prepare for possible future errors from user code. That test is dones inside a try/catch block, but for some reason it still gets passed to the console in certain browsers even though it has no adverse affect on the running code. If this is the cause of what you are seeing then you can safely ignore it (I can't be 100% sure, but it sort of sounds like it might be that)


On Wed, Apr 29, 2020 at 4:26 PM serkan <[hidden email]> wrote:
This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;
           
            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();
           
            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }

           
            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {
               
            }
           
        ]]>
    </fx:Script>
   
    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%"  color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
                creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>

   
</s:Application>



Reply | Threaded
Open this post in threaded view
|

Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

Alex Harui-2

I’m not sure what the example is supposed to produce, but I got two MenuBar entries if the XMLList looked like this:

 

    <fx:Declarations>

        <fx:XMLList id="menuDataXMLList">

                <menuitem label="configFiles" id="configfiles">           

                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           

                </menuitem>

                <menuitem label="management" id="admin">

                    <menuitem label="suspendApp" id="suspendApp"/>

                </menuitem>

        </fx:XMLList>

    </fx:Declarations>

 

And yes, there is a caught exception, but that is expected when parsing XMLLists.

 

HTH,

-Alex

 

From: Greg Dove <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Tuesday, April 28, 2020 at 9:33 PM
To: "[hidden email]" <[hidden email]>
Subject: Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

 


You might see this sort of  error during first use of XML in some browsers via the debug console. Royale's XML class uses some native parsing support in the browser, but because different browsers report parsing errors in different ways, an initial parsing test is done with a known error to prepare for possible future errors from user code. That test is dones inside a try/catch block, but for some reason it still gets passed to the console in certain browsers even though it has no adverse affect on the running code. If this is the cause of what you are seeing then you can safely ignore it (I can't be 100% sure, but it sort of sounds like it might be that)

 

 

On Wed, Apr 29, 2020 at 4:26 PM serkan <[hidden email]> wrote:

This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;
           
            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();
           
            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }

           
            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {
               
            }
           
        ]]>
    </fx:Script>
   
    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%"  color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
                creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>

   
</s:Application>


Reply | Threaded
Open this post in threaded view
|

Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

serkan
In reply to this post by Greg Dove
Hi Greg,

The exception is in try catch.  So I can live with it :)

I am going to ignore it but for your note and to be clear that we are at the same point,  here are the two samples with exception and without exception.


with exception :

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuitem label="configFiles" id="configfiles">           
                <menuitem label="pinaraProperties" id="pinaraProperties"/>           
            </menuitem>
            <menuitem label="management" id="admin">
                <menuitem label="suspendApp" id="suspendApp"/>
            </menuitem>
        </fx:XMLList>
    </fx:Declarations>


without exception

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>



Thanks,
Serkan

29.04.2020 07:33 tarihinde Greg Dove yazdı:

You might see this sort of  error during first use of XML in some browsers via the debug console. Royale's XML class uses some native parsing support in the browser, but because different browsers report parsing errors in different ways, an initial parsing test is done with a known error to prepare for possible future errors from user code. That test is dones inside a try/catch block, but for some reason it still gets passed to the console in certain browsers even though it has no adverse affect on the running code. If this is the cause of what you are seeing then you can safely ignore it (I can't be 100% sure, but it sort of sounds like it might be that)


On Wed, Apr 29, 2020 at 4:26 PM serkan <[hidden email]> wrote:
This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;
           
            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();
           
            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }

           
            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {
               
            }
           
        ]]>
    </fx:Script>
   
    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%"  color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
                creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>

   
</s:Application>




Reply | Threaded
Open this post in threaded view
|

Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

serkan
In reply to this post by Alex Harui-2
I completely agree Alex. This example produce the menubar if you set "menuBarData.source = menuDataXMLList;"

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuitem label="configFiles" id="configfiles">           
                <menuitem label="pinaraProperties" id="pinaraProperties"/>           
            </menuitem>
            <menuitem label="management" id="admin">
                <menuitem label="suspendApp" id="suspendApp"/>
            </menuitem>
        </fx:XMLList>
    </fx:Declarations>


Also this one is producing the menubar but you have to set the source "menuBarData.source = menuDataXMLList.children();"

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>



I am ignoring the exception and going forward.

Thanks,
Serkan

29.04.2020 08:10 tarihinde Alex Harui yazdı:

I’m not sure what the example is supposed to produce, but I got two MenuBar entries if the XMLList looked like this:

 

    <fx:Declarations>

        <fx:XMLList id="menuDataXMLList">

                <menuitem label="configFiles" id="configfiles">           

                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           

                </menuitem>

                <menuitem label="management" id="admin">

                    <menuitem label="suspendApp" id="suspendApp"/>

                </menuitem>

        </fx:XMLList>

    </fx:Declarations>

 

And yes, there is a caught exception, but that is expected when parsing XMLLists.

 

HTH,

-Alex

 

From: Greg Dove [hidden email]
Reply-To: [hidden email] [hidden email]
Date: Tuesday, April 28, 2020 at 9:33 PM
To: [hidden email] [hidden email]
Subject: Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

 


You might see this sort of  error during first use of XML in some browsers via the debug console. Royale's XML class uses some native parsing support in the browser, but because different browsers report parsing errors in different ways, an initial parsing test is done with a known error to prepare for possible future errors from user code. That test is dones inside a try/catch block, but for some reason it still gets passed to the console in certain browsers even though it has no adverse affect on the running code. If this is the cause of what you are seeing then you can safely ignore it (I can't be 100% sure, but it sort of sounds like it might be that)

 

 

On Wed, Apr 29, 2020 at 4:26 PM serkan <[hidden email]> wrote:

This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;
           
            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();
           
            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }

           
            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {
               
            }
           
        ]]>
    </fx:Script>
   
    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%"  color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
                creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>

   
</s:Application>



Reply | Threaded
Open this post in threaded view
|

Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

Alex Harui-2
In reply to this post by serkan

Serkan,

 

An XMLList literal with one node is indistinguishable from an XML literal.   The JS runtime does not understand XMLList and XML so we test by asking the browser to parse the literal.  XMLList literals with more than one child will not parse and that’s how we know it is XMLList and not XML.

 

-Alex

 

From: serkan <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Wednesday, April 29, 2020 at 1:28 AM
To: "[hidden email]" <[hidden email]>, Greg Dove <[hidden email]>
Subject: Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

 

Hi Greg,

The exception is in try catch.  So I can live with it :)

I am going to ignore it but for your note and to be clear that we are at the same point,  here are the two samples with exception and without exception.


with exception :

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuitem label="configFiles" id="configfiles">           
                <menuitem label="pinaraProperties" id="pinaraProperties"/>           
            </menuitem>
            <menuitem label="management" id="admin">
                <menuitem label="suspendApp" id="suspendApp"/>
            </menuitem>
        </fx:XMLList>
    </fx:Declarations>


without exception

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>



Thanks,
Serkan

29.04.2020 07:33 tarihinde Greg Dove yazdı:


You might see this sort of  error during first use of XML in some browsers via the debug console. Royale's XML class uses some native parsing support in the browser, but because different browsers report parsing errors in different ways, an initial parsing test is done with a known error to prepare for possible future errors from user code. That test is dones inside a try/catch block, but for some reason it still gets passed to the console in certain browsers even though it has no adverse affect on the running code. If this is the cause of what you are seeing then you can safely ignore it (I can't be 100% sure, but it sort of sounds like it might be that)

 

 

On Wed, Apr 29, 2020 at 4:26 PM serkan <[hidden email]> wrote:

This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;
           
            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();
           
            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }

           
            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {
               
            }
           
        ]]>
    </fx:Script>
   
    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%"  color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
                creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>

   
</s:Application>




Reply | Threaded
Open this post in threaded view
|

Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

serkan
The difference between the xml structure for feeding components is not same as flex and this is what I am confused.

Thank you for the detailed description Alex and Greg.


Serkan

29.04.2020 19:10 tarihinde Alex Harui yazdı:

Serkan,

 

An XMLList literal with one node is indistinguishable from an XML literal.   The JS runtime does not understand XMLList and XML so we test by asking the browser to parse the literal.  XMLList literals with more than one child will not parse and that’s how we know it is XMLList and not XML.

 

-Alex

 

From: serkan [hidden email]
Reply-To: [hidden email] [hidden email]
Date: Wednesday, April 29, 2020 at 1:28 AM
To: [hidden email] [hidden email], Greg Dove [hidden email]
Subject: Re: TypeError: Error #1088: The markup in the document following the root element must be well-formed.

 

Hi Greg,

The exception is in try catch.  So I can live with it :)

I am going to ignore it but for your note and to be clear that we are at the same point,  here are the two samples with exception and without exception.


with exception :

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuitem label="configFiles" id="configfiles">           
                <menuitem label="pinaraProperties" id="pinaraProperties"/>           
            </menuitem>
            <menuitem label="management" id="admin">
                <menuitem label="suspendApp" id="suspendApp"/>
            </menuitem>
        </fx:XMLList>
    </fx:Declarations>


without exception

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>



Thanks,
Serkan

29.04.2020 07:33 tarihinde Greg Dove yazdı:


You might see this sort of  error during first use of XML in some browsers via the debug console. Royale's XML class uses some native parsing support in the browser, but because different browsers report parsing errors in different ways, an initial parsing test is done with a known error to prepare for possible future errors from user code. That test is dones inside a try/catch block, but for some reason it still gets passed to the console in certain browsers even though it has no adverse affect on the running code. If this is the cause of what you are seeing then you can safely ignore it (I can't be 100% sure, but it sort of sounds like it might be that)

 

 

On Wed, Apr 29, 2020 at 4:26 PM serkan <[hidden email]> wrote:

This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;
           
            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();
           
            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }

           
            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {
               
            }
           
        ]]>
    </fx:Script>
   
    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">           
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>           
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%"  color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
                creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>

   
</s:Application>