Examples of GsonXmlBuilder


Examples of com.stanfy.gsonxml.GsonXmlBuilder

        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    };
    GsonXml gsonXml = new GsonXmlBuilder()
        .setSameNameLists(true)
        .setXmlParserCreator(parserCreator)
        .create();

    A a = gsonXml.fromXml("<A><B value=\"23.5\" /><C>Test</C></A>", A.class);
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

          throw new RuntimeException(e);
        }
      }
    };

    GsonXml gsonXml = new GsonXmlBuilder()
        .setSameNameLists(true)
        .setXmlParserCreator(parserCreator)
        .create();

    A a = gsonXml.fromXml("<A><B /></A>", A.class);
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

    assertEquals("article", response.data.category);
    assertEquals(1194, response.data.total);
  }

  private GsonXml createGsonXml() {
    return new GsonXmlBuilder()
        .wrap(
            new GsonBuilder().setDateFormat("dd.MM.yyyy HH:mm:ssZ")
         )
        .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
        .setSameNameLists(true)
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

  }

  @Test
  public void primitiveListWithSameNameTagsTest() {
    final ListWithHeader listWithHeader =
        new GsonXmlBuilder()
        .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
        .setPrimitiveArrays(true)
        .setSameNameLists(true)
        .setSkipRoot(true)
        .create()
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

    assertEquals("item1", listWithHeader.list.get(1));
  }

  @Test
  public void skipTest() {
    final PlacesContainer placesC = new GsonXmlBuilder()
        .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
        .setSkipRoot(true)
        .setSameNameLists(true)
        .create()
        .fromXml(TEST_XML_WITH_HEADER, PlacesContainer.class);
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

  }

  @Test
  public void primitiveListWithContainerTest() {
    final ListWithHeader listWithHeader =
        new GsonXmlBuilder()
        .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
        .setSkipRoot(true)
        .setPrimitiveArrays(true)
        .create()
        .fromXml(TEST_XML_FIELD_AND_CONTAINER_PRIMITIVE_LIST, ListWithHeader.class);
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

  }

  @Test
  public void primitiveListIntSameNameTest() {
    final List<Integer> intList =
        new GsonXmlBuilder()
        .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
        .setSkipRoot(true)
        .setRootArrayPrimitive(true)
        .create()
        .fromXml(TEST_XML_PRIMITIVE_LIST, new TypeToken<List<Integer>>() { }.getType());
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

   * This case is not supported.
   * @see GsonXmlBuilder#setPrimitiveArrays(boolean)
   */
  @Test(expected = JsonSyntaxException.class)
  public void firstTextNodeNotSupportedWithPrimitives() {
    new GsonXmlBuilder()
    .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
    .setSkipRoot(true)
    .setPrimitiveArrays(true)
    .create()
    .fromXml(TEST_XML, PlacesContainer.class);
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

    .fromXml(TEST_XML, PlacesContainer.class);
  }

  @Test
  public void wrappedEmptyLists() {
    final PlacesWrappedContainer places = new GsonXmlBuilder()
    .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
    .create()
    .fromXml(TEST_XML_WITH_EMPTY_WRAPPED_LIST, PlacesWrappedContainer.class);

    assertEquals("1", places.error);
View Full Code Here

Examples of com.stanfy.gsonxml.GsonXmlBuilder

    assertTrue(places.places.isEmpty());
  }

  @Test
  public void sameNameEmptyLists() {
    final PlacesContainer places = new GsonXmlBuilder()
    .setXmlParserCreator(SimpleXmlReaderTest.PARSER_CREATOR)
    .setSameNameLists(true)
    .create()
    .fromXml("<root><error></error><place> </place></root>", PlacesContainer.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.