Subject: [xml2rfc] Diagnostics

From: Paul Kyzivat <[email-masked]>
Date: Sat, 07 Dec 2013 12:40:32 -0500

Yesterday I was trying to get an xml file that worked with the old 
xml2rfc to work with the new one. (On the web site.) I find I always 
have trouble with this, because the old one was much more lenient about 
what it would accept.

I was able to fix most problems (artwork not in a figure, lists not 
within a <t>), but I have a couple left that I can't find.

The main problem is that the error messages give line numbers that are 
totally bogus. At least the old tool usually gave a line number that 
fell reasonably near to the error. (Not great, but usable.) The new one 
seems to always give very small line numbers. (E.g., the line number 
might be reported as 1 or 2 or 19, while the actual error in on line 405.)

And when the errors are non-specific its really hard to find them. My 
remaining errors seem to be <t> within <t>, so I have nothing useful to 
look for.

The method I have evolved for using xml2rfc is to rerun it incrementally 
while I edit the xml, after almost every small change, so if I get an 
error I'll know what caused it. But this doesn't work for porting 
existing xml with errors. And its not very convenient even when possible.

(Note, I'm just editing xml with a text editor. I have no xml editor tools.)

Can the error messages be made more helpful?

	Thanks,
	Paul

---

From: Henrik Levkowetz <[email-masked]>
Date: Sat, 07 Dec 2013 19:22:00 +0100

Hi Paul,

> might be reported as 1 or 2 or 19, while the actual error in on line 405.)

That means something has broken.  Last time I checked the line numbers, they
were right.

Could you provide the input file or files you use, to make it easier to
reproduce exactly what you're seing?

> existing xml with errors. And its not very convenient even when possible.

Understood.

> Can the error messages be made more helpful?

That seems like a very worthwhile effort :-)  I'll take a look asap.

Best regards,

	Henrik

---

From: Paul Kyzivat <[email-masked]>
Date: Sat, 07 Dec 2013 13:57:43 -0500

> reproduce exactly what you're seing?

Attached. Its now reporting lines 20 and 21.

This works with the old xml2rfc.

> That seems like a very worthwhile effort :-)  I'll take a look asap.

	Thanks!!!!
	Paul

---

From: Paul Kyzivat <[email-masked]>
Date: Sat, 07 Dec 2013 14:05:44 -0500

BTW,

While its not my current problem, one problem I encounter frequently 
about diagnostics is when I enter text that has some forbidden 
characters. Especially when I enter text that has snippets of XML - 
often just <foo> run into text.

Of course I know better, but its easy to forget, especially when pasting 
in text from another source. Such things often result in errors showing 
up someplace far away. (Maybe it would be less bad if there were a 
matching </foo>.)

It would be *really* nice if such things could be detected as errors.

(I don't think an xml2rfc source is a place where it is good to ignore 
unknown elements, at least within <t>.)

	Thanks,
	Paul

---

From: Julian Reschke <[email-masked]>
Date: Sat, 07 Dec 2013 21:42:41 +0100

You can always use additional tools, such as JING or rfc2629.xslt.

Example output:

Warnings produced by validating using JING:

