Interface CustomXmlPart

All Known Implementing Classes:
BibliographyPart, ComponentsPart, ConditionsPart, CustomXmlDataStoragePart, DocPropsCoverPagePart, JaxbCustomXmlDataStoragePart, QuestionsPart, StandardisedAnswersPart, XPathsPart

public interface CustomXmlPart
There are two types of these: - JaxbCustomXmlDataStoragePart - CustomXmlDataStoragePart This interface doesn't provide getData, because the 2 types are quite different. But it could allow storeItemId to be get or set.
Author:
jharrop
  • Method Summary

    Modifier and Type Method Description
    java.lang.String cachedXPathGetString​(java.lang.String xpath, java.lang.String prefixMappings)
    Use org.apache.xpath.CachedXPathAPI, since this is much quicker than default javax.xml.xpath.XPath implementations (Apache's anyway) for large XML files.
    void discardCacheXPathObject()
    Use this to null out the org.apache.xpath.CachedXPathAPI object, which you should do if you've changed your source document, or want to reclaim memory.
    java.lang.String getItemId()  
    java.lang.String getXML()
    Get the XML as a String.
    boolean setNodeValueAtXPath​(java.lang.String xpath, java.lang.String value, java.lang.String prefixMappings)  
    void setXML​(org.w3c.dom.Document xmlDocument)
    Set the XML data
    java.util.List<org.w3c.dom.Node> xpathGetNodes​(java.lang.String xpathString, java.lang.String prefixMappings)  
    java.lang.String xpathGetString​(java.lang.String xpath, java.lang.String prefixMappings)  
  • Method Details

    • xpathGetString

      java.lang.String xpathGetString​(java.lang.String xpath, java.lang.String prefixMappings) throws Docx4JException
      Throws:
      Docx4JException
    • cachedXPathGetString

      java.lang.String cachedXPathGetString​(java.lang.String xpath, java.lang.String prefixMappings) throws Docx4JException
      Use org.apache.xpath.CachedXPathAPI, since this is much quicker than default javax.xml.xpath.XPath implementations (Apache's anyway) for large XML files. This is because Apache's old XPathAPI class instantiated a new XPathContext (and thus building a new DTMManager, and new DTMs) each time it was called. XPathAPIObject instead retains its context as long as the object persists, reusing the DTMs. There was the question of whether to declare it here or just implement it in CustomXmlDataStoragePart (since this is mostly of value in binding the user's XML data file). It is here since otherwise BindingHandler would fail on DocPropsCoverPagePart and StandardisedAnswersPart (both of which extend JaxbCustomXmlDataStoragePart).
      Parameters:
      xpath -
      prefixMappings -
      Returns:
      Throws:
      Docx4JException
      Since:
      3.3.1
      See Also:
      discardCacheXPathObject()
    • discardCacheXPathObject

      void discardCacheXPathObject()
      Use this to null out the org.apache.xpath.CachedXPathAPI object, which you should do if you've changed your source document, or want to reclaim memory.
      Since:
      3.3.1
    • xpathGetNodes

      java.util.List<org.w3c.dom.Node> xpathGetNodes​(java.lang.String xpathString, java.lang.String prefixMappings) throws Docx4JException
      Throws:
      Docx4JException
    • setNodeValueAtXPath

      boolean setNodeValueAtXPath​(java.lang.String xpath, java.lang.String value, java.lang.String prefixMappings) throws Docx4JException
      Parameters:
      xpath -
      prefixMappings -
      value -
      Throws:
      Docx4JException
      Since:
      3.0.1
    • getXML

      java.lang.String getXML() throws Docx4JException
      Get the XML as a String.
      Throws:
      Docx4JException
      Since:
      3.0.1
    • setXML

      void setXML​(org.w3c.dom.Document xmlDocument) throws Docx4JException
      Set the XML data
      Throws:
      Docx4JException
      Since:
      6.0.0
    • getItemId

      java.lang.String getItemId()
      Since:
      3.0.2