public static Node addChildNode ( Document doc , Node parentNode , String childName , String childValue ) { if ( doc == null || parentNode == null || childName == null ) { return null ; } Node childNode = doc . createElement ( childName ) ; if ( childValue != null ) { childNode . setTextContent ( childValue ) ; } parentNode . appendChild ( childNode ) ; return childNode ; }
Add a child node