draft-ietf-siprec-metadata-14.xml:443:8: error: element "t" not allowed 
in this context
draft-ietf-siprec-metadata-14.xml:455:8: error: element "t" not allowed 
in this context
draft-ietf-siprec-metadata-14.xml:988:24: error: unfinished element
draft-ietf-siprec-metadata-14.xml:995:15: error: unfinished element
draft-ietf-siprec-metadata-14.xml:63:719: error: IDREF 
"I-D.ietf-siprec-architecture" without matching ID
draft-ietf-siprec-metadata-14.xml:623:79: error: IDREF "RFC4648" without 
matching ID
draft-ietf-siprec-metadata-14.xml:164:125: error: IDREF "RFC2141" 
without matching ID
draft-ietf-siprec-metadata-14.xml:503:140: error: IDREF "RFC3840" 
without matching ID
draft-ietf-siprec-metadata-14.xml:144:208: error: IDREF "RFC4566" 
without matching ID
draft-ietf-siprec-metadata-14.xml:164:244: error: IDREF "RFC3688" 
without matching ID
draft-ietf-siprec-metadata-14.xml:546:116: error: IDREF "RFC4796" 
without matching ID
draft-ietf-siprec-metadata-14.xml:944:172: error: IDREF "RFC3261" 
without matching ID
draft-ietf-siprec-metadata-14.xml:944:426: error: IDREF "RFC3261" 
without matching ID
draft-ietf-siprec-metadata-14.xml:945:287: error: IDREF "RFC3261" 
without matching ID
draft-ietf-siprec-metadata-14.xml:144:579: error: IDREF "RFC4574" 
without matching ID
draft-ietf-siprec-metadata-14.xml:319:215: error: IDREF "RFC3326" 
without matching ID
draft-ietf-siprec-metadata-14.xml:441:67: error: IDREF "RFC3325" without 
matching ID
draft-ietf-siprec-metadata-14.xml:622:58: error: IDREF "RFC4122" without 
matching ID
draft-ietf-siprec-metadata-14.xml:164:203: error: IDREF "RFC2648" 
without matching ID
draft-ietf-siprec-metadata-14.xml:63:626: error: IDREF "RFC6341" without 
matching ID
draft-ietf-siprec-metadata-14.xml:613:181: error: IDREF "RFC3339" 
without matching ID
draft-ietf-siprec-metadata-14.xml:71:75: error: IDREF "RFC2119" without 
matching ID

Debug output from rfc2629.xslt:

WARNING: t not allowed inside t (at line 443)
WARNING: t not allowed inside t (at line 455)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 975)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 989)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 989)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 989)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 989)
WARNING: the rfc include pseudo-attribute is not supported by this 
processor, see 
http://greenbytes.de/tech/webdav/rfc2629xslt/rfc2629xslt.html#examples.internalsubset 
for help. (at line 989)
WARNING: @initials 'Ram Mohan': did you mean 'Ram Mohan.'? (at line 12)
WARNING: @initials 'Parthasarathi': did you mean 'Parthasarathi.'? (at 
line 27)
WARNING: @initials 'Paul': did you mean 'Paul.'? (at line 39)
WARNING: The following target names do not exist: RFC6341 (at line 63), 
I-D.ietf-siprec-architecture (at line 63), RFC2119 (at line 71), RFC4566 
(at line 144), RFC4574 (at line 144), RFC2141 (at line 164), RFC2648 (at 
line 164), RFC3688 (at line 164), RFC3326 (at line 319), RFC3325 (at 
line 441), RFC3840 (at line 503), RFC4796 (at line 546), RFC3339 (at 
line 613), RFC4122 (at line 622), RFC4648 (at line 623), RFC3261 (at 
line 944), RFC3261 (at line 944), RFC3261 (at line 945) (at line 9)
INFO: The /rfc/front/workgroup should only be used for Working Group 
drafts (at line 10)
WARNING: @initials 'Ram Mohan': did you mean 'Ram Mohan.'? (at line 12)
WARNING: @initials 'Parthasarathi': did you mean 'Parthasarathi.'? (at 
line 27)
WARNING: @initials 'Paul': did you mean 'Paul.'? (at line 39)
ERROR: Undefined target: RFC6341 (at line 63)
ERROR: Undefined target: I-D.ietf-siprec-architecture (at line 63)
ERROR: Undefined target: RFC2119 (at line 71)
ERROR: Undefined target: RFC4566 (at line 144)
ERROR: Undefined target: RFC4574 (at line 144)
ERROR: Undefined target: RFC2141 (at line 164)
ERROR: Undefined target: RFC2648 (at line 164)
ERROR: Undefined target: RFC3688 (at line 164)
ERROR: Undefined target: RFC3326 (at line 319)
ERROR: Undefined target: RFC3325 (at line 441)
ERROR: Undefined target: RFC3840 (at line 503)
ERROR: Undefined target: RFC4796 (at line 546)
ERROR: Undefined target: RFC3339 (at line 613)
ERROR: Undefined target: RFC4122 (at line 622)
ERROR: Undefined target: RFC4648 (at line 623)
WARNING: artwork line too long: ' 
&lt;supervisor&gt;sip:[email-masked]&lt;/supervisor&gt;             ' 
(73 characters) (at line 639)
WARNING: artwork line too long: '          &lt;sessionrecordingassoc 
session_id="hVpd7YQgRW2nD22h7q60JQ=="&gt;' (71 characters) (at line 639)
WARNING: artwork line too long: ' 
&lt;disassociate-time&gt;2010-12-16T23:41:07Z&lt;/disassociate-time&gt;' 
(70 characters) (at line 734)
WARNING: artwork line too long: '        &lt;xs:attribute 
type="xs:string" name="protocol" default="SIP"/&gt;' (70 characters) (at 
line 763)
ERROR: Undefined target: RFC3261 (at line 944)
ERROR: Undefined target: RFC3261 (at line 944)
ERROR: Undefined target: RFC3261 (at line 945)
WARNING: missing text in street (at line 31)
WARNING: missing text in street (at line 43)

