Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Adding a new type of PI or comment to the XML/XHTML DTD

Reply
Thread Tools

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

 
 
sbwoodside
Guest
Posts: n/a
 
      02-14-2008
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 .....
 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      02-14-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML file from one DTD to another DTD test Java 2 07-28-2006 08:48 PM
? ELSE Conditional Comment / Using Conditional Comments Inside Other Tags To Comment Out Attributes Alec S. HTML 10 04-16-2005 02:21 AM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 AM
Removing the dtd name when using print(...) on the dtd generated class Joseph Tilian Java 0 12-21-2004 02:58 PM
Including a dtd into another dtd... possible? Asfand Yar Qazi XML 1 09-19-2003 12:10 PM



Advertisments