Solved

HTML inside an XML document

Posted on 2007-04-11
4
187 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 500 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Adobe Flash Free Transform Tool 2 151
What process can I use to achieve this? 5 127
File drag and drop 6 152
You Tube Videos not playing 9 136
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

733 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