com.saxonica.serialize

## Class XHTML5Emitter

- java.lang.Object
- - net.sf.saxon.serialize.Emitter
  - - net.sf.saxon.serialize.XMLEmitter
    - - com.saxonica.serialize.XHTML5Emitter

- All Implemented Interfaces:
    Result, Receiver

      public class XHTML5Emitter
      extends XMLEmitter

  XHTML5Emitter is an Emitter that generates XHTML 5 output. It is the same as XMLEmitter except that it follows the legacy HTML browser compatibility rules: for example, generating empty elements such as [BR /], and using [p][/p] for empty paragraphs rather than [p/]

- - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.serialize.XMLEmitter

      `characterReferenceGenerator, declarationIsWritten, elementCode, elementStack, indentForNextAttribute, openStartTag, started, startedElement, undeclareNamespaces`

    - ### Fields inherited from class net.sf.saxon.serialize.Emitter

      `allCharactersEncodable, characterSet, namePool, outputProperties, outputStream, pipelineConfig, streamResult, systemId, writer`

    - ### Fields inherited from interface javax.xml.transform.Result

      `PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XHTML5Emitter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `characters(CharSequence chars, int locationId, int properties)` Character data.
    `protected String` | `emptyElementTagCloser(String displayName, NodeName name)` Close an empty element tag.
    `protected void` | `writeDocType(NodeName name, String displayName, String systemId, String publicId)` Output the document type declaration
    `protected boolean` | `writeDocTypeWithNullSystemId()`

    - ### Methods inherited from class net.sf.saxon.serialize.XMLEmitter

      `attribute, close, closeStartTag, comment, endDocument, endElement, getAttributeIndentString, namespace, open, openDocument, processingInstruction, setCharacterReferenceGenerator, setEscapeNonAscii, setIndentForNextAttribute, startContent, startDocument, startElement, testCharacters, usesTypeAnnotations, writeAttribute, writeCharSequence, writeDeclaration, writeEscape`

    - ### Methods inherited from class net.sf.saxon.serialize.Emitter

      `getConfiguration, getOutputProperties, getOutputStream, getPipelineConfiguration, getSystemId, getWriter, makeOutputStream, makeWriter, setOutputProperties, setOutputStream, setPipelineConfiguration, setStreamResult, setSystemId, setUnparsedEntity, setWriter, usesWriter`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XHTML5Emitter

          public XHTML5Emitter()

  - ### Method Detail

    - #### writeDocType

          protected void writeDocType(NodeName name,
                          String displayName,
                          String systemId,
                          String publicId)
                               throws XPathException

      Output the document type declaration
      Overrides:
        `writeDocType` in class `XMLEmitter`
      Parameters:
        `name` - the qualified name of the element
        `displayName` - The element nam
        `systemId` - The DOCTYP system identifier
        `publicId` - The DOCTYPE public identifier
      Throws:
        `XPathException` - if an error occurs writing to the output

    - #### writeDocTypeWithNullSystemId

          protected boolean writeDocTypeWithNullSystemId()

      Overrides:
        `writeDocTypeWithNullSystemId` in class `XMLEmitter`

    - #### emptyElementTagCloser

          protected String emptyElementTagCloser(String displayName,
                                     NodeName name)

      Close an empty element tag.
      Overrides:
        `emptyElementTagCloser` in class `XMLEmitter`
      Parameters:
        `displayName` - the name of the empty element
        `name` - the fingerprint of the name of the empty element
      Returns:
        the string used to close an empty element tag.

    - #### characters

          public void characters(CharSequence chars,
                        int locationId,
                        int properties)
                          throws XPathException

      Character data.
      Specified by:
        `characters` in interface `Receiver`
      Overrides:
        `characters` in class `XMLEmitter`
      Parameters:
        `chars` - The characters
        `locationId` - an integer which can be interpreted using a `LocationProvider` to return information such as line number and system ID. If no location information is available, the value zero is supplied.
        `properties` - Bit significant value. The following bits are defined:
      DISABLE_ESCAPING
        Disable escaping for this text node
      USE_CDATA
        Output as a CDATA section
      Throws:
        `XPathException` - if an error occurs

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.