/** * Sets the <i>keepAsOriginalNodes<i> * * The nodes whose names match the <i>keepAsOriginalNodes<i> will be kept as original, meaning * that no white space treaming will occur on them * * @param keepAsOriginalNodes of the nodes to be kept as original * @deprecated Use {@link ParserConfiguration#setXmlDisableWhitespaceTrimmingOnNodeNames(Set)} instead. That method works exactly the same as this one but has been renamed for a more clear meaning. */ @Deprecated() public void setKeepAsOriginalNodes(String[] keepAsOriginalNodes) { getParserConfiguration().setXmlDisableWhitespaceTrimmingOnNodeNames(keepAsOriginalNodes); }
/** * Sets the <i>keepAsOriginalNodes<i> * * @deprecated Use {@link ParserConfiguration#getXmlDisableWhitespaceTrimmingOnNodeNames()} instead */ @Deprecated public String[] getKeepAsOriginalNodes() { return getParserConfiguration().getXmlDisableWhitespaceTrimmingOnNodeNames().toArray(new String[getParserConfiguration().getXmlDisableWhitespaceTrimmingOnNodeNames().size()]); }
/** * Sets the <i>keepAsOriginalNodes<i> * * @deprecated Use {@link ParserConfiguration#getXmlDisableWhitespaceTrimmingOnNodeNames()} instead */ @Deprecated public String[] getKeepAsOriginalNodes() { return getParserConfiguration().getXmlDisableWhitespaceTrimmingOnNodeNames().toArray(new String[getParserConfiguration().getXmlDisableWhitespaceTrimmingOnNodeNames().size()]); }
/** * Sets the <i>keepAsOriginalNodes<i> * * The nodes whose names match the <i>keepAsOriginalNodes<i> will be kept as original, meaning * that no white space treaming will occur on them * * @param keepAsOriginalNodes of the nodes to be kept as original * @deprecated Use {@link ParserConfiguration#setXmlDisableWhitespaceTrimmingOnNodeNames(Set)} instead. That method works exactly the same as this one but has been renamed for a more clear meaning. */ @Deprecated() public void setKeepAsOriginalNodes(String[] keepAsOriginalNodes) { getParserConfiguration().setXmlDisableWhitespaceTrimmingOnNodeNames(keepAsOriginalNodes); }
/** * Checks if <code>Node</code> content should be kept as original (ie.: whitespaces won't be * removed) * * @param node The target <code>Node</code> * @return boolean <code>true</code> if whitespaces should not be removed from node content, * <code>false</code> otherwise */ protected boolean keepAsOriginal(Node node) { if (getParserConfiguration().isXmlDisableWhitespaceTrimmingOnAllNodes()) { return true; } return (node.getNodeName() != null) && getParserConfiguration().getXmlDisableWhitespaceTrimmingOnNodeNames().contains(node.getNodeName()); }
/** * Checks if <code>Node</code> content should be kept as original (ie.: whitespaces won't be * removed) * * @param node The target <code>Node</code> * @return boolean <code>true</code> if whitespaces should not be removed from node content, * <code>false</code> otherwise */ protected boolean keepAsOriginal(Node node) { if (getParserConfiguration().isXmlDisableWhitespaceTrimmingOnAllNodes()) { return true; } return (node.getNodeName() != null) && getParserConfiguration().getXmlDisableWhitespaceTrimmingOnNodeNames().contains(node.getNodeName()); }
/** * Formats a Message object into an HL7 message string using this parser's default encoding (XML * encoding). This method calls the abstract method <code>encodeDocument(...)</code> in order to * obtain XML Document object representation of the Message, then serializes it to a String. * * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required * fields are null) */ protected String doEncode(Message source) throws HL7Exception { if (source instanceof GenericMessage) { throw new HL7Exception( "Can't XML-encode a GenericMessage. Message must have a recognized structure."); } Document doc = encodeDocument(source); // Element documentElement = doc.getDocumentElement(); // if (!documentElement.hasAttribute("xmlns")) // documentElement.setAttribute("xmlns", "urn:hl7-org:v2xml"); try { return XMLUtils.serialize(doc, getParserConfiguration().isPrettyPrintWhenEncodingXml()); } catch (Exception e) { throw new HL7Exception("Exception serializing XML document to string", e); } }
/** * Formats a Message object into an HL7 message string using this parser's default encoding (XML * encoding). This method calls the abstract method <code>encodeDocument(...)</code> in order to * obtain XML Document object representation of the Message, then serializes it to a String. * * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required * fields are null) */ protected String doEncode(Message source) throws HL7Exception { if (source instanceof GenericMessage) { throw new HL7Exception( "Can't XML-encode a GenericMessage. Message must have a recognized structure."); } Document doc = encodeDocument(source); // Element documentElement = doc.getDocumentElement(); // if (!documentElement.hasAttribute("xmlns")) // documentElement.setAttribute("xmlns", "urn:hl7-org:v2xml"); try { return XMLUtils.serialize(doc, getParserConfiguration().isPrettyPrintWhenEncodingXml()); } catch (Exception e) { throw new HL7Exception("Exception serializing XML document to string", e); } }