private static void writeNodeContent( Node node, FileOutputStream fos, 
		String encoding, boolean pretty, int level ) throws IOException
	{
		boolean containedOnlyElements = true;
		NodeList children = node.getChildNodes();
		for ( int i=0;i<children.getLength();i++ )
		{
			Node child = children.item( i );
			switch ( child.getNodeType() )
			{
				case Node.ELEMENT_NODE:
					if ( pretty )
						writeLineEnd( fos, encoding, level );
					writeNode( child, fos, encoding, pretty, level+1 );
					break;
				case Node.TEXT_NODE:
					String nodeContent = child.getTextContent();
					nodeContent = escapeContent( nodeContent );
					fos.write( nodeContent.getBytes(encoding) );
					containedOnlyElements = false;
					break;
			}
		}
		if ( containedOnlyElements && pretty )
			writeLineEnd( fos, encoding, level-1 );
	}