You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you attempt to use the DefaultXmlParser to encode a Message which is a GenericMessage, it will fail with a org.w3c.dom.DOMException.
This is due to the presence of a $ within the ClassName of an instantiated GenericMessage. Ex: GenericMessage$V23.
Sample Test:
/**
* <p>
* Attempt to parse a {@link ca.uhn.hl7v2.model.GenericMessage}. These objects have `$` in their class name, ex: `GenericMessage$V21`.
* The {@link DefaultXMLParser} will attempt to use the class name when constructing the {@link Document} when encoding. The `$` is
* not a valid character within an element name.
* </p>
* <p>
* Construct a {@link GenericMessage} for each available version, and call {@link DefaultXMLParser#encode(Message)} on the message.
* We expect that a valid {@link Document} is returned, as the `$` is stripped out.
* </p>
*/
@Test
public void test_encode_GenericMessage() throws Exception {
DefaultXMLParser xmlParser = new DefaultXMLParser();
for (Version version : Version.values()) {
Class<? extends Message> c = GenericMessage.getGenericMessageClass(version.getVersion());
Message m = c.getConstructor(ModelClassFactory.class).newInstance(new GenericModelClassFactory());
Document d = xmlParser.encodeDocument(m);
Assert.assertNotNull(d);
Assert.assertEquals("GenericMessage" + version.name(), d.getDocumentElement().getTagName());
}
}
Will be submitting a PR with a workaround.
The text was updated successfully, but these errors were encountered:
If you attempt to use the
DefaultXmlParser
to encode aMessage
which is aGenericMessage
, it will fail with aorg.w3c.dom.DOMException
.This is due to the presence of a
$
within the ClassName of an instantiatedGenericMessage
. Ex:GenericMessage$V23
.Sample Test:
Will be submitting a PR with a workaround.
The text was updated successfully, but these errors were encountered: