Adding a new type of PI or comment to the XML/XHTML DTD

S

sbwoodside

Hi there. I'm writing code in eRuby (aka ERB) which is basically XHTML
+ ruby code contained inside <% these kind of %> blocks. My editor
uses an XML parser which doesn't recognize these blocks and complains
about them. (oXygen/Xerces).

I spent a couple of hours looking at the DTDs to see how they
implement the existing processing instruction and comments blocks. But
I can't find it in there. The best I found was:

xhtml/dtd/xhtml1.dcl: PIC "?>"

Looks like it could mean "Processing Instruction Close"?

Anyway, is there even a way to modify the DTDs to allow the eRuby
block or would I have to edit the source code of Xerces?

--simon

PS I think that if eRuby had used <?ruby ?> things would be a lot
easier .....
 
J

Joseph Kesselman

sbwoodside said:
Hi there. I'm writing code in eRuby (aka ERB) which is basically XHTML
+ ruby code contained inside <% these kind of %> blocks. My editor
uses an XML parser which doesn't recognize these blocks and complains
about them. (oXygen/Xerces).

That's correct. The <%%> markup is simply not compatable with a normal
XML parser. It must be handled by a preprocessor of some kind, or by a
nonstandard parser specifically modified to handle it. You *may* be able
to process it using SGML tools rather than XML tools; I'm not sure about
that.
Anyway, is there even a way to modify the DTDs to allow the eRuby
block or would I have to edit the source code of Xerces?

No, there isn't. See above.
PS I think that if eRuby had used <?ruby ?> things would be a lot
easier .....

Absolutely. Or, perhaps better, use real XML elements in a namespace
reserved for this scripting markup.

If you're working with an XML-based language such as XHTML, there really
is no excuse these days for introducing non-XML-compatable syntax. Note
that Java Server pages, which seems to be where the <%%> syntax comes
from, eventually introduced an XML-compatable alternative. The eRuby
folks should be ***STRONGLY*** pressured to do likewise.
 

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,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top