/** * Formats a Message object into an HL7 message string using the given encoding. * * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required * fields are null) * @throws EncodingNotSupportedException if the requested encoding is not supported by this * parser. */ protected String doEncode(Message source, String encoding) throws HL7Exception { if (!encoding.equals("XML")) throw new EncodingNotSupportedException("XMLParser supports only XML encoding"); return encode(source); }
/** * Formats a Message object into an HL7 message string using the given encoding. * * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required * fields are null) * @throws EncodingNotSupportedException if the requested encoding is not supported by this * parser. */ protected String doEncode(Message source, String encoding) throws HL7Exception { if (!encoding.equals("XML")) throw new EncodingNotSupportedException("XMLParser supports only XML encoding"); return encode(source); }
/** * Encodes a Varies type by extracting it's data field and encoding that. Returns true if the * data field (or one of its components) contains a value. */ private boolean encodeVaries(Varies datatypeObject, Element datatypeElement) throws DataTypeException { boolean hasData = false; if (datatypeObject.getData() != null) { hasData = encode(datatypeObject.getData(), datatypeElement); } return hasData; }
/** * Encodes a Varies type by extracting it's data field and encoding that. Returns true if the * data field (or one of its components) contains a value. */ private boolean encodeVaries(Varies datatypeObject, Element datatypeElement) throws DataTypeException { boolean hasData = false; if (datatypeObject.getData() != null) { hasData = encode(datatypeObject.getData(), datatypeElement); } return hasData; }
/** * Encodes a Composite in XML by looping through it's components, creating new children for each * of them (with the appropriate names) and populating them by calling encode(Type, Element) * using these children. Returns true if at least one component contains a value. */ private boolean encodeComposite(Composite datatypeObject, Element datatypeElement) throws DataTypeException { Type[] components = datatypeObject.getComponents(); boolean hasValue = false; for (int i = 0; i < components.length; i++) { String name = makeElementName(datatypeObject, i + 1); Element newNode = datatypeElement.getOwnerDocument().createElement(name); boolean componentHasValue = encode(components[i], newNode); if (componentHasValue) { try { datatypeElement.appendChild(newNode); } catch (DOMException e) { throw new DataTypeException("DOMException encoding Composite: ", e); } hasValue = true; } } return hasValue; }
/** * Encodes a Composite in XML by looping through it's components, creating new children for each * of them (with the appropriate names) and populating them by calling encode(Type, Element) * using these children. Returns true if at least one component contains a value. */ private boolean encodeComposite(Composite datatypeObject, Element datatypeElement) throws DataTypeException { Type[] components = datatypeObject.getComponents(); boolean hasValue = false; for (int i = 0; i < components.length; i++) { String name = makeElementName(datatypeObject, i + 1); Element newNode = datatypeElement.getOwnerDocument().createElement(name); boolean componentHasValue = encode(components[i], newNode); if (componentHasValue) { try { datatypeElement.appendChild(newNode); } catch (DOMException e) { throw new DataTypeException("DOMException encoding Composite: ", e); } hasValue = true; } } return hasValue; }
for (Type rep : reps) { Element newNode = segmentElement.getOwnerDocument().createElement(name); boolean componentHasValue = encode(rep, newNode); if (componentHasValue) { try {
String ackMessageInXML = xmlParser.encode(message);
for (Type rep : reps) { Element newNode = segmentElement.getOwnerDocument().createElement(name); boolean componentHasValue = encode(rep, newNode); if (componentHasValue) { try {