List of usage examples for com.liferay.portal.kernel.xml Document remove
public boolean remove(Comment comment);
From source file:com.liferay.dynamic.data.mapping.internal.util.DDMXMLImpl.java
License:Open Source License
@Override public String getXML(Document document, Fields fields) { Element rootElement = null;/*from w w w . j a va2 s . c o m*/ try { if (document != null) { rootElement = document.getRootElement(); } else { document = _saxReader.createDocument(); rootElement = document.addElement("root"); } Iterator<Field> itr = fields.iterator(true); while (itr.hasNext()) { Field field = itr.next(); List<Node> nodes = getElementsByName(document, field.getName()); for (Node node : nodes) { document.remove(node); } appendField(rootElement, field); } return document.formattedString(); } catch (IOException ioe) { throw new SystemException(ioe); } }