Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

special character??? How do I handle it??

Status
Not open for further replies.

qajussi

Programmer
Joined
Mar 22, 2004
Messages
236
Location
US
Hi!

I am converting HTML files to XML files.
I used the WORD CLEANER and TIDY.
There are characters like
©
­
.

When I tried to open the XML file, it gives me an error message and complain about those characters.

Do I need to change those before converting to XML??
OR do I handle this later with XSLT??

Can you help??
 
There are five predefined entities in XML that need special handling:

Entity References Character
&lt; <
&gt; >
&amp; &
&quot; "
&apos; '

You can escape the & with &apos; or you can put that context into a <![CDATA[ ]]> tag.
 
Do it with a DTD, where you can define your own entities that are equivalent to those that are pre-defined in HTML.

If your files are littered with HTML entities, get the XHTML DTD .ent files, which include all the entities that you can use in HTML. Go to


and look for section A2, Entity Sets, and download them (three files.) Then you'll need to define those as parameter entities in your DTD.
 
I've ran into that same problem. Rather than using the &copy; or &shy;, use &#169; and &#173;. My IE6 browser seemed to support the numeric characters in XML but not the shortened versions. For a table, go to . They have a list of character entities and their short and numeric versions.

"Ships that pass in the night and speak each other in passing;
Only a signal shown and a distant voice in the darkness;
So on the ocean of life we pass and speak one another,
Only a look and a voice; then darkness again and a silence."
- Henry Wadsworth Longfellow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top