Solved

HTML inside an XML document

Posted on 2007-04-11
4
181 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Flash doesn't load in Iphone and Ipad 22 482
Action Script commands 5 234
free photo watermark software 5 77
black magic design 1 120
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now