/** * Writes back this element. * * @param tagName * The tag name of this element to be written. If null, this DOM node * must be a global element and its tag name will be used. * @param w * Receives XML infoset stream. */ public void writeTo(String tagName, XMLStreamWriter w) throws XMLStreamException { if(tagName==null) tagName = model.tagName; if(tagName==null) throw new IllegalArgumentException("Trying t write a local element "+this+" w/o a tag name"); w.writeStartElement(tagName); for (Map.Entry<String, String> attributeToWrite : attributesToWrite().entrySet()) { w.writeAttribute(attributeToWrite.getKey(), attributeToWrite.getValue()); } List<Child> localChildren = new ArrayList<Child>(children); for (Child c : localChildren) c.writeTo(w); w.writeEndElement(); }
/** * Writes back this element. * * @param tagName * The tag name of this element to be written. If null, this DOM node * must be a global element and its tag name will be used. * @param w * Receives XML infoset stream. */ public void writeTo(String tagName, XMLStreamWriter w) throws XMLStreamException { if(tagName==null) tagName = model.tagName; if(tagName==null) throw new IllegalArgumentException("Trying t write a local element "+this+" w/o a tag name"); w.writeStartElement(tagName); for (Map.Entry<String, String> attributeToWrite : attributesToWrite().entrySet()) { w.writeAttribute(attributeToWrite.getKey(), attributeToWrite.getValue()); } List<Child> localChildren = new ArrayList<Child>(children); for (Child c : localChildren) c.writeTo(w); w.writeEndElement(); }