@Override public void openElement(String tagName){
  XMLElement newElement=new XMLElement();
  newElement.setName(tagName);
  current.addChild(newElement);
  stack.push(current);
  current=newElement;
}

@ Override public void openElement ( String tagName ) { XMLElement newElement = new XMLElement ( ) ; newElement . setName ( tagName ) ; current . addChild ( newElement ) ; stack . push ( current ) ; current = newElement ; }
puts a new element into the dom document . the new element is added as a child to the current element in the dom document . then it becomes the current element . the element must be closed using closeelement .
