/** * This <code>write</code> method will write the specified object * to the given XML element as as array entries. Each entry within * the given array must be assignable to the array component type. * Each array entry is serialized as a root element, that is, its * <code>Root</code> annotation is used to extract the name. * * @param source this is the source object array to be serialized * @param node this is the XML element container to be populated */ public void write(OutputNode node, Object source) throws Exception { int size = Array.getLength(source); for(int i = 0; i < size; i++) { Object item = Array.get(source, i); Class type = entry.getType(); root.write(node, item, type, parent); } node.commit(); } }
public static void write(OutputNode parent, Element domElement) throws Exception { OutputNode child = parent.getChild(domElement.getNodeName()); child.getNamespaces().setReference(domElement.getNamespaceURI(), domElement.getPrefix()); child.setValue(domElement.getTextContent()); child.commit(); } }
/** * This <code>write</code> method will write the specified object * to the given XML element as as array entries. Each entry within * the given array must be assignable to the array component type. * Each array entry is serialized as a root element, that is, its * <code>Root</code> annotation is used to extract the name. * * @param source this is the source object array to be serialized * @param node this is the XML element container to be populated */ public void write(OutputNode node, Object source) throws Exception { int size = Array.getLength(source); for(int i = 0; i < size; i++) { Object item = Array.get(source, i); Class type = entry.getType(); root.write(node, item, type, parent); } node.commit(); } }
/** * This <code>write</code> method will write the specified object * to the given XML element as as array entries. Each entry within * the given array must be assignable to the array component type. * Each array entry is serialized as a root element, that is, its * <code>Root</code> annotation is used to extract the name. * * @param source this is the source object array to be serialized * @param node this is the XML element container to be populated */ public void write(OutputNode node, Object source) throws Exception { int size = Array.getLength(source); for(int i = 0; i < size; i++) { Object item = Array.get(source, i); Class type = entry.getType(); root.write(node, item, type, parent); } node.commit(); } }
subList.commit();
/** * This will commit this element and any uncommitted elements * elements that are decendents of this node. For instance if * any child or grand child remains open under this element * then those elements will be closed before this is closed. * * @throws Exception this is thrown if there is an I/O error * or if a root element has not yet been created */ public void commit() throws Exception { if(stack.isEmpty()) { throw new NodeException("No root node"); } stack.bottom().commit(); }
/** * This will commit this element and any uncommitted elements * elements that are decendents of this node. For instance if * any child or grand child remains open under this element * then those elements will be closed before this is closed. * * @throws Exception this is thrown if there is an I/O error * or if a root element has not yet been created */ public void commit() throws Exception { if(stack.isEmpty()) { throw new NodeException("No root node"); } stack.bottom().commit(); }
/** * This will commit this element and any uncommitted elements * elements that are decendents of this node. For instance if * any child or grand child remains open under this element * then those elements will be closed before this is closed. * * @throws Exception this is thrown if there is an I/O error * or if a root element has not yet been created */ public void commit() throws Exception { if(stack.isEmpty()) { throw new NodeException("No root node"); } stack.bottom().commit(); }
/** * This <code>write</code> method is used to convert the provided * object to an XML element. This creates a child node from the * given <code>OutputNode</code> object. Once this child element * is created it is populated with the fields of the source object * in accordance with the XML schema class. * * @param source this is the object to be serialized to XML * @param expect this is the class that is expected to be written * @param name this is the name of the root annotation used * * @throws Exception thrown if there is a problem serializing */ public void write(OutputNode node, Object source, Class expect, String name) throws Exception { OutputNode child = node.getChild(name); Type type = getType(expect); if(source != null) { Class actual = source.getClass(); Decorator decorator = getDecorator(actual); if(decorator != null) { decorator.decorate(child); } if(!context.setOverride(type, source, child)) { getComposite(actual).write(child, source); } } child.commit(); }
/** * This <code>write</code> method is used to convert the provided * object to an XML element. This creates a child node from the * given <code>OutputNode</code> object. Once this child element * is created it is populated with the fields of the source object * in accordance with the XML schema class. * * @param source this is the object to be serialized to XML * @param expect this is the class that is expected to be written * @param name this is the name of the root annotation used * * @throws Exception thrown if there is a problem serializing */ public void write(OutputNode node, Object source, Class expect, String name) throws Exception { OutputNode child = node.getChild(name); Type type = getType(expect); if(source != null) { Class actual = source.getClass(); Decorator decorator = getDecorator(actual); if(decorator != null) { decorator.decorate(child); } if(!context.setOverride(type, source, child)) { getComposite(actual).write(child, source); } } child.commit(); }
/** * This <code>write</code> method is used to convert the provided * object to an XML element. This creates a child node from the * given <code>OutputNode</code> object. Once this child element * is created it is populated with the fields of the source object * in accordance with the XML schema class. * * @param source this is the object to be serialized to XML * @param expect this is the class that is expected to be written * @param name this is the name of the root annotation used * * @throws Exception thrown if there is a problem serializing */ public void write(OutputNode node, Object source, Class expect, String name) throws Exception { OutputNode child = node.getChild(name); Type type = getType(expect); if(source != null) { Class actual = source.getClass(); Decorator decorator = getDecorator(actual); if(decorator != null) { decorator.decorate(child); } if(!context.setOverride(type, source, child)) { getComposite(actual).write(child, source); } } child.commit(); }