/** * This is used to write an element value to the resulting XML * document. This will search the nodes parents for the write * mode, if the mode is CDATA then that is what is used to write * the data, otherwise the value is written as plain text. * <p> * One side effect of this method is that it clears the value * of the output node once it has been written to the XML. This * is needed, it can however cause confusion within the API. * * @param node this is the node to write the value of */ private void writeValue(OutputNode node) throws Exception { Mode mode = node.getMode(); String value = node.getValue(); if(value != null) { for(OutputNode next : stack) { if(mode != Mode.INHERIT) { break; } mode = next.getMode(); } writer.writeText(value, mode); } node.setValue(null); }
/** * This is used to write an element value to the resulting XML * document. This will search the nodes parents for the write * mode, if the mode is CDATA then that is what is used to write * the data, otherwise the value is written as plain text. * <p> * One side effect of this method is that it clears the value * of the output node once it has been written to the XML. This * is needed, it can however cause confusion within the API. * * @param node this is the node to write the value of */ private void writeValue(OutputNode node) throws Exception { Mode mode = node.getMode(); String value = node.getValue(); if(value != null) { for(OutputNode next : stack) { if(mode != Mode.INHERIT) { break; } mode = next.getMode(); } writer.writeText(value, mode); } node.setValue(null); }
/** * This is used to write an element value to the resulting XML * document. This will search the nodes parents for the write * mode, if the mode is CDATA then that is what is used to write * the data, otherwise the value is written as plain text. * <p> * One side effect of this method is that it clears the value * of the output node once it has been written to the XML. This * is needed, it can however cause confusion within the API. * * @param node this is the node to write the value of */ private void writeValue(OutputNode node) throws Exception { Mode mode = node.getMode(); String value = node.getValue(); if(value != null) { for(OutputNode next : stack) { if(mode != Mode.INHERIT) { break; } mode = next.getMode(); } writer.writeText(value, mode); } node.setValue(null); }
/** * This <code>write</code> method will write the specified object * to the given XML element as as list entries. Each entry within * the given list must be assignable to the given primitive type. * This will deserialize each entry type as a primitive value. In * order to do this the parent string provided forms the element. * * @param source this is the source collection to be serialized * @param node this is the XML element container to be populated */ public void write(OutputNode node, Object source) throws Exception { OutputNode parent = node.getParent(); Mode mode = node.getMode(); if(!node.isCommitted()) { node.remove(); } write(parent, source, mode); }
/** * This <code>write</code> method will write the specified object * to the given XML element as as list entries. Each entry within * the given list must be assignable to the given primitive type. * This will deserialize each entry type as a primitive value. In * order to do this the parent string provided forms the element. * * @param source this is the source collection to be serialized * @param node this is the XML element container to be populated */ public void write(OutputNode node, Object source) throws Exception { OutputNode parent = node.getParent(); Mode mode = node.getMode(); if(!node.isCommitted()) { node.remove(); } write(parent, source, mode); }
/** * This <code>write</code> method will write the specified object * to the given XML element as as list entries. Each entry within * the given list must be assignable to the given primitive type. * This will deserialize each entry type as a primitive value. In * order to do this the parent string provided forms the element. * * @param source this is the source collection to be serialized * @param node this is the XML element container to be populated */ public void write(OutputNode node, Object source) throws Exception { OutputNode parent = node.getParent(); Mode mode = node.getMode(); if(!node.isCommitted()) { node.remove(); } write(parent, source, mode); }
/** * This <code>write</code> method will write the key value pairs * within the provided map to the specified XML node. This will * write each entry type must contain a key and value so that * the entry can be deserialized in to the map as a pair. If the * key or value object is composite it is read as a root object * so its <code>Root</code> annotation must be present. * * @param node this is the node the map is to be written to * @param source this is the source map that is to be written */ public void write(OutputNode node, Object source) throws Exception { OutputNode parent = node.getParent(); Mode mode = node.getMode(); Map map = (Map) source; if(!node.isCommitted()) { node.remove(); } write(parent, map, mode); }
/** * This <code>write</code> method will write the key value pairs * within the provided map to the specified XML node. This will * write each entry type must contain a key and value so that * the entry can be deserialized in to the map as a pair. If the * key or value object is composite it is read as a root object * so its <code>Root</code> annotation must be present. * * @param node this is the node the map is to be written to * @param source this is the source map that is to be written */ public void write(OutputNode node, Object source) throws Exception { OutputNode parent = node.getParent(); Mode mode = node.getMode(); Map map = (Map) source; if(!node.isCommitted()) { node.remove(); } write(parent, map, mode); }
/** * This <code>write</code> method will write the key value pairs * within the provided map to the specified XML node. This will * write each entry type must contain a key and value so that * the entry can be deserialized in to the map as a pair. If the * key or value object is composite it is read as a root object * so its <code>Root</code> annotation must be present. * * @param node this is the node the map is to be written to * @param source this is the source map that is to be written */ public void write(OutputNode node, Object source) throws Exception { OutputNode parent = node.getParent(); Mode mode = node.getMode(); Map map = (Map) source; if(!node.isCommitted()) { node.remove(); } write(parent, map, mode); }