/** * This is used to create an <code>InputNode</code> that can be * used to read XML from the specified stream. The stream will * be positioned at the root element in the XML document. * * @param source this contains the contents of the XML source * * @throws Exception thrown if there is an I/O exception */ public static InputNode read(InputStream source) throws Exception { return read(PROVIDER.provide(source)); }
/** * This is used to create an <code>OutputNode</code> that can be * used to write a well formed XML document. The writer specified * will have XML elements, attributes, and text written to it as * output nodes are created and populated. * * @param result this contains the result of the generated XML * * @throws Exception this is thrown if there is an I/O error */ public static OutputNode write(Writer result) throws Exception { return write(result, new Format()); }
/** * This is used to create an <code>InputNode</code> that can be * used to read XML from the specified reader. The reader will * be positioned at the root element in the XML document. * * @param source this contains the contents of the XML source * * @throws Exception thrown if there is an I/O exception */ public static InputNode read(Reader source) throws Exception { return read(PROVIDER.provide(source)); }
/** * This is used to create an <code>OutputNode</code> that can be * used to write a well formed XML document. The writer specified * will have XML elements, attributes, and text written to it as * output nodes are created and populated. * * @param result this contains the result of the generated XML * * @throws Exception this is thrown if there is an I/O error */ public static OutputNode write(Writer result) throws Exception { return write(result, new Format()); }
/** * This is used to create an <code>InputNode</code> that can be * used to read XML from the specified stream. The stream will * be positioned at the root element in the XML document. * * @param source this contains the contents of the XML source * * @throws Exception thrown if there is an I/O exception */ public static InputNode read(InputStream source) throws Exception { return read(PROVIDER.provide(source)); }
/** * This is used to create an <code>OutputNode</code> that can be * used to write a well formed XML document. The writer specified * will have XML elements, attributes, and text written to it as * output nodes are created and populated. * * @param result this contains the result of the generated XML * * @throws Exception this is thrown if there is an I/O error */ public static OutputNode write(Writer result) throws Exception { return write(result, new Format()); }
/** * This is used to create an <code>InputNode</code> that can be * used to read XML from the specified reader. The reader will * be positioned at the root element in the XML document. * * @param source this contains the contents of the XML source * * @throws Exception thrown if there is an I/O exception */ public static InputNode read(Reader source) throws Exception { return read(PROVIDER.provide(source)); }
/** * This <code>write</code> method will traverse the provided object * checking for field annotations in order to compose the XML data. * This uses the <code>getClass</code> method on the object to * determine the class file that will be used to compose the schema. * If there is no <code>Root</code> annotation for the class then * this will throw an exception. The root annotation is the only * annotation required for an object to be serialized. * * @param source this is the object that is to be serialized * @param out this is where the serialized XML is written to * * @throws Exception if the schema for the object is not valid */ public void write(Object source, Writer out) throws Exception { write(source, NodeBuilder.write(out, format)); } }
/** * This is used to create an <code>InputNode</code> that can be * used to read XML from the specified stream. The stream will * be positioned at the root element in the XML document. * * @param source this contains the contents of the XML source * * @throws Exception thrown if there is an I/O exception */ public static InputNode read(InputStream source) throws Exception { return read(PROVIDER.provide(source)); }
/** * This <code>write</code> method will traverse the provided object * checking for field annotations in order to compose the XML data. * This uses the <code>getClass</code> method on the object to * determine the class file that will be used to compose the schema. * If there is no <code>Root</code> annotation for the class then * this will throw an exception. The root annotation is the only * annotation required for an object to be serialized. * * @param source this is the object that is to be serialized * @param out this is where the serialized XML is written to * * @throws Exception if the schema for the object is not valid */ public void write(Object source, Writer out) throws Exception { write(source, NodeBuilder.write(out, format)); } }
/** * This is used to create an <code>InputNode</code> that can be * used to read XML from the specified reader. The reader will * be positioned at the root element in the XML document. * * @param source this contains the contents of the XML source * * @throws Exception thrown if there is an I/O exception */ public static InputNode read(Reader source) throws Exception { return read(PROVIDER.provide(source)); }
/** * This <code>write</code> method will traverse the provided object * checking for field annotations in order to compose the XML data. * This uses the <code>getClass</code> method on the object to * determine the class file that will be used to compose the schema. * If there is no <code>Root</code> annotation for the class then * this will throw an exception. The root annotation is the only * annotation required for an object to be serialized. * * @param source this is the object that is to be serialized * @param out this is where the serialized XML is written to * * @throws Exception if the schema for the object is not valid */ public void write(Object source, Writer out) throws Exception { write(source, NodeBuilder.write(out, format)); } }
/** * This <code>read</code> method will read the contents of the XML * document from the provided source and populate the object with * the values deserialized. This is used as a means of injecting an * object with values deserialized from an XML document. If the * XML source cannot be deserialized or there is a problem building * the object graph an exception is thrown. * * @param value this is the object to deserialize the XML in to * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return the same instance provided is returned when finished * * @throws Exception if the object cannot be fully deserialized */ public <T> T read(T value, InputStream source, boolean strict) throws Exception{ return read(value, NodeBuilder.read(source), strict); }
/** * This <code>read</code> method will read the contents of the XML * document from the provided source and populate the object with * the values deserialized. This is used as a means of injecting an * object with values deserialized from an XML document. If the * XML source cannot be deserialized or there is a problem building * the object graph an exception is thrown. * * @param value this is the object to deserialize the XML in to * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return the same instance provided is returned when finished * * @throws Exception if the object cannot be fully deserialized */ public <T> T read(T value, Reader source, boolean strict) throws Exception{ return read(value, NodeBuilder.read(source), strict); }
/** * This <code>read</code> method will read the contents of the XML * document from the provided source and convert it into an object * of the specified type. If the XML source cannot be deserialized * or there is a problem building the object graph an exception * is thrown. The instance deserialized is returned. * * @param type this is the class type to be deserialized from XML * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return the object deserialized from the XML document * * @throws Exception if the object cannot be fully deserialized */ public <T> T read(Class<? extends T> type, Reader source, boolean strict) throws Exception { return read(type, NodeBuilder.read(source), strict); }
/** * This <code>read</code> method will read the contents of the XML * document from the provided source and convert it into an object * of the specified type. If the XML source cannot be deserialized * or there is a problem building the object graph an exception * is thrown. The instance deserialized is returned. * * @param type this is the class type to be deserialized from XML * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return the object deserialized from the XML document * * @throws Exception if the object cannot be fully deserialized */ public <T> T read(Class<? extends T> type, InputStream source, boolean strict) throws Exception { return read(type, NodeBuilder.read(source), strict); }
/** * This <code>read</code> method will read the contents of the XML * document from the provided source and convert it into an object * of the specified type. If the XML source cannot be deserialized * or there is a problem building the object graph an exception * is thrown. The instance deserialized is returned. * * @param type this is the class type to be deserialized from XML * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return the object deserialized from the XML document * * @throws Exception if the object cannot be fully deserialized */ public <T> T read(Class<? extends T> type, InputStream source, boolean strict) throws Exception { return read(type, NodeBuilder.read(source), strict); }
/** * This <code>read</code> method will read the contents of the XML * document from the provided source and convert it into an object * of the specified type. If the XML source cannot be deserialized * or there is a problem building the object graph an exception * is thrown. The instance deserialized is returned. * * @param type this is the class type to be deserialized from XML * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return the object deserialized from the XML document * * @throws Exception if the object cannot be fully deserialized */ public <T> T read(Class<? extends T> type, Reader source, boolean strict) throws Exception { return read(type, NodeBuilder.read(source), strict); }
/** * This <code>read</code> method will read the contents of the XML * document from the provided source and populate the object with * the values deserialized. This is used as a means of injecting an * object with values deserialized from an XML document. If the * XML source cannot be deserialized or there is a problem building * the object graph an exception is thrown. * * @param value this is the object to deserialize the XML in to * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return the same instance provided is returned when finished * * @throws Exception if the object cannot be fully deserialized */ public <T> T read(T value, Reader source, boolean strict) throws Exception{ return read(value, NodeBuilder.read(source), strict); }
/** * This <code>validate</code> method will validate the contents of * the XML document against the specified XML class schema. This is * used to perform a read traversal of the class schema such that * the document can be tested against it. This is preferred to * reading the document as it does not instantiate the objects or * invoke any callback methods, thus making it a safe validation. * * @param type this is the class type to be validated against XML * @param source this provides the source of the XML document * @param strict this determines whether to read in strict mode * * @return true if the document matches the class XML schema * * @throws Exception if the class XML schema does not fully match */ public boolean validate(Class type, Reader source, boolean strict) throws Exception { return validate(type, NodeBuilder.read(source), strict); }