PDA

Click to See Complete Forum and Search --> : XML & html tags.. help!



rachelcunliffe
06-27-2001, 10:34 PM
Hi there

I want to be able to use HTML tags in my xml - eg <b>this</b>. I choose the dynamic text box in Flash to be HTML and stick a tag in my xml but none of the text appears.

Any ideas?

THanks!

Rachel

VAYKENT
06-28-2001, 02:31 AM
One of the better ways I've found to deal with having HTML 'marked-up' data taken from an XML file, is to place some kind of attribute or tag on the data, that can be interpreted by the parser so that the parser knows what kind of HTML tag to place around the data.. that way, when the data is displayed in the text box, you'll have the strict HTML tags... if that made any sense....

rachelcunliffe
06-28-2001, 07:31 PM
Hi

I should say that I am just wanting to have one word in the middle of a sentence displayed differently - font, symbol, bold etc.

eg

Which is the best answer?

or

What is the value of [&mu;]?

where [] is replaced by the usual <>.

Any ideas?

VAYKENT
06-28-2001, 07:56 PM
First off - someone else probably has a better solution for this than me.. but like I said, unless you want to use more tags to better define your data, you'll need to use attributes inside the tags to define the data....

< top >
< first >
Which is the
< / first >
< bold >
best
< / bold >
< second >
way?
< / second >
< / top >

That was the 'better defined way'.... this could be the 'attributes defined way'....

< top >
< first startChar='14' length='4' type='bold' >
Which is the best way?
< / first >
< / top >


Anyway.....

tupps
06-28-2001, 08:17 PM
Could you embed the XML like this?

< top >
< text >
Which is the
< bold >
best
< / bold >
way?
< / text >
< / top >

I am not sure how you would read this in Flash?

Thanks

Luke

VAYKENT
06-28-2001, 08:31 PM
I prefer the attributs method of defining something like that... The 'more tags' way will just require getting info from the child node (bold) of the main node (text) and concatenating the three strings... (text)+(bold)+(text) so that you can get what you want.. ofcourse your dynamic text box has to be set for HTML.. and then in the string concatenation you'd need to add in the corresponding bold tags for HTML - < b > <b>text</b> < / b >... but it'd get you there.. I wouldn't do it... but it'd get you there...

rachelcunliffe
06-29-2001, 12:10 AM
< top >
< first >
Which is the
< / first >
< bold >
best
< / bold >
< second >
way?
< / second >
< / top >

ok, so excuse my slowness of catching on, say i did that.. then how do i get it to read into flash as actually bold? i set the dynamic text box as html, but how does it "bold" it?

VAYKENT
06-29-2001, 03:37 AM
Uhh... ok... uhh...

So where do I start... I'll start by assuming (yeah I know) that you've read all of the replies in this thread...

So it's easy. You tell your parser that when it sees the 'bold' node name that it's supposed to slap a < b > tag in front of the text contained inside the node... and a corresponding < / b > tag at the end.... so if you had our wonderfull example:

< first >
Which is the
< / first >
< bold >
best
< / bold >
< second >
way?
< / second >

Then the parser would come up with a string that looks like this:

Which is the < b > best < / b > way?

Then when you throw that string into the dynamic text box (which you set to handle HTML) it would come up with:

Which is the <b>best</b> way?

I really hope you don't want me to write all of the code for you... :)

rachelcunliffe
07-01-2001, 05:22 PM
Exellent thanks :) I will give it a go when I've recovered from Monday-morning sleepiness!

Rachel