コード例 #1
0
 @Test
 public void testAttributeProcessing() throws Exception {
   List<StaxEvent> seList = doTest("inc.xml");
   StatusManager sm = context.getStatusManager();
   assertTrue(statusChecker.getHighestLevel(0) == Status.INFO);
   assertEquals(4, seList.size());
   StartEvent se = (StartEvent) seList.get(1);
   Attribute attr = se.getAttributeByName("increment");
   assertNotNull(attr);
   assertEquals("1", attr.getValue());
 }
コード例 #2
0
 @Test
 public void testParsingOfXMLWithAttributesAndBodyText() throws Exception {
   List<StaxEvent> seList = doTest("event1.xml");
   assertTrue(statusChecker.getHighestLevel(0) == Status.INFO);
   // dump(seList);
   assertEquals(11, seList.size());
   assertEquals("test", seList.get(0).getName());
   assertEquals("badBegin", seList.get(1).getName());
   StartEvent startEvent = (StartEvent) seList.get(7);
   assertEquals("John Doe", startEvent.getAttributeByName("name").getValue());
   assertEquals("XXX&", ((BodyEvent) seList.get(8)).getText());
 }