You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2004/03/02 03:39:00 UTC

DO NOT REPLY [Bug 27353] New: - Indenting doesn't work well

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27353>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27353

Indenting doesn't work well

           Summary: Indenting doesn't work well
           Product: XalanJ2
           Version: 2.5
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xml.serializer
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: tencho@appresso.com


When in.xml is printed as indenting is true and indent is 2, 
expected output is expected.xml. But I got actual.xml.

===== in.xml =====
<?xml version="1.0"?>
<a><b>b</b>
<c>c</c>
</a>
===================

===== expected.xml =====
<?xml version="1.0"?>
<a>
  <b>b</b>
  <c>c</c>
</a>
=========================

===== actual.xml =====
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<a>
  <b>b</b>
<c>c</c>     <==== indenting not correct
</a>
======================

The test code is below : 

===== PrintXalan.java =====
import java.io.*;
import java.util.*;

import javax.xml.parsers.*;

import org.w3c.dom.*;
import org.xml.sax.*;

import org.apache.xml.serializer.*;

public class PrintXalan {

	public static void main (String[] args) throws Exception {
		String inputPath = "in.xml";
		String outputPath = "outXalan.xml";

		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		Document doc = builder.parse(new InputSource(new FileInputStream(inputPath)));

		OutputStream out = null;
		try {
			out = new FileOutputStream(outputPath);
			print(out, doc, "UTF-8", true, 2);
			out.flush();
		} finally {
			if (out != null) out.close();
		}
	}

	public static void print(OutputStream out,
													 Document doc,
													 String encoding,
													 boolean indenting,
													 int indent) throws Exception {
		Properties outputFormat =
			OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
		outputFormat.setProperty(OutputPropertiesFactory.S_KEY_INDENT_AMOUNT,
														 String.valueOf(indent));
		ToStream serializer = new ToXMLStream();
		serializer.setOutputFormat(outputFormat);
		
		serializer.setWriter(new OutputStreamWriter(out, encoding));
		serializer.setEncoding(encoding);
		serializer.setIndent(indenting);
		
		serializer.serialize(doc);
	}
}
===========================

RE: Possible build problem in Localization.mak

Posted by Brian Quinlan <br...@sweetapp.com>.
> You can never rebuild from a binary distribution -- only a source
> distribution.  In the past we only had one distribution which had both
> binaries and source, but we now follow the same model as Xerces-C.

This is probably what got me. I just grabbed the win32 version of Xalan like
I always have and tried to build.

> Brian is right that we should provide explicit instruction on what to do
> with each of the possible Xerces-C choices.

That seems like too much work. Why not just document it for one case, but be
explicit about the case that you have chosen?

Cheers,
Brian


RE: Possible build problem in Localization.mak

Posted by da...@us.ibm.com.



Hi all,

You can never rebuild from a binary distribution -- only a source
distribution.  In the past we only had one distribution which had both
binaries and source, but we now follow the same model as Xerces-C.  So:

   1. You cannot rebuild the core of Xalan from a binary distribution,
   although you can rebuild the samples.  For that reason, the version.incl
   file is might not be necessary in a binary distribution, but we should
   probably include it anyway.

   2. There should be no project or Makefiles in the binary distribution,
   except for the samples.

   3. We should clearly document what you need to rebuild Xalan, which is a
   Xalan source distribution, or a CVS tree, and a Xerces-C binary
   distribution, a Xerces-C source distribution, or a Xerces-C CVS tree.

Brian is right that we should provide explicit instruction on what to do
with each of the possible Xerces-C choices.

Thanks!

Dave



|---------+--------------------------->
|         |           June Ng         |
|         |           <june@ca.ibm.com|
|         |           >               |
|         |                           |
|         |           03/02/2004 07:19|
|         |           AM              |
|         |           Please respond  |
|         |           to xalan-dev    |
|---------+--------------------------->
  >-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                               |
  |        To:      xalan-dev@xml.apache.org                                                                                      |
  |        cc:      (bcc: David N Bertoni/Cambridge/IBM)                                                                          |
  |        Subject: RE: Possible build problem in Localization.mak                                                                |
  >-------------------------------------------------------------------------------------------------------------------------------|




Unfortunately our Windows binary is missing a number of files, if you want
to rebuild you should use the source package.

June K. Ng
XSLT Development
IBM Toronto Laboratory
Email: june@ca.ibm.com


                                                                           
 "Brian Quinlan"                                                           
 <br...@sweetapp.com>                                                      
                                                                        To 
                                                <xa...@xml.apache.org> 
 03/02/2004 02:15 AM                                                    cc 
                                                                           
                                                                   Subject 
          Please respond to                     RE: Possible build problem 
              xalan-dev                         in Localization.mak        
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





> Maybe it didn't make it into the source distribution?

No, it looks like it didn't make into the NT binary distribution. BTW, I'm
trying to build Xalan 1.7 on Windows in order to prove that it is
impossible
for the naive user to do so :-)

Here is my first comment: the build documentation [1] does not state
whether
it applies to a source or binary Xalan release and source or binary Xerces
release. From past experience, I know that only the binary release of
Xerces
contains an include directory ("Add the Xerces include directory..." [1])
so
I used the binary version of Xerces. The naive user might download the
source distribution and wonder where the include directory is. The binary
version of Xalan does not seem to be able to rebuild itself on Windows. So
you need the source version of Xalan and, if you want to follow the
documentation, the binary version of Xerces. This seems odd and is not
documented anywhere that I've seen.

