XHTML in XML

B

Biblin

Is there a way of allowing XHTML tags in an XML document without including
them as #PCDATA?

I have a DTD for my document but want to include the XHTML DTD as well to
allow these extra tags. Can I do this and if so, how?

Thanks.
 
M

Martin Honnen

Biblin said:
Is there a way of allowing XHTML tags in an XML document without including
them as #PCDATA?

XHTML is XML so there is no problem to use it inside of an XML document e.g.
<root>
<description>
<p xmlns="http://www.w3.org/1999/xhtml">description goes here</p>
</description>
I have a DTD for my document but want to include the XHTML DTD as well to
allow these extra tags. Can I do this and if so, how?

DTDs are very restricted when it comes to have XML with elements from
different namespaces while a W3C schema is able to model such documents
well by having a schema for each targetNamespace and using <xs:import>
to import one schema into the other.

If you really need to combine DTDs then check http://www.w3.org/, there
are some definitions for markup languages combining XHTML and MathML for
instance.
 
B

Biblin

Will I be able to validate the page if I use XML Schema? All the online
validators I have seen only support DTD's.
 
P

Patrick TJ McPhee

% > I have a DTD for my document but want to include the XHTML DTD as well to
% > allow these extra tags. Can I do this and if so, how?
%
% DTDs are very restricted when it comes to have XML with elements from
% different namespaces while a W3C schema is able to model such documents
% well by having a schema for each targetNamespace and using <xs:import>
% to import one schema into the other.

It's not too difficult to combine DTDs. In this case:

<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
%xhtml;

The issue isn't even with namespaces -- it's with namespace prefixes. In
this case, you mustn't give the HTML elements a namespace prefix, and
you must declare the default namespace prefix like this

xmlns='http://www.w3.org/1999/xhtml'

.. If the XHTML DTD were written to support modularity, you would be able
to specify what the prefix is, but you wouldn't be able to vary it in
instances of your document.
 
G

Greg

Patrick said:
% > I have a DTD for my document but want to include the XHTML DTD as well to
% > allow these extra tags. Can I do this and if so, how?
%
% DTDs are very restricted when it comes to have XML with elements from
% different namespaces while a W3C schema is able to model such documents
% well by having a schema for each targetNamespace and using
% to import one schema into the other.

It's not too difficult to combine DTDs. In this case:

<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
%xhtml;

The issue isn't even with namespaces -- it's with namespace prefixes. In
this case, you mustn't give the HTML elements a namespace prefix, and
you must declare the default namespace prefix like this

xmlns='http://www.w3.org/1999/xhtml'

. If the XHTML DTD were written to support modularity, you would be able
to specify what the prefix is, but you wouldn't be able to vary it in
instances of your document.
--

Patrick TJ McPhee
East York Canada
(e-mail address removed)


Hi,

Is there an XML Schema document that defines XHTML 1.1 ? Or is really
defined only in a DTD? [1]

The closest I can find is a W3C "working draft" from February 2004
titled "Modularization of XHTML™ in XML Schema". [2] Not yet the
"recommendation" I was hoping for.

I'm looking for the value I would put in the "schemaLocation" attribute
of the "xsd:import" element that I would add to my own XML Schema
document so I can add XHTML to my XML instance document and still
validate it against my XML Schema (with Xerces 2.6.2, incidentally).

<xsd:import namespace="http://www.w3.org/1999/xhtml"
schemalocation="???"/>

Thanks,

Greg.

[1] http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
[2] http://www.w3.org/TR/xhtml-m12n-schema
 
W

Wole Ogunremi

http://www.w3.org/TR/xhtml1-schema/#schemas

Patrick said:
% > I have a DTD for my document but want to include the XHTML DTD as well to
% > allow these extra tags. Can I do this and if so, how?
%
% DTDs are very restricted when it comes to have XML with elements from
% different namespaces while a W3C schema is able to model such documents
% well by having a schema for each targetNamespace and using
% to import one schema into the other.

It's not too difficult to combine DTDs. In this case:

<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
%xhtml;

The issue isn't even with namespaces -- it's with namespace prefixes. In
this case, you mustn't give the HTML elements a namespace prefix, and
you must declare the default namespace prefix like this

xmlns='http://www.w3.org/1999/xhtml'

. If the XHTML DTD were written to support modularity, you would be able
to specify what the prefix is, but you wouldn't be able to vary it in
instances of your document.
--

Patrick TJ McPhee
East York Canada
(e-mail address removed)


Hi,

Is there an XML Schema document that defines XHTML 1.1 ? Or is really
defined only in a DTD? [1]

The closest I can find is a W3C "working draft" from February 2004
titled "Modularization of XHTMLT in XML Schema". [2] Not yet the
"recommendation" I was hoping for.

I'm looking for the value I would put in the "schemaLocation" attribute
of the "xsd:import" element that I would add to my own XML Schema
document so I can add XHTML to my XML instance document and still
validate it against my XML Schema (with Xerces 2.6.2, incidentally).

<xsd:import namespace="http://www.w3.org/1999/xhtml"
schemalocation="???"/>

Thanks,

Greg.

[1] http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
[2] http://www.w3.org/TR/xhtml-m12n-schema
 
D

David Dorward

Wole Ogunremi wrote:

Please don't top post or full quote, it makes it very difficult to follow
the flow of conversation.

To quote:
This document provides informative XML Schemas for XHTML 1.0 [XHTML1].
These Schemas are still work in progress, and are likely to change in
future updates.

The previous poster was looking for a _recommendation_ describing a scheme
for _XHTML_1.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

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top