Tabnine Logo
ca.uhn.fhir.parser
Code IndexAdd Tabnine to your IDE (free)

How to use ca.uhn.fhir.parser

Best Java code snippets using ca.uhn.fhir.parser (Showing top 20 results out of 315)

origin: jamesagnew/hapi-fhir

@Override
public void incorrectJsonType(IParseLocation theLocation, String theElementName, ValueType theExpected, ScalarType theExpectedScalarType, ValueType theFound, ScalarType theFoundScalarType) {
  String message = LenientErrorHandler.createIncorrectJsonTypeMessage(theElementName, theExpected, theExpectedScalarType, theFound, theFoundScalarType);
  throw new DataFormatException(message);
}
origin: jamesagnew/hapi-fhir

static ParserState<TagList> getPreTagListInstance(IParser theParser, FhirContext theContext, boolean theJsonMode, IParserErrorHandler theErrorHandler) {
  ParserState<TagList> retVal = new ParserState<TagList>(theParser, theContext, theJsonMode, theErrorHandler);
  retVal.push(retVal.new PreTagListState());
  return retVal;
}
origin: jamesagnew/hapi-fhir

protected void containResourcesForEncoding(IBaseResource theResource) {
  ContainedResources contained = new ContainedResources();
  containResourcesForEncoding(contained, theResource, theResource);
  contained.assignIdsToContainedResources();
  myContainedResources = contained;
}
origin: jamesagnew/hapi-fhir

public void parserValidation() {
 // START SNIPPET: parserValidation
 FhirContext ctx = FhirContext.forDstu3();
 
 // Create a parser and configure it to use the strict error handler
 IParser parser = ctx.newXmlParser();
 parser.setParserErrorHandler(new StrictErrorHandler());
 // This example resource is invalid, as Patient.active can not repeat
 String input = "<Patient><active value=\"true\"/><active value=\"false\"/></Patient>";
 // The following will throw a DataFormatException because of the StrictErrorHandler
 parser.parseResource(Patient.class, input);
 // END SNIPPET: parserValidation
}
origin: jamesagnew/hapi-fhir

@Override
public void unknownReference(IParseLocation theLocation, String theReference) {
  throw new DataFormatException("Resource has invalid reference: " + theReference);
}
origin: jamesagnew/hapi-fhir

private <T extends IBaseResource> T parseResource(Class<T> theResourceType, XMLEventReader theStreamReader) {
  ParserState<T> parserState = ParserState.getPreResourceInstance(this, theResourceType, myContext, false, getErrorHandler());
  return doXmlLoop(theStreamReader, parserState);
}
origin: jamesagnew/hapi-fhir

private void encodeCompositeElementToStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theNextValue, JsonLikeWriter theEventWriter, boolean theContainedResource, boolean theSubResource,
                                 CompositeChildElement theParent) throws IOException, DataFormatException {
  writeCommentsPreAndPost(theNextValue, theEventWriter);
  encodeCompositeElementChildrenToStreamWriter(theResDef, theResource, theNextValue, theEventWriter, theContainedResource, theSubResource, theParent);
}
origin: jamesagnew/hapi-fhir

@SuppressWarnings("unchecked")
private void pop() {
  myPreviousElement = myState.getCurrentElement();
  if (myState.myStack != null) {
    myState = myState.myStack;
    myState.wereBack();
  } else {
    myObject = (T) myState.getCurrentElement();
    myState = null;
  }
}
origin: jamesagnew/hapi-fhir

@Override
public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, Reader theReader) {
  XMLEventReader streamReader = createStreamReader(theReader);
  return parseResource(theResourceType, streamReader);
}
origin: jamesagnew/hapi-fhir

@Override
protected void doEncodeResourceToWriter(IBaseResource theResource, Writer theWriter) throws IOException {
  JsonLikeWriter eventWriter = createJsonWriter(theWriter);
  doEncodeResourceToJsonLikeWriter(theResource, eventWriter);
}
origin: jamesagnew/hapi-fhir

private boolean checkIfParentShouldBeEncodedAndBuildPath(StringBuilder thePathBuilder, boolean theStarPass) {
  Set<String> encodeElements = myEncodeElements;
  if (encodeElements != null && encodeElements.isEmpty() == false) {
    if (isEncodeElementsAppliesToChildResourcesOnly() && !mySubResource) {
      encodeElements = null;
    }
  }
  return checkIfPathMatchesForEncoding(thePathBuilder, theStarPass, myEncodeElementsAppliesToResourceTypes, encodeElements, true);
}
origin: jamesagnew/hapi-fhir

@Override
public IBaseResource parseResource(String theMessageString) throws ConfigurationException, DataFormatException {
  return parseResource(null, theMessageString);
}
origin: jamesagnew/hapi-fhir

/**
 * Invoked after any new XML event is individually processed, containing a copy of the XML event. This is basically
 * intended for embedded XHTML content
 */
public void xmlEvent(XMLEvent theNextEvent) {
  if (myState != null) {
    myState.xmlEvent(theNextEvent);
  }
}
origin: jamesagnew/hapi-fhir

@Override
public IBaseResource parseResource(JsonLikeStructure theJsonLikeStructure) throws DataFormatException {
  return parseResource(null, theJsonLikeStructure);
}
origin: jamesagnew/hapi-fhir

@Override
public void containedResourceWithNoId(IParseLocation theLocation) {
  throw new DataFormatException("Resource has contained child resource with no ID");
}
origin: jamesagnew/hapi-fhir

@Override
public IBaseResource parseResource(Reader theReader) throws ConfigurationException, DataFormatException {
  return parseResource(null, theReader);
}
origin: jamesagnew/hapi-fhir

@Override
public void invalidValue(IParseLocation theLocation, String theValue, String theError) {
  throw new DataFormatException("Invalid attribute value \"" + theValue + "\": " + theError);
}
origin: jamesagnew/hapi-fhir

@Override
public void unknownElement(IParseLocation theLocation, String theElementName) {
  throw new DataFormatException("Unknown element '" + theElementName + "' found during parse");
}
origin: jamesagnew/hapi-fhir

@Override
public void unknownAttribute(IParseLocation theLocation, String theAttributeName) {
  throw new DataFormatException("Unknown attribute '" + theAttributeName + "' found during parse");
}
origin: jamesagnew/hapi-fhir

@Override
public void unexpectedRepeatingElement(IParseLocation theLocation, String theElementName) {
  throw new DataFormatException("Multiple repetitions of non-repeatable element '" + theElementName + "' found during parse");
}
ca.uhn.fhir.parser

Most used classes

  • IParser
    A parser, which can be used to convert between HAPI FHIR model/structure objects, and their respecti
  • DataFormatException
  • LenientErrorHandler
    The default error handler, which logs issues but does not abort parsing, with only one exception: Th
  • StrictErrorHandler
    Parser error handler which throws a DataFormatException any time an issue is found while parsing.
  • JsonParser
    This class is the FHIR JSON parser/encoder. Users should not interact with this class directly, but
  • BaseParser$CompositeChildElement,
  • BaseParser$ContainedResources,
  • BaseParser$ElementsPath,
  • BaseParser$EncodeContext,
  • BaseParser$EncodeContextPath,
  • BaseParser$EncodeContextPathElement,
  • BaseParser,
  • IParserErrorHandler$IParseLocation,
  • IParserErrorHandler,
  • JsonParser$HeldExtension,
  • ParseLocation,
  • ParserState$BaseState,
  • ParserState$PreResourceStateHapi,
  • ParserState$PreResourceStateHl7Org
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now