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

Discussion in 'XML' started by sbwoodside, Feb 14, 2008.

  1. sbwoodside

    sbwoodside Guest

    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?


    PS I think that if eRuby had used <?ruby ?> things would be a lot
    easier .....
    sbwoodside, Feb 14, 2008
    1. Advertisements

  2. 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
    No, there isn't. See above.
    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.
    Joseph Kesselman, Feb 14, 2008
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.