Solved

HTML inside an XML document

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
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 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.

743 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

11 Experts available now in Live!

Get 1:1 Help Now