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?

    --simon

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

  2. 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
    Joseph Kesselman, Feb 14, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph Tilian
    Replies:
    0
    Views:
    350
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,752
    Ronald Fischer
    Mar 17, 2005
  3. Alec S.
    Replies:
    10
    Views:
    10,121
    Alec S.
    Apr 16, 2005
  4. test
    Replies:
    2
    Views:
    2,015
    Oliver Wong
    Jul 28, 2006
  5. Replies:
    2
    Views:
    562
    Joe Kesselman
    Oct 5, 2006
Loading...

Share This Page