XML Entity won't parse inside MXML

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

XML Entity won't parse inside MXML

markdemich
I have some embbeded XML inside an MXML file that I'm feeding to an outline.  Some of my attributes need to have a quote character. It looks something like this

<mx:XMLList id="testXml">
<sample badattribute="&quot;ABC&quot;">
<test name="1"/>
<test name="2"/>
</sample>
<mx:XMLList>

This refuses to compile.

I even ran a test where I omitted, the badattribute from the xml and then in the code I did something like this,

testXml.@test = '"ABC"';
trace(textXml.toXMLString())

and it printed it out correctly using &quot; as the quote character.

Does anyone have a clue as to what's going on?

Thanks,
Mark



Reply | Threaded
Open this post in threaded view
|

Re: XML Entity won't parse inside MXML

Josh McDonald-5
The (xml source code) -> XML|XMLList stage in MXMLC isn't so good. Often I
need to embed XML as Binary objects, and go via String to parse it.

That's not much useful information though, so the answer to your problem is:

<mx:XMLList id="testXml">
<sample badattribute={"ABC"}>

<test name="1"/>
<test name="2"/>
</sample>
<mx:XMLList>
Note that despite the similar syntax I don't think these expressions are
updated when input changes the same way bindings are. They *might* be when
you're using .MXML, but the same syntax can be used to mix XML literals and
ActionScript expressions in .as files.

-Josh

2009/3/17 markdemich <[hidden email]>

>   I have some embbeded XML inside an MXML file that I'm feeding to an
> outline. Some of my attributes need to have a quote character. It looks
> something like this
>
> <mx:XMLList id="testXml">
> <sample badattribute="&quot;ABC&quot;">
> <test name="1"/>
> <test name="2"/>
> </sample>
> <mx:XMLList>
>
> This refuses to compile.
>
> I even ran a test where I omitted, the badattribute from the xml and then
> in the code I did something like this,
>
> testXml.@test = '"ABC"';
> trace(textXml.toXMLString())
>
> and it printed it out correctly using &quot; as the quote character.
>
> Does anyone have a clue as to what's going on?
>
> Thanks,
> Mark
>
>  
>



--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Josh 'G-Funk' McDonald
  -  [hidden email]
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/
Reply | Threaded
Open this post in threaded view
|

Re: XML Entity won't parse inside MXML

Josh McDonald-5
Also note that the curly braces go *outside* the quotes - if you were
putting the number 7 in your attribute, it would be

<element attr={7}/>

If you do this:

<element attr="{7}"/>

Then your attribute will have the value of "{7}" instead of "7".

-Josh

2009/3/17 Josh McDonald <[hidden email]>

> The (xml source code) -> XML|XMLList stage in MXMLC isn't so good. Often I
> need to embed XML as Binary objects, and go via String to parse it.
>
> That's not much useful information though, so the answer to your problem
> is:
>
> <mx:XMLList id="testXml">
> <sample badattribute={"ABC"}>
>
> <test name="1"/>
> <test name="2"/>
> </sample>
> <mx:XMLList>
> Note that despite the similar syntax I don't think these expressions are
> updated when input changes the same way bindings are. They *might* be when
> you're using .MXML, but the same syntax can be used to mix XML literals and
> ActionScript expressions in .as files.
>
> -Josh
>
> 2009/3/17 markdemich <[hidden email]>
>
>   I have some embbeded XML inside an MXML file that I'm feeding to an
>> outline. Some of my attributes need to have a quote character. It looks
>> something like this
>>
>> <mx:XMLList id="testXml">
>> <sample badattribute="&quot;ABC&quot;">
>> <test name="1"/>
>> <test name="2"/>
>> </sample>
>> <mx:XMLList>
>>
>> This refuses to compile.
>>
>> I even ran a test where I omitted, the badattribute from the xml and then
>> in the code I did something like this,
>>
>> testXml.@test = '"ABC"';
>> trace(textXml.toXMLString())
>>
>> and it printed it out correctly using &quot; as the quote character.
>>
>> Does anyone have a clue as to what's going on?
>>
>> Thanks,
>> Mark
>>
>>  
>>
>
>
>
> --
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> Josh 'G-Funk' McDonald
>   -  [hidden email]
>   -  http://twitter.com/sophistifunk
>   -  http://flex.joshmcdonald.info/
>
>


--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Josh 'G-Funk' McDonald
  -  [hidden email]
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/
Reply | Threaded
Open this post in threaded view
|

Re: XML Entity won't parse inside MXML

CougarGirl
This post has NOT been accepted by the mailing list yet.
this is exactly what I am dealing with. I have and mxml file that accesses an xml file for config values. There are lots of xml files accessed from many mxml files with similar values. What I need to do is set up another config/xml file that would hold ENTITIES, the xml files would access these and replace. this would make migrating through environments easier.
Anyway, this is a small sample of my XML file, it parsed properly in ie, but when running the application only sees the literal ENTITY value "&test;". Note: this is my first step, when I get this working, I want to eventually have these ENTITIES come from 1 central file.

<?xml version="1.0" ?>
<!DOCTYPE configuration  [
<!ENTITY test "http://someamazingwebsite">
]>


<configuration>
        <querytaskurl>&test;</querytaskurl>
        <zoomtolayers>layer1,layer2</zoomtolayers>
        <zoomtofields>field1,field2</zoomtofields>
</configuration>

thanks