You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Joachim Wackerow <wa...@zuma-mannheim.de> on 2006/03/15 10:14:30 UTC

Comments in DTD at wrong place?

writeDtdToFile can generate a DTD for the data specified in the model.

Comments are written to the DTD file inside the attribute declaration.
Is this really the right place? XML Spy reports an error. I am not sure,
if comments are allowed inside of the attribute declaration of a XML 
DTD. I didn't find an description where comments in a XML DTD are 
allowed. In a SGML DTD comments (starting with -- ) are allowed anywhere.

Is this a bug of DdlUtils or of XML Spy?

Example:
<!ELEMENT author EMPTY>
<!ATTLIST author
<!-- organisation: JDBC type: VARCHAR(50) -->
     author_id CDATA #REQUIRED
>

Perhaps the comments should stay before the attribute declaration like that:
<!ELEMENT author EMPTY>
<!-- organisation: JDBC type: VARCHAR(50) -->
<!ATTLIST author
     author_id CDATA #REQUIRED
>

The source file src/java/org/apache/ddlutils/io/DataDtdWriter.java is
responsible for that. I made a change to this file for my usage.

Achim


Re: Comments in DTD at wrong place?

Posted by Thomas Dudziak <to...@gmail.com>.
On 3/15/06, Joachim Wackerow <wa...@zuma-mannheim.de> wrote:

> In general I would prefer XML Schema. With XML Schema the data type
> definition is more detailled. For documentation a similar tool as dtddoc
> exists: xsddoc (http://xframe.sourceforge.net/xsddoc/). I am aware, that
> writing XML Schema's is more complicated than DTD's.

I'm not too fond of XML Schema because its way too complicated and
tool support is still not perfect. I'd much rather use RelaxNG.
That being said, I don't think that either would bring much benefit
because it would be quite difficult to determine XML type info that is
compatible to the Java/SQL types. And most users would turn it off
anyway because of the speed impact of the type checking.
Of course, you're welcome to write a Schema emitter for DdlUtils :-)

cheers,
Tom

Re: Comments in DTD at wrong place?

Posted by Joachim Wackerow <wa...@zuma-mannheim.de>.
Thomas Dudziak wrote:
> On 3/15/06, Joachim Wackerow <wa...@zuma-mannheim.de> wrote:
> 
>> writeDtdToFile can generate a DTD for the data specified in the model.
>>
>> Comments are written to the DTD file inside the attribute declaration.
>> Is this really the right place? XML Spy reports an error. I am not sure,
>> if comments are allowed inside of the attribute declaration of a XML
>> DTD. I didn't find an description where comments in a XML DTD are
>> allowed. In a SGML DTD comments (starting with -- ) are allowed anywhere.
>>
>> Is this a bug of DdlUtils or of XML Spy?
> 
> I didn't yet receive a complaint of an XML parser, but honestly, I
> didn't check the DTD grammar either. Anyway, I will change the
> generated DTD so that it follows the style of DTDDoc
> (http://dtddoc.sourceforge.net), so that one can generate nice HTML
> documentation out of it.
This is a good idea.

> Could you perhaps create an issue in JIRA ?
> 
> cheers,
> Tom

I created a bug issue in JIRA.

In general I would prefer XML Schema. With XML Schema the data type 
definition is more detailled. For documentation a similar tool as dtddoc 
exists: xsddoc (http://xframe.sourceforge.net/xsddoc/). I am aware, that 
writing XML Schema's is more complicated than DTD's.

Achim

Re: Comments in DTD at wrong place?

Posted by Thomas Dudziak <to...@gmail.com>.
On 3/15/06, Joachim Wackerow <wa...@zuma-mannheim.de> wrote:

> writeDtdToFile can generate a DTD for the data specified in the model.
>
> Comments are written to the DTD file inside the attribute declaration.
> Is this really the right place? XML Spy reports an error. I am not sure,
> if comments are allowed inside of the attribute declaration of a XML
> DTD. I didn't find an description where comments in a XML DTD are
> allowed. In a SGML DTD comments (starting with -- ) are allowed anywhere.
>
> Is this a bug of DdlUtils or of XML Spy?

I didn't yet receive a complaint of an XML parser, but honestly, I
didn't check the DTD grammar either. Anyway, I will change the
generated DTD so that it follows the style of DTDDoc
(http://dtddoc.sourceforge.net), so that one can generate nice HTML
documentation out of it.
Could you perhaps create an issue in JIRA ?

cheers,
Tom