From b380a8f79773534b1bdf493848c5ad0c49c98d4d Mon Sep 17 00:00:00 2001 From: akley Date: Thu, 25 Sep 2014 10:36:29 +0200 Subject: [PATCH] Update PraserState.java Issue #26: XMLParser doesn't read Binary content from XML. Binary content is discarded during xml parsing, because attribute check of ID is missing in BinaryResourceState.attributeValue(...) --- .../src/main/java/ca/uhn/fhir/parser/ParserState.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java index dc8498b7fdc..87703646578 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java @@ -741,7 +741,13 @@ class ParserState { @Override public void attributeValue(String theName, String theValue) throws DataFormatException { - if ("contentType".equals(theName)) { + if ("id".equals(theName)) { + if (myInstance instanceof IIdentifiableElement) { + ((IIdentifiableElement) myInstance).setElementSpecificId((theValue)); + } else if (myInstance instanceof IResource) { + ((IResource) myInstance).setId(new IdDt(theValue)); + } + } else if ("contentType".equals(theName)) { myInstance.setContentType(theValue); } else if (myJsonMode && "value".equals(theName)) { string(theValue);