private static void addAlignment(EXIOptions exiOptions, Document doc, Element startExiElement) {
   Element alignmentElement =
       doc.createElementNS(
           XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0, ALIGNMENT_KEY);
   alignmentElement.setTextContent(exiOptions.getAlignmentType().toString());
   startExiElement.appendChild(alignmentElement);
 }
  private static void addFidelity(EXIOptions exiOptions, Document doc, Element startExiElement) {
    List<Element> fidelityElements = Lists.newArrayList();
    createFidelityElement(doc, fidelityElements, exiOptions.getPreserveComments(), COMMENTS_KEY);
    createFidelityElement(doc, fidelityElements, exiOptions.getPreserveDTD(), DTD_KEY);
    createFidelityElement(
        doc, fidelityElements, exiOptions.getPreserveLexicalValues(), LEXICAL_VALUES_KEY);
    createFidelityElement(doc, fidelityElements, exiOptions.getPreservePIs(), PIS_KEY);
    createFidelityElement(doc, fidelityElements, exiOptions.getPreserveNS(), PREFIXES_KEY);

    if (fidelityElements.isEmpty() == false) {
      Element fidelityElement =
          doc.createElementNS(
              XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0, FIDELITY_KEY);
      for (Element element : fidelityElements) {
        fidelityElement.appendChild(element);
      }
      startExiElement.appendChild(fidelityElement);
    }
  }