try { Node node; while ((node = unmarshalNode()) != null) { list.add(node);
public void marshal(Object obj, IMarshallingContext ictx) throws JiBXException { // make sure the parameters are as expected if (!(obj instanceof List)) { throw new JiBXException("Mapped object not a java.util.List"); } else { try { // marshal content list with no indentation m_xmlWriter = ictx.getXmlWriter(); int indent = ictx.getIndent(); ictx.setIndent(-1); m_defaultNamespaceURI = null; for (Iterator iter = ((List)obj).iterator(); iter.hasNext();) { Object item = iter.next(); if (item instanceof Node) { marshalNode((Node)item); } else { throw new JiBXException ("List item is not an org.w3c.dom.Node"); } } ictx.setIndent(indent); } catch (IOException e) { throw new JiBXException("Error writing to document", e); } } }