Package javax.xml.stream.events

Examples of javax.xml.stream.events.XMLEvent


                    anySchemaType = attr.getValue();
                    break;
                }
            }
            Characters charEl = null;
            XMLEvent event = reader.nextEvent();
            if (event.isStartElement()) {
                startEl = event.asStartElement();
                charEl = reader.nextEvent().asCharacters();               
            } else {
                charEl = event.asCharacters();
            }                                   
                                   
            reader.nextEvent().asEndElement();
            CorbaAnyHandler obj = new CorbaAnyHandler(startEl.getName(), idlType, tc, null);
            obj.setValueFromData(orb, charEl.getData(), anySchemaType);
View Full Code Here


                CorbaPrimitiveHandler handler = new CorbaPrimitiveHandler(valueQName,
                                                                          seqElementType,
                                                                          valueTC,
                                                                          null);
                obj.setTemplateElement(handler);
                XMLEvent evt = reader.nextEvent();
                Characters charEl = evt.asCharacters();
                String data = charEl.getData();
                byte[] value = data.getBytes();
                for (int i = 0; i < data.length(); i++) {
                    handler = new CorbaPrimitiveHandler(valueQName,
                                                        seqElementType,
View Full Code Here

                                                      serviceInfo);
        obj.setTemplateElement(elementObj);
        boolean nestedSequence = isNestedSequence(seqElementType);
        if (bound == 0) {
            LOG.log(Level.INFO, "Unbounded sequence found");
            XMLEvent event = reader.peek();
            while (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
                StartElement startEl = (StartElement) event;
                //REVISIT, check if qualified or unqualified
                if (startEl.getName().equals(el.getQName())) {
                    if (nestedSequence) {
                        reader.nextEvent().asStartElement();
View Full Code Here

                                      null);

        //only one union branch for a attribute / element nillable types.
        List<Unionbranch> branches = unionType.getUnionbranch();
        try {
            XMLEvent evt = reader.peek();
            if (schemaType instanceof XmlSchemaAttribute) {
                CorbaPrimitiveHandler value = getAttributeValue(evt, name, branches.get(0).getIdltype());
                if (value != null) {
                    discObj.setValue(Boolean.TRUE);
                    obj.setValue("value", value);
View Full Code Here

            Union unionType = (Union) CorbaUtils.getCorbaType(idlType, typeMaps);
            QName elName = reader.nextEvent().asStartElement().getName();
            obj = new CorbaUnionHandler(elName, idlType, tc, unionType);
            // Build the entire union with all branches, etc.  Then read info from the XML Event Reader
            String branchName = null;
            XMLEvent evt = reader.peek();
            if (evt.isStartElement()) {
                StartElement branchElement = evt.asStartElement();
                branchName = branchElement.getName().getLocalPart();
            }
            List<Unionbranch> branches = unionType.getUnionbranch();
            XmlSchemaObjectCollection items = choiceType.getItems();               
            for (int i = 0; i < branches.size(); i++) {
View Full Code Here

            InputStream in = read();
            XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
            // Read the XML document
            while (eventReader.hasNext())
            {
                XMLEvent event = eventReader.nextEvent();
                if (event.isStartElement())
                {
                    if (event.asStartElement().getName().getLocalPart().equals(TITLE))
                    {                 
                        event = eventReader.nextEvent();
                        title = event.asCharacters().getData();
                        continue;
                    }
                    if (event.asStartElement().getName().getLocalPart().equals(LINK))
                    {                 
                        event = eventReader.nextEvent();
                        link = event.asCharacters().getData();
                        continue;
                    }
                }
                else if (event.isEndElement())
                {
                    if (event.asEndElement().getName().getLocalPart().equals(ITEM))
                    {
                        // Store the title and link of the first entry we get - the first file on the list is all we need
                        versionTitle = title;
                        versionLink = link;
                        // All done, we don't need to know about older files.
View Full Code Here

      InputStream in = new FileInputStream(sdmxFilePath);
      XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
     
      while (eventReader.hasNext())
      {
        XMLEvent event = eventReader.nextEvent();
        if (event.isStartElement())
        {
          StartElement startElement = event.asStartElement();
          // if the element is starting with <data:Series
          if (startElement.getName().getLocalPart() == "Series")
          {
            counter += 1;
            Iterator<Attribute> attributes = startElement.getAttributes();
View Full Code Here

                                          XMLEventFactory eventFactory) throws XMLStreamException {
                assertNotNull("eventReader not given", eventReader);
                assertNotNull("eventWriter not given", eventWriter);
                assertNotNull("eventFactory not given", eventFactory);
                assertTrue("eventReader has not next element", eventReader.hasNext());
                XMLEvent event = eventReader.nextEvent();
                assertTrue("Not a start document", event.isStartDocument());
                event = eventReader.nextEvent();
                assertTrue("Not a start element", event.isStartElement());
                assertEquals("Invalid start event local name", REQUEST_ELEMENT,
                        event.asStartElement().getName().getLocalPart());
                assertEquals("Invalid start event namespace", NAMESPACE_URI,
                        event.asStartElement().getName().getNamespaceURI());
                assertTrue("eventReader has not next element", eventReader.hasNext());
                event = eventReader.nextEvent();
                assertTrue("Not a end element", event.isEndElement());
                assertEquals("Invalid end event local name", REQUEST_ELEMENT,
                        event.asEndElement().getName().getLocalPart());
                assertEquals("Invalid end event namespace", NAMESPACE_URI,
                        event.asEndElement().getName().getNamespaceURI());
                Namespace namespace = eventFactory.createNamespace(NAMESPACE_URI);
                QName name = new QName(NAMESPACE_URI, RESPONSE_ELEMENT);
                eventWriter
                        .add(eventFactory.createStartElement(name, null, Collections.singleton(namespace).iterator()));
                eventWriter.add(eventFactory.createEndElement(name, Collections.singleton(namespace).iterator()));
View Full Code Here

    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

            }
        }

        @Override
        public void staxSource(XMLEventReader eventReader) throws Exception {
            XMLEvent event = eventReader.peek();
            if (event != null && event.isStartDocument()) {
                event = eventReader.nextTag();
            }
            if (event != null) {
                if (event.isStartElement()) {
                    result = event.asStartElement().getName();
                }
                else if (event.isEndElement()) {
                    result = event.asEndElement().getName();
                }
            }
        }
View Full Code Here

TOP

Related Classes of javax.xml.stream.events.XMLEvent

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.