Subject: Re: [Tools-discuss] XML2RFC tool, my confusion

From: Julian Reschke <[email-masked]>
Date: Sun, 01 May 2011 10:16:32 +0200

On 01.05.2011 01:41, Joel M. Halpern wrote:
> I am not sure who one is supposed to ask when one gets inexplicable
> errors from xml2rfc.

In doubt, one of the xml2rfc mailing lists. But this one is fine as well.

> Sine we have been warned that strict conformance will be necessary, I
> try to use the tool on the strict setting.

That's good. That being said: I'm not *sure* about the strict setting.

xml2rfc.tcl has it's own XML parser, and that one is broken, in that it 
accepts some cases of non-welformed XML. A new xml2rfc processor almost 
certainly will reject these files.

The "strict" setting will complain about some of the related problems, 
but not all of them (IMHO).

Furthermore, it will also check things that have nothing to do with the 
welformedness of the XML, such as the validity errors you are seeing.

(Remember that welformedness is independent of the vocabulary, while 
validity depends on the specific XML vocabulary as defined in the DTD).

> I am getting:
> Unable to Validate File
>
> INPUT: 330 ms (332 elems, 250 attrs, 1917 spaces, 38994 chars)
> [Error] INPUT:102:11: The content of element type "t" must match
> "(list|figure|xref|eref|iref|cref|spanx|vspace)".
> [Error] INPUT:665:15: The content of element type "section" must match
> "((t|figure|texttable|iref)*,section*)".

We're talking about 
<http://www.ietf.org/id/draft-iab-rfc-editor-model-v2-01.xml>, right? :-)

The nice thing with XML errors is that if you do not like those produced 
by tool A, asking a different tool might help.

So I tried "Jing":

$ java -jar jing.jar -i rfc2629.rng draft-iab-rfc-editor-model-v2-01.xml
draft-iab-rfc-editor-model-v2-01.xml:80:11: error: element "artwork" not 
allowed in this context
draft-iab-rfc-editor-model-v2-01.xml:672:27: error: element
"list" not allowed in this context
draft-iab-rfc-editor-model-v2-01.xml:960:18: error: unfinished element
draft-iab-rfc-editor-model-v2-01.xml:967:18: error: unfinished element

So in line 102, you have <artwork> nested inside <t>, but it's supposed 
not to.

In 672, you have <list> outside <t>, but it's supposed to be inside.

The other two messages are validity errors not catched by xml2rfc.tcl 
(use of the xml2rfc-specific reference inclusion mechanism).

> I presume that this is complaining about an opening <t> at line 102 and
> an opening <section> at line 665.
> The odd thing is that in each case, the tag in question immediately
> follows and end-tag of the same type.
> I have also tried assuming that the problem was the preceding paired
> tag. But the preceding start also immediately follows an end of the same
> type.
>
> I have tried opening the xml in Firefox, and it seems quite happy with
> the matching of tags.

That runs the file through an XML parser that doesn't validate, so only 
the welformedness is being checked. (and it confirms the file is OK from 
that perspective).

> Suggestions on how I diagnose this would be appreciated.
>
> Yours,
> Joel M. Halpern
>
> PS: Yes, everything seems to work fine if I turn off strict checking.

Yes, the problems it complains about will not cause the actual text 
generation to change.

Best regards, Julian