XML: "undefined entity"

T

Tjerk Wolterink

Hello,

I've xml code that looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xc:xcontent
xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent"
xmlns="http://www.w3.org/1999/xhtml">

<xc:titel type="string"><![CDATA[Wat een he]]></xc:titel>
<xc:gelulA type="html">


<h2>HE hallo ik ben henk</h2>
<ul>
<li>
<p>hierna komt b</p>
</li>
</ul>

<p>Nou llllen dat kan ie wel zul je denken</p>

<p>&nbsp;</p>

</xc:gelulA>
</xc:xcontent>

This xml will be transformed by some xsl, but my problem:

xhtml entities like &nbsp; are not defined and there the xsl document cannot handle this xml document.
This xml document above is even not valid xml, how do i define the html entities?!?!
 
R

Richard Tobin

This xml document above is even not valid xml, how do i define the html
entities?!?!

You could put in a doctype declaration the includes the XHTML DTD, for
example:

<!DOCTYPE xc:content [
<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
%xhtml;
]>

or one that just includes the entity definitions:

<!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
%HTMLlat1;

or one that just defines the entities you use:

<!ENTITY nbsp " ">

-- Richard
 
P

Philippe Poulard

Tjerk said:
Hello,

I've xml code that looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xc:xcontent
xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent"
xmlns="http://www.w3.org/1999/xhtml">

<xc:titel type="string"><![CDATA[Wat een he]]></xc:titel>
<xc:gelulA type="html">


<h2>HE hallo ik ben henk</h2>
<ul>
<li>
<p>hierna komt b</p>
</li>
</ul>

<p>Nou llllen dat kan ie wel zul je denken</p>

<p>&nbsp;</p>

</xc:gelulA>
</xc:xcontent>

This xml will be transformed by some xsl, but my problem:

xhtml entities like &nbsp; are not defined and there the xsl document
cannot handle this xml document.
This xml document above is even not valid xml, how do i define the html
entities?!?!

hi,

xhtml is xml, not html ; in xml, there are only 5 predefined entities
(lt, gt, quot, apos, amp) ; others have to be defined ; however, as xml
supports unicode, you'd better use direct character entities, like this :

<p> </p>

(160 is the unicode character for "non breaking space")

--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
 
J

Jukka K. Korpela

Tjerk Wolterink said:
<p>&nbsp;</p>

Why would you do that in the first place? In the XHTML namespace, the <p>
element means 'paragraph'. What is a paragraph that consists of a single
character, a no-break space?

In bad old days in tagsoup HTML, it was relatively common to use empty
paragraphs for formatting. It's explicitly frowned upon in the HTML
specifications. You're supposed to use style sheets for creating vertical
spacing in a document's visual rendering.

Should you wish to use the no-break space, you can enter it directly as
an ISO 8859-1 character, for example, since your declared encoding is ISO
8859-1.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top