[jdom-interest] Issues with XMLOutputter

Gary Bentley gb at opengroup.org
Mon Sep 17 02:02:48 PDT 2001


Hi folks,

I am currently writing a subclass of XMLOutputter and I have a few 
queries/issues with it:

	1.  The actual indent used is not available...should I use indent ()?

	2.  The doIndent variable is not available...should I use indent()?

	3.  The expandEmptyElements variable is not available...if I override
	     printElement how do I know whether to expand empty elements?

	4.  The textNormalize variable is not available...does this matter for
	     printing out the content of an element?

	5.  It would be really useful to have printAttributes take in the indent
	     level since then you could "prettify" the attributes...i.e. not have to
	     print them on a single line, my personal preference for prettied
	     attributes is:

		<test a="hello"
		        b="hi there" />

	     Since this would probably break existing applications a new method
	     protected int getIndentLevel () would probably be better...or make the
	     indentLevel int protected.

	6.  If would be very useful to have a printContent that would handle the
	    printing of a object...i.e. so that I don't have to handle each type of
	    content explicitly in the printElement method, it could throw an
	    IllegalArgumentException if you passed the wrong type.

	    So you would pass it an Object, which would be a CDATA, Element
	    etc...and it would then call the relevant method...i.e.

		if (Object instanceof CDATA)
		{

		     printCDATA ...

		}

	7.  Who handles the new lines?  i.e. should I have to worry about it?
	     Especially if I override printElement?  i.e. when I close off the
	     tag with > should I put on a new line before calling printX.  Since
	     the newlines boolean is not available how do I know whether to?

	8.  When is printElement (without List) called as opposed to printElement
	     with the content List?

	9.  I presume printString is used for printing the actual content of the
	     element, i.e. the textual content, is this correct?  So I would use:

		printString (Element.getText ());

	     How does tie in with the normalizing of text? 	     

	10. If I override printElement effectively I am taking control of the whole
	     tree walk...is this true?  If so, having the variables available becomes
	     necessary...

Any and all thoughts on this would be appreciated...

Thanks,

Gary

-------------------------------------------------------



More information about the jdom-interest mailing list