Package com.stanfy.gsonxml

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


          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

    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

  }

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

    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

  }

  @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

  }

  @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

   * 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

    .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

    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

Related Classes of com.stanfy.gsonxml.GsonXmlBuilder

Copyright © 2018 www.massapicom. 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.