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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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, 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.
    byte[]
    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)
    byte[]
    composeBytes(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.
    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)
    composeString(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.
    boolean
    Whether to parse or ignore comments - either reading or writing
    Writing:
    check what kind of parser this is
    boolean
     
    parse(byte[] bytes)
    parse content that is known to be a resource
    parse content that is known to be a resource
    parse(String input)
    parse content that is known to be a resource
    parseType(byte[] bytes, String knownType)
    This is used to parse a type - a fragment of a resource.
    parseType(InputStream input, String knownType)
    This is used to parse a type - a fragment of a resource.
    parseType(String input, String knownType)
    This is used to parse a type - a fragment of a resource.
    setAllowUnknownContent(boolean value)
     
    setHandleComments(boolean value)
     
     
    This method is used by the publication tooling to stop the xhrtml narrative being generated.
  • 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
    • 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

      Type 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
    • parseType

      Type 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

      Type 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, Type 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(Type 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(Type 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