P
Peter C. Chapin
I have a need to include Greek letters in some of my XML documents (the
documents contain astronomical information and many stars are named using
Greek letters). Following some earlier postings on the subject of
entities. I did the following
---- top of file ----
<?xml version="1.0"?>
<!-- I added this to an existing document. -->
<!DOCTYPE observation-set [
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
]>
<?xml-stylesheet type="text/xsl" href="AOML.xsl"?>
<!-- This is the existing document root. -->
<observation-set
xmlns="http://www.ecet.vtc.edu/~pchapin/AOML_0.0"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ecet.vtc.edu/~pchapin/AOML_0.0
AOML.xsd">
<!-- Now I believe I can use α, β, etc. here. -->
</observation-set>
---- end of file ----
I'm attempting to borrow the entity definitions that were created for
XHTML. I downloaded the file xhtml-symbol.ent from the W3C and have a
copy locally in the same folder as the XML document that references it.
My desire was to now be able to use things like α and β in my
XML document.
This mostly works. In particular, it works fine with IEv6. My XML
documents also validate (no complaints about undefined entities) with XSV
and XMLSpy (using MSXML, I believe). Also if I use Xalan to style
the document, it generates appropriate HTML. In fact I was able to prove
that Xalan is reading the external file containing the entity
definitions: I temporarily changed the definition of α to be the
same as β. When Xalan wrote its output it serialized the character I
had written as "α" in the XML document into "β" in the output
HTML document. Very cool.
However, with Mozilla v1.3 I get "undefined entity" errors. Even if I
include in the internal subset an explicit definition of the entities I'm
using, Mozilla still doesn't seem to notice them. Is this a problem with
Mozilla or am I missing something in my document? It is my desire to
support Mozilla so disregarding this problem is not really an option.
On a possibly related note, the Xerces (v2.3.0) parser seems to notice
the entities but it produces errors of this sort:
[Error] AO-2003-06-16.xml:16:75: Element type "observation-set" must be
declared.
The (line, column) of the error points to the end of the opening
observation-set tag. This error does not occur if I remove the <!DOCTYPE
observation-set [...]>. It almost seems as if Xerces sees the DOCTYPE
declaration and commits itself to the idea that a DTD is being used when,
in fact, the document uses an XML Schema. (It complains about all the
other elements as well, not just the document element). However, neither
XSV nor MSXML seemed to have that problem. Is this an issue with Xerces
or is mixing DOCTYPE and XML Schemas a bad thing?
Thanks for any clarification you can provide.
Peter
documents contain astronomical information and many stars are named using
Greek letters). Following some earlier postings on the subject of
entities. I did the following
---- top of file ----
<?xml version="1.0"?>
<!-- I added this to an existing document. -->
<!DOCTYPE observation-set [
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
]>
<?xml-stylesheet type="text/xsl" href="AOML.xsl"?>
<!-- This is the existing document root. -->
<observation-set
xmlns="http://www.ecet.vtc.edu/~pchapin/AOML_0.0"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ecet.vtc.edu/~pchapin/AOML_0.0
AOML.xsd">
<!-- Now I believe I can use α, β, etc. here. -->
</observation-set>
---- end of file ----
I'm attempting to borrow the entity definitions that were created for
XHTML. I downloaded the file xhtml-symbol.ent from the W3C and have a
copy locally in the same folder as the XML document that references it.
My desire was to now be able to use things like α and β in my
XML document.
This mostly works. In particular, it works fine with IEv6. My XML
documents also validate (no complaints about undefined entities) with XSV
and XMLSpy (using MSXML, I believe). Also if I use Xalan to style
the document, it generates appropriate HTML. In fact I was able to prove
that Xalan is reading the external file containing the entity
definitions: I temporarily changed the definition of α to be the
same as β. When Xalan wrote its output it serialized the character I
had written as "α" in the XML document into "β" in the output
HTML document. Very cool.
However, with Mozilla v1.3 I get "undefined entity" errors. Even if I
include in the internal subset an explicit definition of the entities I'm
using, Mozilla still doesn't seem to notice them. Is this a problem with
Mozilla or am I missing something in my document? It is my desire to
support Mozilla so disregarding this problem is not really an option.
On a possibly related note, the Xerces (v2.3.0) parser seems to notice
the entities but it produces errors of this sort:
[Error] AO-2003-06-16.xml:16:75: Element type "observation-set" must be
declared.
The (line, column) of the error points to the end of the opening
observation-set tag. This error does not occur if I remove the <!DOCTYPE
observation-set [...]>. It almost seems as if Xerces sees the DOCTYPE
declaration and commits itself to the idea that a DTD is being used when,
in fact, the document uses an XML Schema. (It complains about all the
other elements as well, not just the document element). However, neither
XSV nor MSXML seemed to have that problem. Is this an issue with Xerces
or is mixing DOCTYPE and XML Schemas a bad thing?
Thanks for any clarification you can provide.
Peter