Solved

xml styles

Posted on 2014-04-14
3
279 Views
Last Modified: 2014-04-16
xml code:
<pageText><![CDATA[
<font color="#ffffff" size= "14px" face="Tahoma">OUR MAIN AIM HERE AT TICKTOCKIT</font><font color="#ffffff" size= "10px" face="Arial"> IS TO PROVIDE IT SUPPORT MAINLY FOR ALL WINDOWS BASED SYSTEMS. WE ALSO DEAL WITH LINUX AND MAC SYSTEMS IN A MORE LIMITED CAPACITY. TO GO STRAIGHT TO SUPPORT, CLICK ON THE SUPPORT MENU ABOVE AND FOLLOW THE INSTRUCTIONS TO ALLOW REMOTE ACCESS TO YOUR SYSTEM. THE CONTACTS MENU ABOVE WILL GIVE YOU FULL DETAILS OF HOW TO CONTACT US TO REQUEST A REMOTE SESSION OR TO ENQUIRE ABOUT / REQUEST OUR SERVICES</font>
--

In the above code I need to be able to change the type face to Arial, Tahoma,, Impact (or whatever face will be accepted) and use Bold (strong ) tags
Is this possible with xml?
Do I need to use css linking - if so how please
0
Comment
Question by:doctorbill
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 40000188
The main question is... how do you use the above XML

The issue is the following. All the HTML is wrapped in a CDATA section. Allthough it looks like HTML, in XML terms the HTML is a a simple text node and "<font" is not the start of a tag but simply a sequence of 4 characters starting with "&lt;"

Simple XML tools can not help you here. If you would use XSLT for instance, the entire pageText element is one giant text node
XSLT3 however has a html-parse function that could make that into genuine xhtml so you could use XPath for addressing and change the values
I know that PHP has a similar function (actually a lot of languages have some sort of wrapper around John Cowans TagSoup parser... google for it if you want the details)

So it all boils down to how you are using the XML

If you control the source XML, you should get rid of the CDATA serialisation and use (namespaced) embedded html. You would have better control then

You could pull out the pageText element content with a getSingleNode and process the text with a html parser function in a language that allows it and pass the node back in as a tree. All depends on how you work around this document

If nothing else is possible, develop some regexes or a text parser to just sneak in the right values. Though task ahead in that case
0
 

Author Comment

by:doctorbill
ID: 40001258
The code is being used by flash in a website
0
 

Author Closing Comment

by:doctorbill
ID: 40004710
Possible solution
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

823 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