Interface IParser

All Known Implementing Classes:
JsonParser, JsonParserBase, ParserBase, RdfParser, RdfParserBase, XmlParser, XmlParserBase

public interface IParser
General interface - either an XML or JSON parser: read or write instances Defined to allow a factory to create a parser of the right type
  • Method Details

    • getType

      check what kind of parser this is
      Returns:
      what kind of parser this is
    • getHandleComments

      Whether to parse or ignore comments - either reading or writing
    • setHandleComments

      IParser setHandleComments(boolean value)
    • isAllowUnknownContent

      Parameters:
      allowUnknownContent - Whether to throw an exception if unknown content is found (or just skip it) when parsing
    • setAllowUnknownContent

    • getOutputStyle

      Writing:
    • setOutputStyle

    • setSuppressXhtml

      This method is used by the publication tooling to stop the xhrtml narrative being generated. It is not valid to use in production use. The tooling uses it to generate json/xml representations in html that are not cluttered by escaped html representations of the html representation
    • parse

      Resource parse(InputStream input) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError
      parse content that is known to be a resource
      Throws:
      org.xmlpull.v1.XmlPullParserException
      org.hl7.fhir.exceptions.FHIRFormatError
      IOException
    • parseAndClose

      Resource parseAndClose(InputStream input) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError
      Throws:
      IOException
      org.hl7.fhir.exceptions.FHIRFormatError
    • parse

      Resource parse(String input) throws UnsupportedEncodingException, org.hl7.fhir.exceptions.FHIRFormatError, IOException
      parse content that is known to be a resource
      Throws:
      UnsupportedEncodingException
      IOException
      org.hl7.fhir.exceptions.FHIRFormatError
    • parse

      Resource parse(byte[] bytes) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException
      parse content that is known to be a resource
      Throws:
      IOException
      org.hl7.fhir.exceptions.FHIRFormatError
    • parseType

      DataType parseType(InputStream input, String knownType) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError
      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
      Parameters:
      input -
      knownType - . if this is blank, the parser may try to infer the type (xml only)
      Returns:
      Throws:
      org.xmlpull.v1.XmlPullParserException
      org.hl7.fhir.exceptions.FHIRFormatError
      IOException
    • parseAnyType

      DataType parseAnyType(InputStream input, String knownType) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError
      Throws:
      IOException
      org.hl7.fhir.exceptions.FHIRFormatError
    • parseType

      DataType parseType(String input, String knownType) throws UnsupportedEncodingException, org.hl7.fhir.exceptions.FHIRFormatError, IOException
      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
      Parameters:
      input -
      knownType - . if this is blank, the parser may try to infer the type (xml only)
      Returns:
      Throws:
      UnsupportedEncodingException
      IOException
      org.hl7.fhir.exceptions.FHIRFormatError
    • parseType

      DataType parseType(byte[] bytes, String knownType) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException
      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
      Parameters:
      knownType - . if this is blank, the parser may try to infer the type (xml only)
      input -
      Returns:
      Throws:
      IOException
      org.hl7.fhir.exceptions.FHIRFormatError
    • compose

      void compose(OutputStream stream, Resource resource) throws IOException
      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)
      Throws:
      IOException
    • composeString

      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)
      Throws:
      IOException
    • composeBytes

      byte[] composeBytes(Resource resource) throws IOException
      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)
      Throws:
      IOException
    • compose

      void compose(OutputStream stream, DataType type, String rootName) throws IOException
      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
      Throws:
      org.xmlpull.v1.XmlPullParserException
      org.hl7.fhir.exceptions.FHIRFormatError
      IOException
    • composeString

      String composeString(DataType type, String rootName) throws IOException
      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
      Throws:
      IOException
    • composeBytes

      byte[] composeBytes(DataType type, String rootName) throws IOException
      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
      Throws:
      IOException