desNode.appendChild( ele ); copyNode( child, ele ); } else { copyNode( child, desNode );
desNode.appendChild(ele); if ("value-of".equals(child.getNodeName())) { copyValueOf(child, ele); } else { copyNode(child, ele); } } else { copyNode(child, desNode);
	private void copyNode( Node srcNode, Node desNode )	{		assert srcNode != null && desNode != null;		//In the definition of <code>org.w3c.dom.Node<code>, there are 12 kinds		// of nodes. Here only process the text, attribute and element types.		for ( Node child = srcNode.getFirstChild( ); child != null; child = child				.getNextSibling( ) )		{			//The child node is a text node or cdata section, and create it and			// return			if ( child.getNodeType( ) == Node.TEXT_NODE					|| child.getNodeType( ) == Node.CDATA_SECTION_NODE )			{				Text txtNode = desNode.getOwnerDocument( ).createTextNode(						child.getNodeValue( ) );				desNode.appendChild( txtNode );			}			//The child node is an element node. If it is supported, then			// create it and call this method on the child node recursively. If			// it is unsupported, then skip it and call this method recursively.			else if ( child.getNodeType( ) == Node.ELEMENT_NODE )			{				boolean bSupported = false;				if ( supportedTags.contains( child.getNodeName( ) ) )				{					bSupported = true;				}				//Check if it is a heading level				else if ( hn.matcher( child.getNodeName( ) ).matches( ) )				{					bSupported = true;				}				if ( bSupported )				{					//copy the element node					Element ele = null;					ele = desNode.getOwnerDocument( ).createElement(							child.getNodeName( ) );					// copy the attributes					for ( int i = 0; i < child.getAttributes( ).getLength( ); i++ )					{						Node attr = child.getAttributes( ).item( i );						ele.setAttribute( attr.getNodeName( ), attr								.getNodeValue( ) );					}					desNode.appendChild( ele );					copyNode( child, ele );				}				else				{					copyNode( child, desNode );				}			}		}	}