Package javax.xml.stream

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


   public void testEventReader() throws Exception
   {
      FileInputStream stream = new FileInputStream(getXmlUrl("stax/test.xml"));
      XMLEventReader reader = XMLInputFactory.newInstance().createXMLEventReader(stream);
      XMLEvent event = reader.nextEvent();
      assertTrue("Expected document start, got:" + event.getClass(), event instanceof StartDocument);
      event = reader.nextEvent();
      assertTrue("Expected characters, got:" + event.getClass(), event instanceof Characters);
   }
View Full Code Here


   {
      FileInputStream stream = new FileInputStream(getXmlUrl("stax/test.xml"));
      XMLEventReader reader = XMLInputFactory.newInstance().createXMLEventReader(stream);
      XMLEvent event = reader.nextEvent();
      assertTrue("Expected document start, got:" + event.getClass(), event instanceof StartDocument);
      event = reader.nextEvent();
      assertTrue("Expected characters, got:" + event.getClass(), event instanceof Characters);
   }

   public void testStreamWriter() throws Exception
   {
View Full Code Here

     
      Map<String, String> newConfig = new HashMap<String, String>();

      while (eventReader.hasNext()) {

        XMLEvent event = eventReader.nextEvent();

        if (event.isStartElement()) {
         
          String ConfigSetting = "";
          if (event.asStartElement().getName().getLocalPart() == ("config") || event.asStartElement().getName().getLocalPart() == ("root")) {
View Full Code Here

            event = eventReader.nextTag();

          }
         
            String ConfigKey = event.asStartElement().getName().getLocalPart();
            event = eventReader.nextEvent();
           
           
              ConfigSetting = event.asCharacters().getData();
           
            newConfig.put(ConfigKey,ConfigSetting);
View Full Code Here

      XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
      // Read the XML document
      Item item = null;
     
      while (eventReader.hasNext()) {
        XMLEvent event = eventReader.nextEvent();

        if (event.isStartElement()) {
          StartElement startElement = event.asStartElement();
          // If we have a item element we create a new item
          if (startElement.getName().getLocalPart() == (ITEM)) {
View Full Code Here

          }

          if (event.isStartElement()) {
            if (event.asStartElement().getName().getLocalPart()
                .equals(MODE)) {
              event = eventReader.nextEvent();
              item.setMode(event.asCharacters().getData());
              continue;
            }
          }
          if (event.asStartElement().getName().getLocalPart().equals(UNIT)) {
View Full Code Here

              item.setMode(event.asCharacters().getData());
              continue;
            }
          }
          if (event.asStartElement().getName().getLocalPart().equals(UNIT)) {
            event = eventReader.nextEvent();
            item.setUnit(event.asCharacters().getData());
            continue;
          }

          if (event.asStartElement().getName().getLocalPart().equals(CURRENT)) {
View Full Code Here

            item.setUnit(event.asCharacters().getData());
            continue;
          }

          if (event.asStartElement().getName().getLocalPart().equals(CURRENT)) {
            event = eventReader.nextEvent();
            item.setCurrent(event.asCharacters().getData());
            continue;
          }

          if (event.asStartElement().getName().getLocalPart().equals(INTERACTIVE)) {
View Full Code Here

            item.setCurrent(event.asCharacters().getData());
            continue;
          }

          if (event.asStartElement().getName().getLocalPart().equals(INTERACTIVE)) {
            event = eventReader.nextEvent();
            item.setInteractive(event.asCharacters().getData());
            continue;
          }
        }
        // If we reach the end of an item element we add it to the list
View Full Code Here

                        "ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext-base64.xml")
        );

        XMLSecEvent xmlSecEvent = null;
        while (xmlSecEventReader.hasNext()) {
            xmlSecEvent = (XMLSecEvent) xmlSecEventReader.nextEvent();
            if (xmlSecEvent.isStartElement() && xmlSecEvent.asStartElement().getName().equals(new QName("urn:example:po", "PaymentInfo"))) {
                break;
            }
        }
        while (xmlSecEventReader.hasNext()) {
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.