Subject: [xml2rfc] #299 (Version 2 cli): wrong filename displayed in error message if reference include has error

From: "xml2rfc issue tracker" <[email-masked]>
Date: Wed, 24 Jun 2015 20:37:03 -0000

#299: wrong filename displayed in error message if reference include has error

 With xml2rfc v2.5.0, if an included reference file has an error, the error
 message displays the document filename not the reference filename.

 To reproduce:
   1. Create `foo.xml` with the following contents:
     {{{
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
 <rfc category="std" docName="foo" ipr="trust200902">
   <front>
     <title>foo</title>
     <author fullname="Firstname Lastname" initials="F."
 surname="Lastname"/>
     <date/>
   </front>
   <middle>
     <section title="Introduction">
       <t><xref target="badref"/></t>
     </section>
   </middle>
   <back>
     <references title="Normative References">
       <?rfc include="badref.xml"?>
     </references>
   </back>
 </rfc>
     }}}
   2. Create `~/.cache/xml2rfc/badref.xml` with the following contents:
     {{{
 <?xml version='1.0' encoding='UTF-8'?>
 <reference anchor='badref'>
   <front>
     <title>badref title</title>
     <!-- missing <author/> -->
     <date/>
   </front>
 </reference>
     }}}
   3. Run `xml2rfc foo.xml`.  You'll get the following output:
     {{{
 Parsing file foo.xml
 ERROR: Unable to validate the XML document: foo.xml
  foo.xml: Line 3: Element front content does not follow the DTD, expecting
 (title , author+ , date , area* , workgroup* , keyword* , abstract? ,
 note*), got (title date)
     }}}

 Notice how the error message says `foo.xml` when it should say
 `~/.cache/xml2rfc/badref.xml`.

 Ideally the error would say something like this:
 {{{
 ERROR: Unable to validate the XML document: foo.xml
  foo.xml: Line 16: Error in included file
  ~/.cache/xml2rfc/badref.xml: Line 3: Element front content does not
 follow the DTD, expecting (title , author+ , date , area* , workgroup* ,
 keyword* , abstract? , note*), got (title date)
 }}}

-- 
-----------------------------+----------------------------------
 Reporter:  [email-masked]  |      Owner:  [email-masked]
     Type:  defect           |     Status:  new
 Priority:  medium           |  Milestone:
Component:  Version 2 cli    |    Version:
 Keywords:                   |
-----------------------------+----------------------------------

Ticket URL: <http://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/299>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>