com.fasterxml.aalto.stax.InputFactoryImpl Java Examples

The following examples show how to use com.fasterxml.aalto.stax.InputFactoryImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientODataDeserializerImpl.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
protected XmlMapper getXmlMapper() {
  final XmlMapper xmlMapper = new XmlMapper(
      new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());

  xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(Boolean.class, Boolean.FALSE));

  xmlMapper.addHandler(new DeserializationProblemHandler() {
    @Override
    public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
        final com.fasterxml.jackson.databind.JsonDeserializer<?> deserializer,
        final Object beanOrClass, final String propertyName)
        throws IOException, JsonProcessingException {

      // skip any unknown property
      ctxt.getParser().skipChildren();
      return true;
    }
  });
  return xmlMapper;
}
 
Example #2
Source File: SysomosXmlSerDeIT.java    From streams with Apache License 2.0 5 votes vote down vote up
/**
 * before.
 */
@BeforeClass
public void before() {

  XmlFactory xmlFactory = new XmlFactory(new InputFactoryImpl(),
      new OutputFactoryImpl());

  JacksonXmlModule module = new JacksonXmlModule();

  module.setDefaultUseWrapper(false);

  xmlMapper = new XmlMapper(xmlFactory, module);

  xmlMapper
      .configure(
          DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
          Boolean.TRUE);
  xmlMapper
      .configure(
          DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT,
          Boolean.TRUE);
  xmlMapper
      .configure(
          DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY,
          Boolean.TRUE);
  xmlMapper.configure(
      DeserializationFeature.READ_ENUMS_USING_TO_STRING,
      Boolean.TRUE);

}
 
Example #3
Source File: MoreoverResult.java    From streams with Apache License 2.0 4 votes vote down vote up
protected MoreoverResult(String clientId, String xmlString, long start, long end) {
  this.xmlString = xmlString;
  this.clientId = clientId;
  this.start = start;
  this.end = end;
  XmlFactory xmlFactory = new XmlFactory(new InputFactoryImpl(),
      new OutputFactoryImpl());

  JacksonXmlModule module = new JacksonXmlModule();

  module.setDefaultUseWrapper(false);

  xmlMapper = new XmlMapper(xmlFactory, module);

  xmlMapper
      .configure(
          DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
          Boolean.TRUE);
  xmlMapper
      .configure(
          DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT,
          Boolean.TRUE);
  xmlMapper
      .configure(
          DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY,
          Boolean.TRUE);
  xmlMapper.configure(
      DeserializationFeature.READ_ENUMS_USING_TO_STRING,
      Boolean.TRUE);
  xmlMapper.configure(
      DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
      Boolean.FALSE);

  ObjectMapper mapper = new ObjectMapper();

  mapper
      .configure(
          DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
          Boolean.TRUE);
  mapper.configure(
      DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT,
      Boolean.TRUE);
  mapper
      .configure(
          DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY,
          Boolean.TRUE);
  mapper.configure(
      DeserializationFeature.READ_ENUMS_USING_TO_STRING,
      Boolean.TRUE);

}