krysalis-version/src/main/org/krysalis/version/util/dom DOMUtils.java,1.10,1.11

[email protected]
Newsgroups gmane.comp.krysalis.cvs
Message-ID <[email protected]>
Update of /cvsroot/krysalis/krysalis-version/src/main/org/krysalis/version/util/dom
In directory sc8-pr-cvs1:/tmp/cvs-serv6646/src/main/org/krysalis/version/util/dom

Modified Files:
	DOMUtils.java 
Log Message:
Start on environment analysis (comparison against a fixed base)

Index: DOMUtils.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-version/src/main/org/krysalis/version/util/dom/DOMUtils.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** DOMUtils.java	1 Nov 2003 00:36:57 -0000	1.10
--- DOMUtils.java	2 Nov 2003 22:11:11 -0000	1.11
***************
*** 58,61 ****
--- 58,62 ----
  import java.io.InputStream;
  import java.io.PrintWriter;
+ import java.io.Reader;
  import java.io.StringWriter;
  import java.lang.reflect.Constructor;
***************
*** 114,117 ****
--- 115,126 ----
  	}
  
+ 	public static Document deserialize(Reader data) throws Exception {
+ 		if (!l_initialized)
+ 			initialize();
+ 		Document doc =
+ 			(l_factory.newDocumentBuilder()).parse(new InputSource(data));
+ 		return doc;
+ 	}
+ 
  	public static String serialize(Node root) {
  		StringWriter sw = new StringWriter();
***************
*** 154,161 ****
  		boolean pretty,
  		boolean canonical) {
- 		if (pretty) {
- 			out.println(DebugUtils.getIndent(depth));
- 		}
- 
  		// is there anything to do?
  		if (node == null)
--- 163,166 ----
***************
*** 163,166 ****
--- 168,176 ----
  
  		short type = node.getNodeType();
+ 
+ 		if (type == Node.ELEMENT_NODE)
+ 			if (pretty)
+ 				out.print(DebugUtils.getIndent(depth));
+ 
  		switch (type) {
  			case Node.DOCUMENT_NODE :
***************
*** 197,200 ****
--- 207,212 ----
  					}
  					out.print('>');
+ 					if (pretty)
+ 						out.println();
  					out.flush();
  
***************
*** 254,257 ****
--- 266,271 ----
  				{
  					normalizeAndPrint(node.getNodeValue(), out, canonical);
+ 					if (pretty)
+ 						out.println();
  					out.flush();
  					break;
***************
*** 274,280 ****
--- 288,299 ----
  
  		if (type == Node.ELEMENT_NODE) {
+ 			if (pretty) {
+ 				out.print(DebugUtils.getIndent(depth));
+ 			}
  			out.print("</");
  			out.print(node.getNodeName());
  			out.print('>');
+ 			if (pretty)
+ 				out.println();
  			out.flush();
  		}
***************
*** 914,918 ****
  					if ((null != subhandler)
  						&& (DOMConsumer.class.isAssignableFrom(subhandler))) {
! 						
  						try {
  							Constructor c =
--- 933,937 ----
  					if ((null != subhandler)
  						&& (DOMConsumer.class.isAssignableFrom(subhandler))) {
! 
  						try {
  							Constructor c =




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.