469,286 Members | 2,539 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,286 developers. It's quick & easy.

XML: "undefined entity"

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?!?!
Jul 20 '05 #1
3 8377
In article <cn**********@netlx020.civ.utwente.nl>,
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:
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
Jul 20 '05 #2
Tjerk Wolterink wrote:
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 |
-----------------------
Jul 20 '05 #3
Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote:
<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.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Chung Leong | last post: by
1 post views Thread by JKop | last post: by
13 posts views Thread by Don Vaillancourt | last post: by
4 posts views Thread by Flip | last post: by
49 posts views Thread by matty | last post: by
9 posts views Thread by Klaus Johannes Rusch | last post: by
2 posts views Thread by libsfan01 | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.