
Package org.hl7.fhir.r4.formats
Class XmlParserBase
java.lang.Object
org.hl7.fhir.r4.formats.FormatUtilities
org.hl7.fhir.r4.formats.ParserBase
org.hl7.fhir.r4.formats.XmlParserBase
- All Implemented Interfaces:
IParser
- Direct Known Subclasses:
XmlParser
General parser for XML content. You instantiate an XmlParser of these, but
you actually use parse or parseGeneral defined on this class
The two classes are separated to keep generated and manually maintained code
apart.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.hl7.fhir.r4.formats.IParser
IParser.OutputStyle -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected org.hl7.fhir.utilities.xml.IXMLWriterFields inherited from class org.hl7.fhir.r4.formats.ParserBase
allowComments, allowUnknownContent, handleComments, idMap, style, xhtmlMessageFields inherited from class org.hl7.fhir.r4.formats.FormatUtilities
FHIR_NS, ID_REGEX, NS_XSI, XHTML_NS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcompose(OutputStream stream, String rootName, Type type) Compose a type to a stream (used in the spec, for example, but not normally in production) @voidcompose(OutputStream stream, Resource resource) Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) @voidcompose(OutputStream stream, Resource resource, boolean htmlPretty) Compose a resource to a stream, possibly using pretty presentation for a human reader, and maybe a different choice in the xhtml narrative (used in the spec in one place, but should not be used in production) @voidcompose(OutputStream stream, Type type, String rootName) Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) Not supported by all implementations. rootName is ignored in the JSON formatvoidprotected voidcomposeDomainResource(String name, DomainResource res) protected voidcomposeElementAttributes(Element element) protected voidcomposeElementClose(Base base) protected abstract voidcomposeResource(String name, Resource res) protected abstract voidcomposeResource(Resource resource) protected voidcomposeString(String name, org.hl7.fhir.instance.model.api.IIdType value) protected abstract voidcomposeString(String name, StringType value) protected abstract voidcomposeType(String prefix, Type type) protected voidcomposeTypeAttributes(Type type) protected voidcomposeXhtml(String name, org.hl7.fhir.utilities.xhtml.XhtmlNode html) getType()check what kind of parser this isprotected org.xmlpull.v1.XmlPullParserloadXml(InputStream stream) protected org.xmlpull.v1.XmlPullParserprotected intnext(org.xmlpull.v1.XmlPullParser xpp) protected intnextNoWhitespace(org.xmlpull.v1.XmlPullParser xpp) parse(InputStream input) Parse content that is known to be a resource @parse(org.xmlpull.v1.XmlPullParser xpp) parse xml that is known to be a resource, and that is already being read by an XML Pull Parser This is if a resource is in a bigger piece of XMLparseAnyType(InputStream input, String knownType) protected abstract TypeparseAnyType(org.xmlpull.v1.XmlPullParser xml, String type) protected voidparseBackboneAttributes(org.xmlpull.v1.XmlPullParser xpp, Element e) protected DomainResourceparseDomainResourceContained(org.xmlpull.v1.XmlPullParser xpp) protected voidparseElementAttributes(org.xmlpull.v1.XmlPullParser xpp, Element e) protected voidprotected abstract ResourceparseResource(org.xmlpull.v1.XmlPullParser xpp) protected ResourceparseResourceContained(org.xmlpull.v1.XmlPullParser xpp) parseType(InputStream input, String knownType) This is used to parse a type - a fragment of a resource.protected abstract Typeprotected voidparseTypeAttributes(org.xmlpull.v1.XmlPullParser xpp, Type t) protected org.hl7.fhir.utilities.xhtml.XhtmlNodeparseXhtml(org.xmlpull.v1.XmlPullParser xpp) protected voidskipElementWithContent(org.xmlpull.v1.XmlPullParser xpp) protected voidskipEmptyElement(org.xmlpull.v1.XmlPullParser xpp) protected voidunknownContent(org.xmlpull.v1.XmlPullParser xpp) Methods inherited from class org.hl7.fhir.r4.formats.ParserBase
composeBytes, composeBytes, composeString, composeString, getHandleComments, getOutputStyle, isAllowComments, isAllowUnknownContent, parse, parse, parseAnyType, parseAnyType, parseBase64BinaryPrimitive, parseBooleanPrimitive, parseBooleanPrimitive, parseCodePrimitive, parseDecimalPrimitive, parseDecimalPrimitive, parseIdPrimitive, parseIntegerPrimitive, parseIntegerPrimitive, parseOidPrimitive, parseStringPrimitive, parseTimePrimitive, parseType, parseType, parseUriPrimitive, parseUuidPrimitive, setAllowComments, setAllowUnknownContent, setHandleComments, setOutputStyle, setSuppressXhtmlMethods inherited from class org.hl7.fhir.r4.formats.FormatUtilities
determineFormat, determineFormat, isValidId, loadFile, loadFile, loadFileTight, loadFileTight, makeId, makeParser, makeParser, toString, toString, toString, toString, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hl7.fhir.r4.formats.IParser
composeBytes, composeBytes, composeString, composeString, getHandleComments, getOutputStyle, isAllowUnknownContent, parse, parse, parseType, parseType, setAllowUnknownContent, setHandleComments, setOutputStyle, setSuppressXhtml
-
Field Details
-
comments
-
xml
-
htmlPretty
-
-
Constructor Details
-
XmlParserBase
-
XmlParserBase
public XmlParserBase()
-
-
Method Details
-
getType
Description copied from interface:IParsercheck what kind of parser this is -
parseResource
protected abstract Resource parseResource(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseType
protected abstract Type parseType(org.xmlpull.v1.XmlPullParser xml, String type) throws org.xmlpull.v1.XmlPullParserException, IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseAnyType
protected abstract Type parseAnyType(org.xmlpull.v1.XmlPullParser xml, String type) throws org.xmlpull.v1.XmlPullParserException, IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
composeType
- Throws:
IOException
-
parse
public Resource parse(InputStream input) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError Parse content that is known to be a resource @- Specified by:
parsein interfaceIParser- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parse
public Resource parse(org.xmlpull.v1.XmlPullParser xpp) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError, org.xmlpull.v1.XmlPullParserException parse xml that is known to be a resource, and that is already being read by an XML Pull Parser This is if a resource is in a bigger piece of XML. @- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatErrororg.xmlpull.v1.XmlPullParserException
-
parseType
public Type parseType(InputStream input, String knownType) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError Description copied from interface:IParserThis is used to parse a type - a fragment of a resource. There's no reason to use this in production - it's used in the build tools Not supported by all implementations- Specified by:
parseTypein interfaceIParser- Parameters:
input-knownType- . if this is blank, the parser may try to infer the type (xml only)- Returns:
- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseAnyType
public Type parseAnyType(InputStream input, String knownType) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Specified by:
parseAnyTypein interfaceIParser- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
compose
Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) @- Specified by:
composein interfaceIParser- Throws:
IOException
-
compose
Compose a resource to a stream, possibly using pretty presentation for a human reader, and maybe a different choice in the xhtml narrative (used in the spec in one place, but should not be used in production) @- Throws:
IOException
-
compose
Compose a type to a stream (used in the spec, for example, but not normally in production) @- Throws:
IOException
-
compose
Description copied from interface:IParserCompose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) Not supported by all implementations. rootName is ignored in the JSON format- Specified by:
composein interfaceIParser- Throws:
IOException
-
loadXml
protected org.xmlpull.v1.XmlPullParser loadXml(String source) throws UnsupportedEncodingException, org.xmlpull.v1.XmlPullParserException, IOException - Throws:
UnsupportedEncodingExceptionorg.xmlpull.v1.XmlPullParserExceptionIOException
-
loadXml
protected org.xmlpull.v1.XmlPullParser loadXml(InputStream stream) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOException
-
next
protected int next(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOException
-
nextNoWhitespace
protected int nextNoWhitespace(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOException
-
skipElementWithContent
protected void skipElementWithContent(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOException
-
skipEmptyElement
protected void skipEmptyElement(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOException
-
parseTypeAttributes
-
parseElementAttributes
-
parseElementClose
-
parseBackboneAttributes
-
unknownContent
protected void unknownContent(org.xmlpull.v1.XmlPullParser xpp) throws org.hl7.fhir.exceptions.FHIRFormatError, org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.hl7.fhir.exceptions.FHIRFormatErrororg.xmlpull.v1.XmlPullParserExceptionIOException
-
parseXhtml
protected org.hl7.fhir.utilities.xhtml.XhtmlNode parseXhtml(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseDomainResourceContained
protected DomainResource parseDomainResourceContained(org.xmlpull.v1.XmlPullParser xpp) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError, org.xmlpull.v1.XmlPullParserException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatErrororg.xmlpull.v1.XmlPullParserException
-
parseResourceContained
protected Resource parseResourceContained(org.xmlpull.v1.XmlPullParser xpp) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError, org.xmlpull.v1.XmlPullParserException - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatErrororg.xmlpull.v1.XmlPullParserException
-
compose
public void compose(org.hl7.fhir.utilities.xml.IXMLWriter writer, Resource resource, boolean htmlPretty) throws IOException - Throws:
IOException
-
composeResource
- Throws:
IOException
-
composeElementAttributes
- Throws:
IOException
-
composeElementClose
- Throws:
IOException
-
composeTypeAttributes
- Throws:
IOException
-
composeXhtml
protected void composeXhtml(String name, org.hl7.fhir.utilities.xhtml.XhtmlNode html) throws IOException - Throws:
IOException
-
composeString
- Throws:
IOException
-
composeString
protected void composeString(String name, org.hl7.fhir.instance.model.api.IIdType value) throws IOException - Throws:
IOException
-
composeDomainResource
- Throws:
IOException
-
composeResource
- Throws:
IOException
-