Package javax.xml.stream

Examples of javax.xml.stream.XMLEventReader.nextTag()


    private void testEventReader(Object result) throws XMLStreamException {
        assertTrue("resolver does not return XMLEventReader", result instanceof XMLEventReader);
        XMLEventReader eventReader = (XMLEventReader) result;
        assertTrue("eventReader has no next element", eventReader.hasNext());
        XMLEvent event = eventReader.nextTag();
        assertEquals(XMLStreamConstants.START_ELEMENT, event.getEventType());
        StartElement startElement = (StartElement) event;
        assertEquals("Invalid namespace", NAMESPACE_URI, startElement.getName().getNamespaceURI());
        assertEquals("Invalid local name", LOCAL_NAME, startElement.getName().getLocalPart());
    }
View Full Code Here


        if (event.isStartElement()) {
         
          String ConfigSetting = "";
          if (event.asStartElement().getName().getLocalPart() == ("config") || event.asStartElement().getName().getLocalPart() == ("root")) {
            event = eventReader.nextTag();

          }
         
            String ConfigKey = event.asStartElement().getName().getLocalPart();
            event = eventReader.nextEvent();
View Full Code Here

  }

  public void testPartial() throws Exception {
    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
    XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(CONTENT));
    eventReader.nextTag(); // skip to root
    StaxEventXMLReader xmlReader = new StaxEventXMLReader(eventReader);
    ContentHandler contentHandler = mock(ContentHandler.class);
    xmlReader.setContentHandler(contentHandler);
    xmlReader.parse(new InputSource());
    verify(contentHandler).startDocument();
View Full Code Here

 

  @Test
  public void testNextTag() throws XMLStreamException {
    XMLEventReader reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());

    reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
View Full Code Here

  @Test
  public void testNextTag() throws XMLStreamException {
    XMLEventReader reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());

    reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    reader.peek();
View Full Code Here

  @Test
  public void testNextTag() throws XMLStreamException {
    XMLEventReader reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());

    reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
View Full Code Here

  public void testNextTag() throws XMLStreamException {
    XMLEventReader reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());

    reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
View Full Code Here

    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());

    reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
View Full Code Here

    reader = createXmlEventReader("<?xml version=\"1.0\"?><alice david=\"edgar\"><edgar/></alice>");
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
 
View Full Code Here

    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
    reader.peek();
    Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextTag().getEventType());
 
}
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.