[1] http://xml.apache.org/xalan-c/readme.html#win32

Cheers,
Brian




RE: Possible build problem in Localization.mak

Posted by June Ng <ju...@ca.ibm.com>.
Unfortunately our Windows binary is missing a number of files, if you want 
to rebuild you should use the source package.

June K. Ng
XSLT Development
IBM Toronto Laboratory
Email: june@ca.ibm.com




"Brian Quinlan" <br...@sweetapp.com> 
03/02/2004 02:15 AM
Please respond to
xalan-dev


To
<xa...@xml.apache.org>
cc

Subject
RE: Possible build problem in Localization.mak






> Maybe it didn't make it into the source distribution?

No, it looks like it didn't make into the NT binary distribution. BTW, I'm
trying to build Xalan 1.7 on Windows in order to prove that it is 
impossible
for the naive user to do so :-)

Here is my first comment: the build documentation [1] does not state 
whether
it applies to a source or binary Xalan release and source or binary Xerces
release. From past experience, I know that only the binary release of 
Xerces
contains an include directory ("Add the Xerces include directory..." [1]) 
so
I used the binary version of Xerces. The naive user might download the
source distribution and wonder where the include directory is. The binary
version of Xalan does not seem to be able to rebuild itself on Windows. So
you need the source version of Xalan and, if you want to follow the
documentation, the binary version of Xerces. This seems odd and is not
documented anywhere that I've seen.

[1] http://xml.apache.org/xalan-c/readme.html#win32 

Cheers,
Brian



RE: Possible build problem in Localization.mak

Posted by Brian Quinlan <br...@sweetapp.com>.
> Maybe it didn't make it into the source distribution?

No, it looks like it didn't make into the NT binary distribution. BTW, I'm
trying to build Xalan 1.7 on Windows in order to prove that it is impossible
for the naive user to do so :-)

Here is my first comment: the build documentation [1] does not state whether
it applies to a source or binary Xalan release and source or binary Xerces
release. From past experience, I know that only the binary release of Xerces
contains an include directory ("Add the Xerces include directory..." [1]) so
I used the binary version of Xerces. The naive user might download the
source distribution and wonder where the include directory is. The binary
version of Xalan does not seem to be able to rebuild itself on Windows. So
you need the source version of Xalan and, if you want to follow the
documentation, the binary version of Xerces. This seems odd and is not
documented anywhere that I've seen.

[1] http://xml.apache.org/xalan-c/readme.html#win32 

Cheers,
Brian


Re: Possible build problem in Localization.mak

Posted by June Ng <ju...@ca.ibm.com>.
I just checked the Windows source package .. the version.incl file is 
there under /xml-xalan/c.  Were you using the source package or did you 
extract your own copy from CVS?

June K. Ng
XSLT Development
IBM Toronto Laboratory
Email: june@ca.ibm.com




david_n_bertoni@us.ibm.com 
03/02/2004 12:42 AM
Please respond to
xalan-dev


To
xalan-dev@xml.apache.org
cc

Subject
Re: Possible build problem in Localization.mak










Hi Brian,

Xalan-C has its own version.incl -- it's in /xml-xalan/c.  You should have
it if you got the source from CVS.  Maybe it didn't make it into the 
source
distribution?

Dave



  
                      "Brian Quinlan"   
                      <brian@sweetapp.         To: 
<xa...@xml.apache.org>  
                      com>                     cc:      (bcc: David N 
Bertoni/Cambridge/IBM) 
                                               Subject: Possible build 
problem in Localization.mak 
                      03/01/2004 09:09   
                      PM   
                      Please respond   
                      to xalan-dev   
  



I am encountering a problem when building Xalan on Windows:

Localization.mak(49) : fatal error U1052: file
                       '..\..\..\..\..\version.incl' not found

version.incl seems to be located at the root of the xerces distribution.
I'm
not sure how that relative path gets you there.

Cheers,
Brian





Re: Possible build problem in Localization.mak

Posted by da...@us.ibm.com.



Hi Brian,

Xalan-C has its own version.incl -- it's in /xml-xalan/c.  You should have
it if you got the source from CVS.  Maybe it didn't make it into the source
distribution?

Dave



                                                                                                                                       
                      "Brian Quinlan"                                                                                                  
                      <brian@sweetapp.         To:      <xa...@xml.apache.org>                                                     
                      com>                     cc:      (bcc: David N Bertoni/Cambridge/IBM)                                           
                                               Subject: Possible build problem in Localization.mak                                     
                      03/01/2004 09:09                                                                                                 
                      PM                                                                                                               
                      Please respond                                                                                                   
                      to xalan-dev                                                                                                     
                                                                                                                                       



I am encountering a problem when building Xalan on Windows:

Localization.mak(49) : fatal error U1052: file
                       '..\..\..\..\..\version.incl' not found

version.incl seems to be located at the root of the xerces distribution.
I'm
not sure how that relative path gets you there.

Cheers,
Brian




Possible build problem in Localization.mak

Posted by Brian Quinlan <br...@sweetapp.com>.
I am encountering a problem when building Xalan on Windows:

Localization.mak(49) : fatal error U1052: file 
                       '..\..\..\..\..\version.incl' not found

version.incl seems to be located at the root of the xerces distribution. I'm
not sure how that relative path gets you there.

Cheers,
Brian