Class XjcObject

    • Constructor Summary

      Constructors 
      Constructor Description
      XjcObject()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void marshal​(java.io.OutputStream out, java.nio.charset.Charset encoding)
      Validates and streams this as formatted XML bytes with XML declaration.
      java.lang.String toString()
      Turns object into a formatted XML string by any means necessary.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • XjcObject

        public XjcObject()
    • Method Detail

      • marshal

        public void marshal​(java.io.OutputStream out,
                            java.nio.charset.Charset encoding)
                     throws XmlException
        Validates and streams this as formatted XML bytes with XML declaration.

        This object must be annotated with XmlRootElement, otherwise you should call toString(). This method will verify that your object strictly conforms to the schema defined in XjcXmlTransformer. Because the output is streamed, XmlException will most likely be thrown after output has been written.

        Parameters:
        out - byte-oriented output for writing XML. This method won't close it.
        encoding - should almost always be set to "UTF-8".
        Throws:
        XmlException
      • toString

        public java.lang.String toString()
        Turns object into a formatted XML string by any means necessary.

        No validation is performed and the XML declaration is omitted. If the object can't be marshalled, a string describing the error is returned.

        Overrides:
        toString in class java.lang.Object
        See Also:
        marshal(java.io.OutputStream, java.nio.charset.Charset)