---

From: Henrik Levkowetz <[email-masked]>
Date: Wed, 11 Dec 2013 11:43:59 +0100

Hi Paul,

> Attached. Its now reporting lines 20 and 21.

Mystery solved.  It turns out that the file has mixed CR and LF line endings
(and no instance of CR LF).  xml2rfc should handle both unix and dos conventions,
on respective platforms, but it does not understand lone CRs as line endings,
and I'm not sure it should -- this is a convention unknown to me.  If I
convert all CRs to LF (or CRLF) xml2rfc reports this:

Parsing file tests/input/draft-ietf-siprec-metadata-14.nl.xml
ERROR: Unable to validate the XML document: tests/input/draft-ietf-siprec-metadata-14.nl.xml
 tests/input/draft-ietf-siprec-metadata-14.nl.xml: Line 438: Element t is not declared in t list of possible children
 tests/input/draft-ietf-siprec-metadata-14.nl.xml: Line 448: Element t is not declared in t list of possible children

Each of those points directly at the enclosing <t> which contains an unexpected
<t/> child element.

> This works with the old xml2rfc.

I'm thinking that we should handle this by warning about lone instances of
CR instead of trying to emulate the old xml2rfc.

Best regards,

	Henrik

---

From: Henrik Levkowetz <[email-masked]>
Date: Wed, 11 Dec 2013 12:16:19 +0100

Hi Paul,

> It would be *really* nice if such things could be detected as errors.

Yes.  I've made some tweaks for the next release, which will be 2.4.5,
to make the xml parser emit all errors, rather than just one and one
iteratively.  If there are syntax errors, you'll see the erroneously
included (unknown) tag simply mentioned in a syntax error, which should
trigger you to get rid of it; but if there are no syntax errors, you'll
instead get something like this:

  ERROR: Unable to validate the XML document: tests/input/draft-ietf-siprec-metadata-14.nl.xml
   tests/input/draft-ietf-siprec-metadata-14.nl.xml: Line 412: Element section content does not follow the DTD, expecting ((t | figure | texttable | iref)* , section*), got (figure foo t section section section)
   tests/input/draft-ietf-siprec-metadata-14.nl.xml: Line 433: No declaration for element foo

Where the last line indicates that <foo> isn't recognised as part of
the rfc2629 vocabulary.

> unknown elements, at least within <t>.)

Agreed.

Best regards,

	Henrik

---

From: Paul Kyzivat <[email-masked]>
Date: Wed, 11 Dec 2013 10:26:28 -0500

> convert all CRs to LF (or CRLF) xml2rfc reports this:

Thanks for pointing that out!

Ever since I moved to a Mac I've had sporadic trouble with line endings 
when picking things up from various sources. And in this case the file 
has been edited by multiple people, on both PCs and MACs.

I guess I'll have to find a tool that reliably cleans them up.

Regardless of whether xml2rfc should handle this - I don't know.
It seems that editing the file on multiple platforms can result in this.
Maybe the upload of xml for a draft should clean it up.

	Thanks,
	Paul