You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by serkan <se...@likyateknoloji.com> on 2020/04/28 04:18:52 UTC
XML construction from resource throws exception : TypeError: Cannot
read property 'setAttribute' of undefined
Hİ,
The source below has the exception. Similar one was resolved for XMLList
with https://github.com/apache/royale-asjs/issues/545
The error line :
function (value) { this.filterMenuData[1].setAttribute('label', value);},
note : for the index 0 it works.
Thanks,
Serkan
<?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:Metadata>
[ResourceBundle("messages")]
</fx:Metadata>
<fx:Script>
<![CDATA[
]]>
</fx:Script>
<fx:Declarations>
<fx:XML format="e4x" id="filterMenuData">
<menuitem label="{resourceManager.getString('messages',
'statusFilter')}" id="statusFilter">
<menuitem label="{resourceManager.getString('messages',
'listAll')}"/>
<menuitem label="{resourceManager.getString('messages',
'readyFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'waitingFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'workingFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'successfulFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'failedFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'timeoutFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'skippedFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'stoppedFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'pausedFilter')}"/>
<menuitem label="{resourceManager.getString('messages',
'disabledFilter')}"/>
</menuitem>
</fx:XML>
</fx:Declarations>
</s:Application>
Re: XML construction from resource throws exception : TypeError:
Cannot read property 'setAttribute' of undefined
Posted by Greg Dove <gr...@gmail.com>.
Hi Serkan,
If it's the same as Flex, then please log an issue with that same example
code (if you can swap all the resourceManager requests to plain strings, it
will be easier for us to use it when investigating/fixing the issue)
I am not sure yet why that would be valid in Flex, unless it is treated
specially via mxml as an XMLList. An XML instance definitely only makes
sense with [0] (and that is only to make it more compatible with XMLList in
e4x expressions I think, not for any other reason).
Please log the issue under royale-asjs, but it sounds like it might end up
needing a fix in royale-compiler.
On Tue, Apr 28, 2020 at 8:34 PM serkan <se...@likyateknoloji.com> wrote:
> Hi Greg,
>
> It is just same as as in flex.
>
> Do you advise me to convert to XMLList ?
>
> Thanks,
> Serkan
>
> 28.04.2020 08:56 tarihinde Greg Dove yazdı:
>
>
> if it is XML, then it index [1] should not work. Only index [0] is valid
> for an XML instance;
> when you access [0] on an XML instance it returns the same instance.
>
> var xml:XML = <root><child/></root>
>
> trace(xml[1])//undefined
> trace(xml[0])//same as xml.toString()
>
> If it is an XMLList then it can have index values greater than zero.
>
>
> On Tue, Apr 28, 2020 at 4:19 PM serkan <se...@likyateknoloji.com> wrote:
>
>> Hİ,
>>
>> The source below has the exception. Similar one was resolved for XMLList
>> with https://github.com/apache/royale-asjs/issues/545
>>
>> The error line :
>>
>> function (value) { this.filterMenuData[1].setAttribute('label', value);},
>>
>> note : for the index 0 it works.
>>
>> Thanks,
>> Serkan
>>
>>
>>
>> <?xml version="1.0" encoding="latin5" ?>
>>
>> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> <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:Metadata>
>> [ResourceBundle("messages")]
>> </fx:Metadata>
>>
>> <fx:Script>
>> <![CDATA[
>> ]]>
>> </fx:Script>
>>
>> <fx:Declarations>
>> <fx:XML format="e4x" id="filterMenuData">
>> <menuitem label="{resourceManager.getString('messages',
>> 'statusFilter')}" id="statusFilter">
>> <menuitem label="{resourceManager.getString('messages',
>> 'listAll')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'readyFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'waitingFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'workingFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'successfulFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'failedFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'timeoutFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'skippedFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'stoppedFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'pausedFilter')}"/>
>> <menuitem label="{resourceManager.getString('messages',
>> 'disabledFilter')}"/>
>> </menuitem>
>> </fx:XML>
>> </fx:Declarations>
>>
>> </s:Application>
>>
>>
>>
>
Re: XML construction from resource throws exception : TypeError:
Cannot read property 'setAttribute' of undefined
Posted by serkan <se...@likyateknoloji.com>.
Hi Greg,
I tested the XMLList version it looks like can work after the issues
with menu resolved.
I can access the index :
this.filterMenuData[1] and so.
If it is planned to support the same approach as flex I may create and
issue. If not than I can use XMLLlist
Thanks,
Serkan
28.04.2020 11:33 tarihinde serkan yazdı:
> Hi Greg,
>
> It is just same as as in flex.
>
> Do you advise me to convert to XMLList ?
>
> Thanks,
> Serkan
>
> 28.04.2020 08:56 tarihinde Greg Dove yazdı:
>>
>> if it is XML, then it index [1] should not work. Only index [0] is
>> valid for an XML instance;
>> when you access [0] on an XML instance it returns the same instance.
>>
>> var xml:XML = <root><child/></root>
>>
>> trace(xml[1])//undefined
>> trace(xml[0])//same as xml.toString()
>>
>> If it is an XMLList then it can have index values greater than zero.
>>
>>
>> On Tue, Apr 28, 2020 at 4:19 PM serkan <serkan@likyateknoloji.com
>> <ma...@likyateknoloji.com>> wrote:
>>
>> Hİ,
>>
>> The source below has the exception. Similar one was resolved for
>> XMLList with https://github.com/apache/royale-asjs/issues/545
>>
>> The error line :
>>
>> function (value) { this.filterMenuData[1].setAttribute('label',
>> value);},
>>
>> note : for the index 0 it works.
>>
>> Thanks,
>> Serkan
>>
>>
>>
>> <?xml version="1.0" encoding="latin5" ?>
>>
>> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> <http://ns.adobe.com/mxml/2009>
>> xmlns:s="library://ns.apache.org/royale/spark
>> <http://ns.apache.org/royale/spark>"
>> xmlns:mx="library://ns.apache.org/royale/mx
>> <http://ns.apache.org/royale/mx>"
>> height="288" width="179"
>> >
>> <fx:Metadata>
>> [ResourceBundle("messages")]
>> </fx:Metadata>
>>
>> <fx:Script>
>> <![CDATA[
>> ]]>
>> </fx:Script>
>>
>> <fx:Declarations>
>> <fx:XML format="e4x" id="filterMenuData">
>> <menuitem
>> label="{resourceManager.getString('messages', 'statusFilter')}"
>> id="statusFilter">
>> <menuitem
>> label="{resourceManager.getString('messages', 'listAll')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'readyFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'waitingFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'workingFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'successfulFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'failedFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'timeoutFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'skippedFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'stoppedFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'pausedFilter')}"/>
>> <menuitem
>> label="{resourceManager.getString('messages', 'disabledFilter')}"/>
>> </menuitem>
>> </fx:XML>
>> </fx:Declarations>
>>
>> </s:Application>
>>
>>
>
Re: XML construction from resource throws exception : TypeError:
Cannot read property 'setAttribute' of undefined
Posted by serkan <se...@likyateknoloji.com>.
Hi Greg,
It is just same as as in flex.
Do you advise me to convert to XMLList ?
Thanks,
Serkan
28.04.2020 08:56 tarihinde Greg Dove yazdı:
>
> if it is XML, then it index [1] should not work. Only index [0] is
> valid for an XML instance;
> when you access [0] on an XML instance it returns the same instance.
>
> var xml:XML = <root><child/></root>
>
> trace(xml[1])//undefined
> trace(xml[0])//same as xml.toString()
>
> If it is an XMLList then it can have index values greater than zero.
>
>
> On Tue, Apr 28, 2020 at 4:19 PM serkan <serkan@likyateknoloji.com
> <ma...@likyateknoloji.com>> wrote:
>
> Hİ,
>
> The source below has the exception. Similar one was resolved for
> XMLList with https://github.com/apache/royale-asjs/issues/545
>
> The error line :
>
> function (value) { this.filterMenuData[1].setAttribute('label',
> value);},
>
> note : for the index 0 it works.
>
> Thanks,
> Serkan
>
>
>
> <?xml version="1.0" encoding="latin5" ?>
>
> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> <http://ns.adobe.com/mxml/2009>
> xmlns:s="library://ns.apache.org/royale/spark
> <http://ns.apache.org/royale/spark>"
> xmlns:mx="library://ns.apache.org/royale/mx
> <http://ns.apache.org/royale/mx>"
> height="288" width="179"
> >
> <fx:Metadata>
> [ResourceBundle("messages")]
> </fx:Metadata>
>
> <fx:Script>
> <![CDATA[
> ]]>
> </fx:Script>
>
> <fx:Declarations>
> <fx:XML format="e4x" id="filterMenuData">
> <menuitem
> label="{resourceManager.getString('messages', 'statusFilter')}"
> id="statusFilter">
> <menuitem
> label="{resourceManager.getString('messages', 'listAll')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'readyFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'waitingFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'workingFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'successfulFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'failedFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'timeoutFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'skippedFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'stoppedFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'pausedFilter')}"/>
> <menuitem
> label="{resourceManager.getString('messages', 'disabledFilter')}"/>
> </menuitem>
> </fx:XML>
> </fx:Declarations>
>
> </s:Application>
>
>
Re: XML construction from resource throws exception : TypeError:
Cannot read property 'setAttribute' of undefined
Posted by Greg Dove <gr...@gmail.com>.
if it is XML, then it index [1] should not work. Only index [0] is valid
for an XML instance;
when you access [0] on an XML instance it returns the same instance.
var xml:XML = <root><child/></root>
trace(xml[1])//undefined
trace(xml[0])//same as xml.toString()
If it is an XMLList then it can have index values greater than zero.
On Tue, Apr 28, 2020 at 4:19 PM serkan <se...@likyateknoloji.com> wrote:
> Hİ,
>
> The source below has the exception. Similar one was resolved for XMLList
> with https://github.com/apache/royale-asjs/issues/545
>
> The error line :
>
> function (value) { this.filterMenuData[1].setAttribute('label', value);},
>
> note : for the index 0 it works.
>
> Thanks,
> Serkan
>
>
>
> <?xml version="1.0" encoding="latin5" ?>
>
> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> <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:Metadata>
> [ResourceBundle("messages")]
> </fx:Metadata>
>
> <fx:Script>
> <![CDATA[
> ]]>
> </fx:Script>
>
> <fx:Declarations>
> <fx:XML format="e4x" id="filterMenuData">
> <menuitem label="{resourceManager.getString('messages',
> 'statusFilter')}" id="statusFilter">
> <menuitem label="{resourceManager.getString('messages',
> 'listAll')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'readyFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'waitingFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'workingFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'successfulFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'failedFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'timeoutFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'skippedFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'stoppedFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'pausedFilter')}"/>
> <menuitem label="{resourceManager.getString('messages',
> 'disabledFilter')}"/>
> </menuitem>
> </fx:XML>
> </fx:Declarations>
>
> </s:Application>
>
>
>