Hi all,

After upgrading from xalan-c 1.4 to the svn version we encountered a problem with omit-xml-declaration=yes being ignored when standalone=no is used.

The cause of this issue seems similar to what was mentioned in XALANC-442, which is marked as duplicate of XALANC-421. However the issue is still present svn HEAD as of today 28-AUG-2009.

In the transformed document, omit-xml-declaration=yes is ignored if the
standalone attribute is present, even if standalone=no. It seems to me
that the problem is in src/xalanc/XMLSupport/XalanXMLSerializerBase.cpp,
XalanXMLSerializerBase constructor where theStandalone.length() is checked:

  m_shouldWriteXMLHeader(xmlDecl == true ? true : theStandalone.length()
!= 0),

This forces writing the XML header always even if theStandalone == "no".

I have attached a patch that I used to fix the problem for us.

Best regards,
Sampo Ahokas
OpenTTCN Ltd



--- xalan-c-trunk/src/xalanc/XMLSupport/XalanXMLSerializerBase.cpp      
2009-08-03 16:26:10.000000000 +0300
+++ xalan-c-trunk-patched/src/xalanc/XMLSupport/XalanXMLSerializerBase.cpp      
2009-08-28 15:44:35.000000000 +0300
@@ -106,7 +106,7 @@
     m_encoding(theEncoding, theManager),
     m_needToOutputDoctypeDecl(false),
     // We must write the XML declaration if standalone is specified
-    m_shouldWriteXMLHeader(xmlDecl == true ? true : theStandalone.length() != 
0),
+    m_shouldWriteXMLHeader(xmlDecl == true ? true : 
compareIgnoreCaseASCII(theStandalone, XalanDOMString("yes")) == 0),
     m_elemStack(theManager)
 {
     setXMLVersion(theXMLVersion);


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
For additional commands, e-mail: xalan-dev-h...@xml.apache.org

Reply via email to