all groups > flash actionscript > april 2006 >
You're in the

flash actionscript

group:

How To Set Bold, Italic, And Urls In Xml Files


How To Set Bold, Italic, And Urls In Xml Files Hrududu
4/17/2006 9:53:07 PM
flash actionscript:
I've been experimenting with XML. No doubt you guys have too.

Do any of you know how to set Bold, Italic, and URLs in an XML file? regular
<b>, <i>, and <a href> just don't kick in.

Thanks,

Hrududu
Re: How To Set Bold, Italic, And Urls In Xml Files blemmo
4/17/2006 10:55:27 PM
Hi,

XML isn't supposed to contain display information. It's common use to seperate
content and appearance, so that the XML contains only the data, and the display
information is defined in an extra file, a XSL or a CSS document.
Now for your question: what do you have in mind with your xml files? I think
Flash doesn't display raw xml, only html in html enabled textfields. If you
want to store html in a xml file, you have to escape the special characters
that form the xml (and also html) markup, otherwise the tags will get parsed as
another xml tag, or the parsing may fail completely. There are some predefined
replacements:
&amp; (&)
< (<)
[quoted text, click to view]
&apos; (')
' (")
So you could use it like this:
<link url="<a href='www.domain.org'>linktext</a>" />
The parser should generate this from that line:
<link url="<a href="www.domain.org">linktext</a>" />
You see that this screws up the xml's tag order, that's why you have to use
the escaped expressions. Then you could assign the value of the 'url' attribute
of the 'link' node to a html enabled textfield, which would display it as a
normal link.
FYI, Flash parses atrributes of a node faster than content (= the stuff
between opening and ending tag), so it's a good idea to have the data stored in
the attributes.

hth,
blemmo
Re: How To Set Bold, Italic, And Urls In Xml Files Hrududu
4/19/2006 8:29:34 PM
Hi Blemmo,

Thanks for replying. Let me be more specific.

I read the following article:
http://www.macromedia.com/devnet/flash/art...ctor_print.html

and while the prototype works great, I can't add Bold, Italic or Links.

Any ideas?
Re: How To Set Bold, Italic, And Urls In Xml Files blemmo
4/19/2006 8:38:12 PM
Re: How To Set Bold, Italic, And Urls In Xml Files Lacrymoc?phale
4/20/2006 12:00:00 AM
<link url="<a href='www.domain.org'>linktext</a>" />

I do not understand why this unuseful tricks.
<a href="www.domain.org">linktext</a> is a pure XML node with a text node
inside. No need to embed it for a parser. Just know how to build a
HTML-for-textField from XML.
Re: How To Set Bold, Italic, And Urls In Xml Files blemmo
4/20/2006 12:00:00 AM
Lacrymoc?phale,

you're right, it was just an example (maybe a strange one). I don't know what
the OP has in mind, but as he wants to use xml, and not html, I can imagine
that there is more info than just the url in a xml node. There sure are other
ways, and the example isn't very good indeed; I only wanted to show why html
embedded in xml may need some special treatment.

greets,
blemmo
Re: How To Set Bold, Italic, And Urls In Xml Files Lacrymoc?phale
4/20/2006 12:00:00 AM
It doesn't realy matter blemmo .
I just want Hrududu to not understanding false things.
As XHTML is XML, XHTML node can be use in XML document. I do not want him to
think that there is restriction on this.
After that, everyone create the XML shema he wants.
The fact that Hrududu haven't what he wants is not linked to the tag that he
quotes (cf.
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?hr
ef=00001799.html) but, probably, to how he handle and treat his XML
AddThis Social Bookmark Button