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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sbwoodside

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

    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 .....
  • Joseph Kesselman

    #2
    Re: Adding a new type of PI or comment to the XML/XHTML DTD

    sbwoodside wrote:
    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.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden

    Comment

    Working...