Package org.codehaus.staxmate

Examples of org.codehaus.staxmate.SMInputFactory$XmlFactoryAccessor


    }

    public void testTypedBooleanElem()
        throws XMLStreamException
    {
        SMInputFactory sf = getInputFactory();
        String XML = "<root><a>true</a><b>   0 </b><c>...</c></root>";
        SMInputCursor rootc = sf.rootElementCursor(new StringReader(XML)).advance();
        assertEquals("root", rootc.getLocalName());
        SMInputCursor crsr = rootc.childElementCursor().advance();
        assertEquals("a", crsr.getLocalName());
        assertTrue(crsr.getElemBooleanValue());
        assertNotNull(crsr.getNext());
View Full Code Here


    }

    public void testTypedIntElem()
        throws XMLStreamException
    {
        SMInputFactory sf = getInputFactory();
        String XML = "<root><a>  -1</a><b>  ?</b></root>";
        SMInputCursor rootc = sf.rootElementCursor(new StringReader(XML)).advance();
        assertEquals("root", rootc.getLocalName());
        SMInputCursor crsr = rootc.childElementCursor().advance();
        assertEquals("a", crsr.getLocalName());
        assertEquals(-1, crsr.getElemIntValue());
        assertNotNull(crsr.getNext());
View Full Code Here

    }

    public void testValidTypedEnumElem()
        throws XMLStreamException
    {
        SMInputFactory sf = getInputFactory();
        String XML = "<root>    OK </root>";
        SMInputCursor rootc = sf.rootElementCursor(new StringReader(XML)).advance();
        assertEquals("root", rootc.getLocalName());
        assertEquals(DummyEnum.OK, rootc.getElemEnumValue(DummyEnum.class));
        assertNull(rootc.getNext());
    }
View Full Code Here

    }

    public void testInvalidTypedEnumElem()
        throws XMLStreamException
    {
        SMInputFactory sf = getInputFactory();
        String XML = "<root>  x </root>";
        SMInputCursor rootc = sf.rootElementCursor(new StringReader(XML)).advance();
        assertEquals("root", rootc.getLocalName());
        try {
            /*DummyEnum en =*/ rootc.getElemEnumValue(DummyEnum.class);
        } catch (TypedXMLStreamException tex) {
            assertException(tex, "invalid enumeration value");
View Full Code Here

  }

  public DebtModel importXML(Reader xml) {
    DebtModel debtModel = new DebtModel();
    try {
      SMInputFactory inputFactory = initStax();
      SMHierarchicCursor cursor = inputFactory.rootElementCursor(xml);

      // advance to <sqale>
      cursor.advance();
      SMInputCursor chcCursor = cursor.childElementCursor(CHARACTERISTIC);
View Full Code Here

    XMLInputFactory xmlFactory = XMLInputFactory2.newInstance();
    xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
    xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
    xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
    xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
    return new SMInputFactory(xmlFactory);
  }
View Full Code Here

  }

  public List<RuleDebt> importXML(Reader xml, ValidationMessages validationMessages) {
    List<RuleDebt> ruleDebts = newArrayList();
    try {
      SMInputFactory inputFactory = initStax();
      SMHierarchicCursor cursor = inputFactory.rootElementCursor(xml);

      // advance to <sqale>
      cursor.advance();
      SMInputCursor rootCursor = cursor.childElementCursor(CHARACTERISTIC);
      while (rootCursor.getNext() != null) {
View Full Code Here

    XMLInputFactory xmlFactory = XMLInputFactory2.newInstance();
    xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
    xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
    xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
    xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
    return new SMInputFactory(xmlFactory);
  }
View Full Code Here

    }
    json.endArray();
  }

  private void writeFromTestData(String data, JsonWriter json) {
    SMInputFactory inputFactory = initStax();
    try {
      SMHierarchicCursor root = inputFactory.rootElementCursor(new StringReader(data));
      root.advance(); // tests-details
      SMInputCursor cursor = root.childElementCursor();
      json.name("tests").beginArray();
      while (cursor.getNext() != null) {
        json.beginObject();
View Full Code Here

    xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
    xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
    // just so it won't try to load DTD in if there's DOCTYPE
    xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
    xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
    return new SMInputFactory(xmlFactory);
  }
View Full Code Here

TOP

Related Classes of org.codehaus.staxmate.SMInputFactory$XmlFactoryAccessor

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.