
Package ca.uhn.fhir.parser
Class XmlParser
- java.lang.Object
-
- ca.uhn.fhir.parser.BaseParser
-
- ca.uhn.fhir.parser.XmlParser
-
- All Implemented Interfaces:
IParser
public class XmlParser extends BaseParser
This class is the FHIR XML parser/encoder. Users should not interact with this class directly, but should useFhirContext.newXmlParser()
to get an instance.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ca.uhn.fhir.parser.BaseParser
BaseParser.CompositeChildElement, BaseParser.EncodeContext
-
-
Field Summary
-
Fields inherited from class ca.uhn.fhir.parser.BaseParser
RESOURCE_CREATED_BY_PARSER
-
-
Constructor Summary
Constructors Constructor Description XmlParser(FhirContext theContext, IParserErrorHandler theParserErrorHandler)
Do not use this constructor, the recommended way to obtain a new instance of the XML parser is to invokeFhirContext.newXmlParser()
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doEncodeResourceToWriter(IBaseResource theResource, Writer theWriter, BaseParser.EncodeContext theEncodeContext)
<T extends IBaseResource>
TdoParseResource(Class<T> theResourceType, Reader theReader)
EncodingEnum
getEncoding()
Which encoding does this parser instance produce?IParser
setPrettyPrint(boolean thePrettyPrint)
Sets the "pretty print" flag, meaning that the parser will encode resources with human-readable spacing and newlines between elements instead of condensing output as much as possible.-
Methods inherited from class ca.uhn.fhir.parser.BaseParser
compositeChildIterator, containResourcesForEncoding, encodeResourceToString, encodeResourceToWriter, encodeResourceToWriter, extractMetadataListNotNull, findBaseReferences, fixContainedResourceId, getAllBaseReferences, getCompositeElementId, getDontStripVersionsFromReferencesAtPaths, getEncodeForceResourceId, getErrorHandler, getExtensionMetadataKeys, getExtensionUrl, getMetaTagsForEncoding, getPreferTypes, getProfileTagsForEncoding, getServerBaseUrl, getStripVersionsFromReferences, getSuppressNarratives, isChildContained, isEncodeElementsAppliesToChildResourcesOnly, isOmitResourceId, isSummaryMode, isSuppressNarratives, parseResource, parseResource, parseResource, parseResource, parseResource, parseResource, preProcessValues, setDontEncodeElements, setDontStripVersionsFromReferencesAtPaths, setDontStripVersionsFromReferencesAtPaths, setEncodeElements, setEncodeElementsAppliesToChildResourcesOnly, setEncodeForceResourceId, setOmitResourceId, setOverrideResourceIdWithBundleEntryFullUrl, setParserErrorHandler, setPreferTypes, setServerBaseUrl, setStripVersionsFromReferences, setSummaryMode, setSuppressNarratives, shouldAddSubsettedTag, shouldEncodePath, shouldEncodeResource, shouldEncodeResourceId, shouldEncodeResourceMeta, throwExceptionForUnknownChildType
-
-
-
-
Constructor Detail
-
XmlParser
public XmlParser(FhirContext theContext, IParserErrorHandler theParserErrorHandler)
Do not use this constructor, the recommended way to obtain a new instance of the XML parser is to invokeFhirContext.newXmlParser()
.- Parameters:
theParserErrorHandler
-
-
-
Method Detail
-
doEncodeResourceToWriter
public void doEncodeResourceToWriter(IBaseResource theResource, Writer theWriter, BaseParser.EncodeContext theEncodeContext) throws DataFormatException
- Specified by:
doEncodeResourceToWriter
in classBaseParser
- Throws:
DataFormatException
-
doParseResource
public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, Reader theReader)
- Specified by:
doParseResource
in classBaseParser
-
getEncoding
public EncodingEnum getEncoding()
Description copied from interface:IParser
Which encoding does this parser instance produce?
-
setPrettyPrint
public IParser setPrettyPrint(boolean thePrettyPrint)
Description copied from interface:IParser
Sets the "pretty print" flag, meaning that the parser will encode resources with human-readable spacing and newlines between elements instead of condensing output as much as possible.- Parameters:
thePrettyPrint
- The flag- Returns:
- Returns an instance of
this
parser so that method calls can be chained together
-
-