Class XMLSerializer

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class XMLSerializer
    extends StandardSerializer
    This class serializes items as XML.
    Author:
    BaseX Team 2005-24, BSD License, Christian Gruen
    • Field Detail

      • indAttrLength

        protected long indAttrLength
        Attribute indentation length.
    • Method Detail

      • doctype

        protected void doctype​(byte[] type)
                        throws IOException
        Prints the document type declaration.
        Parameters:
        type - document type
        Throws:
        IOException - I/O exception
      • namespace

        protected void namespace​(byte[] prefix,
                                 byte[] uri,
                                 boolean standalone)
                          throws IOException
        Description copied from class: Serializer
        Serializes a namespace.
        Overrides:
        namespace in class Serializer
        Parameters:
        prefix - prefix
        uri - namespace URI
        standalone - standalone flag
        Throws:
        IOException - I/O exception
      • attribute

        protected void attribute​(byte[] name,
                                 byte[] value,
                                 boolean standalone)
                          throws IOException
        Description copied from class: Serializer
        Serializes an attribute.
        Overrides:
        attribute in class Serializer
        Parameters:
        name - name
        value - value
        standalone - standalone flag
        Throws:
        IOException - I/O exception
      • delimitAttribute

        protected void delimitAttribute()
                                 throws IOException
        Print the delimiter preceding an attribute inside of an opening or empty tag. This is attribute indentation, if enabled, for all but the first attribute, but at least a single space.
        Throws:
        IOException - I/O exception
      • text

        protected void text​(byte[] value,
                            FTPos ftp)
                     throws IOException
        Description copied from class: Serializer
        Serializes a text.
        Overrides:
        text in class Serializer
        Parameters:
        value - value
        ftp - full-text positions, used for visualization highlighting
        Throws:
        IOException - I/O exception
      • pi

        protected void pi​(byte[] name,
                          byte[] value)
                   throws IOException
        Description copied from class: Serializer
        Serializes a processing instruction.
        Overrides:
        pi in class Serializer
        Parameters:
        name - name
        value - value
        Throws:
        IOException - I/O exception
      • openDoc

        protected void openDoc​(byte[] name)
        Description copied from class: Serializer
        Opens a document.
        Overrides:
        openDoc in class Serializer
        Parameters:
        name - name
      • skipElement

        protected boolean skipElement​(ANode node)
        Description copied from class: Serializer
        Checks if an element should be skipped.
        Overrides:
        skipElement in class Serializer
        Parameters:
        node - node to be serialized
        Returns:
        result of check
      • printDoctype

        protected final void printDoctype​(byte[] type,
                                          String pub,
                                          String sys)
                                   throws IOException
        Prints the document type declaration.
        Parameters:
        type - document type
        pub - doctype-public parameter
        sys - doctype-system parameter
        Throws:
        IOException - I/O exception
      • printCT

        protected final boolean printCT​(boolean empty,
                                        boolean html)
                                 throws IOException
        Prints the content type declaration.
        Parameters:
        empty - empty flag
        html - method
        Returns:
        true if declaration was printed
        Throws:
        IOException - I/O exception