Package org.hl7.fhir.dstu3.formats
Class XmlParserBase
java.lang.Object
org.hl7.fhir.dstu3.formats.FormatUtilities
org.hl7.fhir.dstu3.formats.ParserBase
org.hl7.fhir.dstu3.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 classes/interfaces inherited from interface org.hl7.fhir.dstu3.formats.IParser
IParser.OutputStyle
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected org.hl7.fhir.utilities.xml.IXMLWriter
Fields inherited from class org.hl7.fhir.dstu3.formats.ParserBase
allowUnknownContent, handleComments, idMap, style, xhtmlMessage
Fields inherited from class org.hl7.fhir.dstu3.formats.FormatUtilities
FHIR_NS, ID_REGEX, NS_XSI, XHTML_NS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
compose
(OutputStream stream, String rootName, Type type) Compose a type to a stream (used in the spec, for example, but not normally in production)void
compose
(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)void
compose
(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)void
compose
(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.void
protected void
composeDomainResource
(String name, DomainResource res) protected void
composeElementAttributes
(Element element) protected void
composeElementClose
(Base base) protected abstract void
composeResource
(String name, Resource res) protected abstract void
composeResource
(Resource resource) protected abstract void
composeString
(String name, StringType value) protected void
composeString
(String name, org.hl7.fhir.instance.model.api.IIdType value) protected abstract void
composeType
(String prefix, Type type) protected void
composeTypeAttributes
(Type type) protected void
composeXhtml
(String name, org.hl7.fhir.utilities.xhtml.XhtmlNode html) getType()
check what kind of parser this isprotected org.xmlpull.v1.XmlPullParser
loadXml
(InputStream stream) protected org.xmlpull.v1.XmlPullParser
protected int
next
(org.xmlpull.v1.XmlPullParser xpp) protected int
nextNoWhitespace
(org.xmlpull.v1.XmlPullParser xpp) parse
(InputStream input) Parse content that is known to be a resourceparse
(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 XML.protected void
parseBackboneAttributes
(org.xmlpull.v1.XmlPullParser xpp, Element e) protected DomainResource
parseDomainResourceContained
(org.xmlpull.v1.XmlPullParser xpp) protected void
parseElementAttributes
(org.xmlpull.v1.XmlPullParser xpp, Element e) protected void
protected abstract Resource
parseResource
(org.xmlpull.v1.XmlPullParser xpp) protected Resource
parseResourceContained
(org.xmlpull.v1.XmlPullParser xpp) parseType
(InputStream input, String knownType) This is used to parse a type - a fragment of a resource.protected abstract Type
protected void
parseTypeAttributes
(org.xmlpull.v1.XmlPullParser xpp, Type t) protected org.hl7.fhir.utilities.xhtml.XhtmlNode
parseXhtml
(org.xmlpull.v1.XmlPullParser xpp) protected void
skipElementWithContent
(org.xmlpull.v1.XmlPullParser xpp) protected void
skipEmptyElement
(org.xmlpull.v1.XmlPullParser xpp) protected void
unknownContent
(org.xmlpull.v1.XmlPullParser xpp) Methods inherited from class org.hl7.fhir.dstu3.formats.ParserBase
composeBytes, composeBytes, composeString, composeString, getHandleComments, getOutputStyle, isAllowUnknownContent, parse, parse, parseBase64BinaryPrimitive, parseBooleanPrimitive, parseBooleanPrimitive, parseCodePrimitive, parseDecimalPrimitive, parseDecimalPrimitive, parseIdPrimitive, parseIntegerPrimitive, parseIntegerPrimitive, parseOidPrimitive, parseStringPrimitive, parseTimePrimitive, parseType, parseType, parseUriPrimitive, parseUuidPrimitive, setAllowUnknownContent, setHandleComments, setOutputStyle, setSuppressXhtml
Methods inherited from class org.hl7.fhir.dstu3.formats.FormatUtilities
isValidId, makeId, makeParser, makeParser, toString, toString, toString, toString, toString, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hl7.fhir.dstu3.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
public XmlParserBase()
-
-
Method Details
-
getType
Description copied from interface:IParser
check 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.XmlPullParserException
IOException
org.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.XmlPullParserException
IOException
org.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:
parse
in interfaceIParser
- Throws:
IOException
org.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:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
org.xmlpull.v1.XmlPullParserException
-
parseType
public Type parseType(InputStream input, String knownType) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError Description copied from interface:IParser
This 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:
parseType
in interfaceIParser
- Parameters:
input
-knownType
- . if this is blank, the parser may try to infer the type (xml only)- Returns:
- Throws:
IOException
org.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:
compose
in 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:IParser
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 format- Specified by:
compose
in interfaceIParser
- Throws:
IOException
-
loadXml
protected org.xmlpull.v1.XmlPullParser loadXml(String source) throws UnsupportedEncodingException, org.xmlpull.v1.XmlPullParserException, IOException - Throws:
UnsupportedEncodingException
org.xmlpull.v1.XmlPullParserException
IOException
-
loadXml
protected org.xmlpull.v1.XmlPullParser loadXml(InputStream stream) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserException
IOException
-
next
protected int next(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserException
IOException
-
nextNoWhitespace
protected int nextNoWhitespace(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserException
IOException
-
skipElementWithContent
protected void skipElementWithContent(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserException
IOException
-
skipEmptyElement
protected void skipEmptyElement(org.xmlpull.v1.XmlPullParser xpp) throws org.xmlpull.v1.XmlPullParserException, IOException - Throws:
org.xmlpull.v1.XmlPullParserException
IOException
-
parseTypeAttributes
-
parseElementAttributes
-
parseElementClose
-
parseBackboneAttributes
-
unknownContent
protected void unknownContent(org.xmlpull.v1.XmlPullParser xpp) throws org.hl7.fhir.exceptions.FHIRFormatError - Throws:
org.hl7.fhir.exceptions.FHIRFormatError
-
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.XmlPullParserException
IOException
org.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:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
org.xmlpull.v1.XmlPullParserException
-
parseResourceContained
protected Resource parseResourceContained(org.xmlpull.v1.XmlPullParser xpp) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError, org.xmlpull.v1.XmlPullParserException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
org.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
-