/** * {@inheritDoc} */ @Override public void parse(Message theMessage, String theString) throws HL7Exception { Document doc = parseStringIntoDocument(theString); parse(theMessage, doc.getDocumentElement()); applySuperStructureName(theMessage); }
/** * {@inheritDoc} */ @Override public void parse(Message theMessage, String theString) throws HL7Exception { Document doc = parseStringIntoDocument(theString); parse(theMessage, doc.getDocumentElement()); applySuperStructureName(theMessage); }
/** * <p>Creates and populates a Message object from an XML Document that contains an XML-encoded HL7 message.</p> * <p>The easiest way to implement this method for a particular message structure is as follows: * <ol><li>Create an instance of the Message type you are going to handle with your subclass * of XMLParser</li> * <li>Go through the given Document and find the Elements that represent the top level of * each message segment. </li> * <li>For each of these segments, call <code>parse(Segment segmentObject, Element segmentElement)</code>, * providing the appropriate Segment from your Message object, and the corresponding Element.</li></ol> * At the end of this process, your Message object should be populated with data from the XML * Document.</p> * @throws HL7Exception if the message is not correctly formatted. * @throws EncodingNotSupportedException if the message encoded * is not supported by this parser. */ public Message parseDocument(Document xmlMessage, String version) throws HL7Exception { assertNamespaceURI(xmlMessage.getDocumentElement().getNamespaceURI()); Message message = instantiateMessage(xmlMessage.getDocumentElement().getLocalName(), version, true); // Note: this will change in future to reuse the Parser's/HapiContext's // ValidationContext. // message.setValidationContext(getValidationContext()); parse(message, xmlMessage.getDocumentElement()); return message; }
/** * <p>Creates and populates a Message object from an XML Document that contains an XML-encoded HL7 message.</p> * <p>The easiest way to implement this method for a particular message structure is as follows: * <ol><li>Create an instance of the Message type you are going to handle with your subclass * of XMLParser</li> * <li>Go through the given Document and find the Elements that represent the top level of * each message segment. </li> * <li>For each of these segments, call <code>parse(Segment segmentObject, Element segmentElement)</code>, * providing the appropriate Segment from your Message object, and the corresponding Element.</li></ol> * At the end of this process, your Message object should be populated with data from the XML * Document.</p> * @throws HL7Exception if the message is not correctly formatted. * @throws EncodingNotSupportedException if the message encoded * is not supported by this parser. */ public Message parseDocument(Document xmlMessage, String version) throws HL7Exception { assertNamespaceURI(xmlMessage.getDocumentElement().getNamespaceURI()); Message message = instantiateMessage(xmlMessage.getDocumentElement().getLocalName(), version, true); // Note: this will change in future to reuse the Parser's/HapiContext's // ValidationContext. // message.setValidationContext(getValidationContext()); parse(message, xmlMessage.getDocumentElement()); return message; }