Class RawXmlElement

java.lang.Object
com.independentsoft.office.RawXmlElement

public class RawXmlElement extends Object
Captures the complete outer XML of an element subtree from a streaming reader and re-emits it verbatim.

This is used to preserve, during a load/save round trip, elements whose inner structure is not (yet) modelled as dedicated classes but whose content must not be lost (for example VML drawing defaults such as o:shapedefaults / o:shapelayout in settings.xml). The captured string is produced by read(javax.xml.stream.XMLStreamReader) positioned on the element's START_ELEMENT and stops once the matching END_ELEMENT has been consumed.

  • Method Details

    • read

      public static RawXmlElement read(XMLStreamReader reader) throws XMLStreamException
      Reads the current element subtree (the reader must be positioned on its START_ELEMENT) and returns its captured outer XML. After this call the reader is positioned on the element's END_ELEMENT.
      Parameters:
      reader - the reader, positioned on the start element to capture
      Returns:
      the captured element
      Throws:
      XMLStreamException - on a stream error
    • getLocalName

      public String getLocalName()
      Gets the local name of the captured element.
      Returns:
      the local name
    • getNamespaceUri

      public String getNamespaceUri()
      Gets the namespace URI of the captured element.
      Returns:
      the namespace URI
    • getOuterXml

      public String getOuterXml()
      Gets the captured outer XML.
      Returns:
      the outer XML
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public RawXmlElement clone()
      Overrides:
      clone in class Object