qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qexo-general] Canonical XML Output - possible bug?


From: Craig Munday
Subject: [Qexo-general] Canonical XML Output - possible bug?
Date: Tue, 29 Jul 2003 13:25:42 +1000

Hi,

I'm having trouble getting Qexo to produce canonical XML output.  Even
though I use the option --output-format xml I still see end tags formatted
as <empty-tag/>.

I had a look in the XMLPrinter.java class and noticed that the endGroup()
method will produce canonical output if the data member canonicalize is true
(which is the default) and htmlCompat is false.  As it happens htmlCompat is
initialised to true, and their no code to set this to false. 

public void endGroup(String typeName)
  {
    if (canonicalize && ! htmlCompat)
      closeTag();
    if (inStartTag)
      {
        super.write(isHtml
                 ? (isHtmlEmptyElementTag(typeName) ? ">" :
"></"+typeName+">")
                 : (htmlCompat ? " />" : "/>"));
        inStartTag = false;
      }
    else
      {
        super.write("</");
        super.write(typeName);
        super.write(">");
      }
    prev = '>';
    if (isHtml && ! escapeText
        && ("script".equals(typeName) || "style".equals(typeName)))
      escapeText = true;
  }

I assume that htmlCompat should have been initialised to false because the
setStyle() method also sets htmlCompat variable to true.  Could someone
(Per? :-) ) please confirm that this is a bug and offer and fix - I think
the fix is to initalise htmlCompat to false or to change the condition in
endGroup() guarding the call to closeTag().

public void setStyle (Object style)
  {
    this.style = style;
    if ("html".equals(style))
      {
        isHtml = true;
        htmlCompat = true;
      }
    if ("xhtml".equals(style))
      htmlCompat = true;
    if ("plain".equals(style))
      escapeText = false;
  }


Regards,
Craig.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]