Package javax.xml.stream.events

Examples of javax.xml.stream.events.StartElement


        if (objName == null) {
            objName = obj.getName();
        }
        String value = ((CorbaPrimitiveHandler)obj).getDataFromValue();
        LOG.log(Level.INFO, "Writing primitive type to XML writer");
        StartElement startEl = factory.createStartElement(objName, null, null);
        writer.add(startEl);

        Characters charEvt = factory.createCharacters(value);
        writer.add(charEvt);
View Full Code Here


                                                 QName idlType,
                                                 TypeCode tc,
                                                 XmlSchemaObject schemaType)
        throws CorbaBindingException {
        try {
            StartElement startEl = reader.nextEvent().asStartElement();
            Iterator attrIter = startEl.getAttributes();
            String anySchemaType = null;
            while (attrIter.hasNext()) {
                Attribute attr = (Attribute)attrIter.next();
                QName attrName = attr.getName();
                if (attrName.getNamespaceURI().equals(XSI_NAMESPACE_URI)
                    && attrName.getLocalPart().equals("type")) {
                    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);
            return obj;
        } catch (java.lang.Exception ex) {
            ex.printStackTrace();
            LOG.log(Level.SEVERE, "Error: Object not correctly defined in the XML reader");
View Full Code Here

                                  QName objName,
                                  XmlSchemaObject schemaObj,
                                  XMLEventWriter writer,
                                  XMLEventFactory factory)
        throws XMLStreamException {
        StartElement startEl;
        if (objName == null) {
            objName = obj.getName();
        }
        // Any is a special case. Create an attribute called
        // xsi:type which identifies the type
View Full Code Here

                                                         TypeCode tc,
                                                         XmlSchemaObject schemaType) {
        CorbaPrimitiveHandler obj = null;
       
        try {
            StartElement startEl = reader.nextEvent().asStartElement();
            Characters charEl = reader.nextEvent().asCharacters();
            reader.nextEvent().asEndElement();
           
            if (tc.kind().value() == TCKind._tk_string) {
                obj =
                    new CorbaPrimitiveHandler(startEl.getName(), CorbaConstants.NT_CORBA_STRING, tc, null);
            } else {
                obj =
                    new CorbaPrimitiveHandler(startEl.getName(), CorbaConstants.NT_CORBA_WSTRING, tc, null);
            }
            obj.setValueFromData(charEl.getData());
        } catch (java.lang.Exception ex) {
            LOG.log(Level.SEVERE, "Error: Object not correctly defined in the XML reader");
            throw new CorbaBindingException("Invalid XML event read", ex);
View Full Code Here

        }
        if (objName == null) {
            objName = obj.getName();
        }
        if (isTopLevel) {
            StartElement startEl = factory.createStartElement(objName, null, null);
            writer.add(startEl);
        }
        CorbaArrayHandler arrayHandler = (CorbaArrayHandler)obj;
        XmlSchemaElement el = CorbaHandlerUtils.getXmlSchemaSequenceElement(schemaType, serviceInfo);
        List<CorbaObjectHandler> elements = arrayHandler.getElements();
        for (Iterator<CorbaObjectHandler> elementsIter = elements.iterator(); elementsIter.hasNext();) {
            CorbaObjectHandler handler = elementsIter.next();
            QName handlerName = handler.getName();
            boolean nestedArray = isNestedArray(handler.getTypeCode());
            if (nestedArray) {              
                StartElement startEl = factory.createStartElement(handlerName, null, null);
                writer.add(startEl);
            }
            writeObjectToStax(handler, el, writer, factory, true);
            if (nestedArray) {
                EndElement endEl = factory.createEndElement(handlerName, null);
View Full Code Here

                                                  XmlSchemaObject schemaType)
        throws CorbaBindingException {
        CorbaEnumHandler obj = null;
        try {
            Enum enumType = (Enum) CorbaUtils.getCorbaType(idlType, typeMaps);
            StartElement enumStartEl = reader.nextEvent().asStartElement();
            obj = new CorbaEnumHandler(enumStartEl.getName(), idlType, tc, enumType);
            Characters enumCharEl = reader.nextEvent().asCharacters();
            obj.setValue(enumCharEl.getData());
            reader.nextEvent().asEndElement();
        } catch (java.lang.Exception ex) {
            LOG.log(Level.SEVERE, "Received exception while reading object of type " + idlType);
View Full Code Here

                                   XMLEventFactory factory)
        throws XMLStreamException {
        if (objName == null) {
            objName = obj.getName();
        }
        StartElement startEl = factory.createStartElement(objName, null, null);
        writer.add(startEl);   
        CorbaEnumHandler enumHandler = (CorbaEnumHandler)obj;
        Characters charEvt = factory.createCharacters(enumHandler.getValue());
        writer.add(charEvt);
        EndElement endEl = factory.createEndElement(objName, null);
View Full Code Here

            throw new CorbaBindingException("Couldn't find xml schema object for : " + idlType);
        }
        CorbaExceptionHandler obj = null;
        try {
            Exception exType = (Exception) CorbaUtils.getCorbaType(idlType, typeMaps);
            StartElement exStartEl = reader.nextEvent().asStartElement();
            obj = new CorbaExceptionHandler(exStartEl.getName(), idlType, tc, exType);
            XmlSchemaComplexType ctype = (XmlSchemaComplexType) schemaType;
            XmlSchemaGroupBase group = (XmlSchemaGroupBase) ctype.getParticle();
            List<MemberType> exMembers = exType.getMember();
            for (int i = 0; i < exMembers.size(); ++i) {
                CorbaObjectHandler member = readObjectFromStax(reader,
View Full Code Here

            throw new CorbaBindingException("Couldn't find xml schema object for : " + obj.getIdlType());
        }
        if (objName == null) {
            objName = obj.getName();
        }
        StartElement startEl = factory.createStartElement(objName, null, null);
        writer.add(startEl);
        CorbaExceptionHandler exObj = (CorbaExceptionHandler)obj;
        XmlSchemaComplexType ctype = (XmlSchemaComplexType) schemaType;
        XmlSchemaGroupBase group = (XmlSchemaGroupBase) ctype.getParticle();
        List<CorbaObjectHandler> elements = exObj.getMembers();
View Full Code Here

        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();
                    }
                } else {
                    break;
View Full Code Here

TOP

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

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.