?
Solved

HTML inside an XML document

Posted on 2007-04-11
4
Medium Priority
?
195 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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.
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.
Suggested Courses

777 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