XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old September 5th, 2003, 05:50 AM
vroom vroom is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 7 vroom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Parsing a document with HTML entities

Hi all,

I've spend the last night googling, for a solution... I've learned a lot, but no solution to this:

I have to transform an xml document to an html fragment using XSL. For the original XML to contain special characters I have the following choices:

- Textdata in UTF-8 within CDATA sections
- named HTML entities
- named HTML entities within CDATA sections

Using numeric representation of entities is not possible, since the xml is produced by flash. So translating client-side is not possible due to performance resons, both for client and for server side (PHP) I am not able to find a function to translate to numeric entities.

When I try to parse the doc with XSLT, I either get an error due to using named entities, or the parser swallows special chars altogether, or it leaves the UTF-8 encoded character in. What I need though, is the output haveing named HTML entities.


I have found and tried the following solutions:

- Give the input xml (named entities without CDATA) an HTML DTD. The XSL Processor doesn't throw an error, but the output is still wrong
- Leave the input XML in UTF-8 without entity encoding and use a <xslutput method="html" encoding="UTF-8"/> to automatically transform the chars - no use
- both of the above with any comination of encoding/decoding to UTF-8 at serveral points during the program

The only thing that works is using <xslutput method="text" encoding="UTF-8"/> with named entities as input, but the the HTML tags in my XSL get swallowed, so that is no practical solution.


Any suggestions are very much appreciated, thanks in advance!

Last edited by vroom : September 5th, 2003 at 05:52 AM.

Reply With Quote
  #2  
Old September 5th, 2003, 04:50 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
I've had a lot of trouble with this in the past. The only thing I can suggest you look at is disable-output-escaping. You should be able to google for some help with that. The problems you're going to run into there is that disabling output escaping isn't a required portion of the w3c spec, so not all parsers support it (most do, though).

Reply With Quote
  #3  
Old September 6th, 2003, 12:18 PM
vroom vroom is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 7 vroom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes! Thanks a lot, works perfectly.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Parsing a document with HTML entities


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway