Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

HTML inside an XML document

Posted on 2007-04-11
4
Medium Priority
?
200 Views
Last Modified: 2010-04-03
Hi Folks,

I have the following code in an XML document

<Category label ="Commands">
      <Points label="100" url="images260/g10.jpg" question = "What is <b>your</b> name" description = "Please Enter Name"/>       
</Category>

I want to change the color of a single word or words in the question field. Basically i want to use HTML inside the question area.

How do i do that? I am loading this xml document into flash

Thanks

RG
0
Comment
Question by:rgarimella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Blixtsystems
ID: 18893901
You can either replace the "<" and ">"  with their corresponding entity references "&lt;" and "&gt;" to avoid the disruption of the parser or you can use CDATA to make sure the contents is ignored by the parser.

So the XML in your example would look like this:

<Category label ="Commands">
      <Points label="100" url="images260/g10.jpg" question = "What is &lt;b&gt;your&lt;/b&gt; name" description = "Please Enter Name"/>      
</Category>

Or using CDATA:
<Category label ="Commands">
      <Points label="100" url="images260/g10.jpg" question = "<![CDATA[What is <b>your</b> name]]>" description = "Please Enter Name"/>      
</Category>

Here is a page with some more info:
http://www.w3schools.com/xml/xml_cdata.asp
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 18895167
I suggest not to use HTML data as attributes, because you can't use <CDATA> for attribute value,
 keep it as nodevalue and in CDATA

I have done a sample version which work perferctly
please download and reveiw it..
http://www.4shared.com/file/13574307/5d156978/html_data_through_XML.html


- Aneesh Chopra
0
 

Author Comment

by:rgarimella
ID: 18897815
Hi Aneesh,

I already have a parser that works in flash. How can I change/modify my XML document sampled below so that it loads with the CDATA tag

thanks

<Category label ="Commands">
      <Points label="100" url="images260/g10.jpg" question = "What is <b>your</b> name" description = "Please Enter Name"/>      
</Category>
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 2000 total points
ID: 18898473
As I said in earlier comment,

you can't use <CDATA> with attributes,
first of all you need to change ur XML structure and move question data to nodeValue, then you can apply <CDATA> to nodeValue
accordingly ur parser also need to be modified..

I suggest the following updated XML structure:

<Category label ="Commands">
      <Points label="100" url="images260/g10.jpg" description = "Please Enter Name">
       <![CDATA[What is <b>your</b> name]]>
        </Points>      
</Category>

- Aneesh Chopra
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question