Class XMLDataSourceWriter

java.lang.Object
org.xml.sax.helpers.XMLFilterImpl
org.dom4j.io.XMLWriter
fr.becpg.repo.helper.XMLDataSourceWriter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler, XMLFilter, XMLReader

public class XMLDataSourceWriter extends org.dom4j.io.XMLWriter
dom4j writer that leaves out the characters XML 1.0 forbids.

dom4j writes a control character as a numeric reference () or as is in a CDATA section, and both make the document unreadable for the parser on the other side. Such characters come with text pasted from Word or Teams into any field, so they are dropped here, when the whole document is written, rather than at each place a value is added.

Author:
matthieu
  • Field Summary

    Fields inherited from class org.dom4j.io.XMLWriter

    DEFAULT_FORMAT, lastOutputNodeType, LEXICAL_HANDLER_NAMES, preserve, writer
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for XMLDataSourceWriter.
    Constructor for XMLDataSourceWriter.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    protected String
    protected void

    Methods inherited from class org.dom4j.io.XMLWriter

    characters, close, comment, createWriter, defaultMaximumAllowedCharacter, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, flush, getLexicalHandler, getMaximumAllowedCharacter, getOutputFormat, getProperty, handleException, ignorableWhitespace, indent, installLexicalHandler, isElementSpacePreserved, isEscapeText, isExpandEmptyElements, isNamespaceDeclaration, notationDecl, parse, println, processingInstruction, resolveEntityRefs, setDocumentLocator, setEscapeText, setIndentLevel, setLexicalHandler, setMaximumAllowedCharacter, setOutputStream, setProperty, setResolveEntityRefs, setWriter, shouldEncodeChar, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, write, write, write, write, write, write, write, write, write, write, write, write, write, writeAttribute, writeAttribute, writeAttributes, writeAttributes, writeClose, writeClose, writeComment, writeDeclaration, writeDocType, writeDocType, writeElement, writeElementContent, writeEmptyElementClose, writeEntity, writeEntityRef, writeEscapeAttributeEntities, writeNamespace, writeNamespace, writeNamespaces, writeNamespaces, writeNode, writeNodeText, writeOpen, writePrintln, writeProcessingInstruction, writeString

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.xml.sax.ContentHandler

    declaration
  • Constructor Details

  • Method Details

    • escapeElementEntities

      protected String escapeElementEntities(String text)
      Overrides:
      escapeElementEntities in class org.dom4j.io.XMLWriter
    • escapeAttributeEntities

      protected String escapeAttributeEntities(String text)
      Overrides:
      escapeAttributeEntities in class org.dom4j.io.XMLWriter
    • writeCDATA

      protected void writeCDATA(String text) throws IOException
      Overrides:
      writeCDATA in class org.dom4j.io.XMLWriter
      Throws:
      IOException