Examples of StartElement


Examples of javax.xml.stream.events.StartElement

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

Examples of mf.javax.xml.stream.events.StartElement

                    fCurrentEvent = reader.nextEvent();
                    eventType = fCurrentEvent.getEventType();
                    switch (eventType) {
                        case XMLStreamConstants.START_ELEMENT:
                            ++fDepth;
                            StartElement start = fCurrentEvent.asStartElement();
                            fillQName(fElementQName, start.getName());
                            fillXMLAttributes(start);
                            fillDeclaredPrefixes(start);
                            fNamespaceContext.setNamespaceContext(start.getNamespaceContext());
                            fStAXLocationWrapper.setLocation(start.getLocation());
                            fSchemaValidator.startElement(fElementQName, fAttributes, null);
                            break;
                        case XMLStreamConstants.END_ELEMENT:
                            EndElement end = fCurrentEvent.asEndElement();
                            fillQName(fElementQName, end.getName());
View Full Code Here

Examples of org.apache.cocoon.template.script.event.StartElement

        while (ev != endEvent) {
            loc.setDocumentLocator(ev.getLocation());

            // ContentHandler methods
            if (ev instanceof StartElement) {
                StartElement startElement = (StartElement) ev;
                Define def = (Define) executionContext
                        .getDefinitions().get(startElement.getQname());
                if (def == null) {
                    ev = ev.execute(consumer, objectModel,
                            executionContext, macroContext, namespaces, startEvent, endEvent);
                    continue;
                }
View Full Code Here

Examples of org.apache.xmlbeans.xml.stream.StartElement

                break;
            }
            case XMLEvent.START_ELEMENT :
            {
                StartElement se = (StartElement) e;
               
                flushText();

                // Used for prefix to namespace mapping
                _startElement = se;

                // Prepare the xsi:* values
               
                AttributeIterator attrs = se.getAttributes();

                while ( attrs.hasNext() )
                {
                    Attribute attr = attrs.next();

                    XMLName attrName = attr.getName();

                    if ("http://www.w3.org/2001/XMLSchema-instance".equals(
                            attrName.getNamespaceUri() ))
                    {
                        String local = attrName.getLocalName();

                        if (local.equals( "type" ))
                            _xsiType = attr.getValue();
                        else if (local.equals( "nil" ))
                            _xsiNil = attr.getValue();
                        else if (local.equals( "schemaLocation" ))
                            _xsiLoc = attr.getValue();
                        else if (local.equals( "noNamespaceSchemaLocation" ))
                            _xsiNoLoc = attr.getValue();
                    }
                }

                // Emit the START

                // TODO - should delay the aquisition of the name
                _name = e.getName();

                nextEvent( ValidatorListener.BEGIN );
               
                // Emit the attrs
               
                attrs = se.getAttributes();

                while ( attrs.hasNext() )
                {
                    Attribute attr = attrs.next();

View Full Code Here

Examples of org.exist.util.sax.event.contenthandler.StartElement

        final SAXEvent firstEvent = deferred.peek();
        if(!(firstEvent instanceof StartElement)) {
            throw new SAXException("Unbalanced SAX Events");
        }

        final StartElement start = ((StartElement)firstEvent);
        if(start.namespaceURI == null || !start.namespaceURI.equals(Configuration.NS) || !start.localName.equals(principalType.getElementName())) {
            throw new SAXException("First element does not match ending '" + principalType.getElementName() + "' element");
        }

        //if needed, update old style id to new style id
        final AttributesImpl attrs = new AttributesImpl(migrateIdAttribute(start.attributes, principalType));

        //check if there is a name collision, i.e. another principal with the same name
        final SecurityManager sm = broker.getBrokerPool().getSecurityManager();
        final String principalName = findName();
        final Principal existingPrincipleByName = principalName != null ? principalType.getPrincipal(sm, principalName) : null;

        final int newId;
        if(existingPrincipleByName != null) {
            //use id of existing principal which has the same name
            newId = existingPrincipleByName.getId();
        } else {

            //check if there is an id collision, i.e. another principal with the same id
            final Integer id = Integer.valueOf(attrs.getValue(ID_ATTR));
            final Principal existingPrincipalById = principalType.getPrincipal(sm, id);

            if(existingPrincipalById != null) {

                //pre-allocate a new id, so as not to collide with the existing principal
                if(isValidating()) {
                    try {
                        principalType.preAllocateId(sm, preAllocatedId);
                    } catch(final PermissionDeniedException | EXistException e) {
                        throw new SAXException("Unable to pre-allocate principle id for " + principalType.getElementName() + ": " + principalName, e);
                    }
                }

                newId = preAllocatedId.getId();

                if(!isValidating()) {
                    preAllocatedId.clear();
                }
            } else {
                newId = id; //use the provided id as it is currently unallocated
            }
        }

        //update attributes of the principal in deferred
        attrs.setValue(attrs.getIndex(ID_ATTR), String.valueOf(newId));
        final StartElement prevPrincipalStart = (StartElement)deferred.poll();
        deferred.addFirst(new StartElement(prevPrincipalStart.namespaceURI, prevPrincipalStart.localName, prevPrincipalStart.qname, attrs));
    }
View Full Code Here

Examples of weblogic.xml.stream.StartElement

                break;
            }
            case XMLEvent.START_ELEMENT :
            {
                StartElement se = (StartElement) e;
               
                flushText();

                // Used for prefix to namespace mapping
                _startElement = se;

                // Prepare the xsi:* values
               
                AttributeIterator attrs = se.getAttributes();

                while ( attrs.hasNext() )
                {
                    Attribute attr = attrs.next();

                    XMLName attrName = attr.getName();

                    if ("http://www.w3.org/2001/XMLSchema-instance".equals(
                            attrName.getNamespaceUri() ))
                    {
                        String local = attrName.getLocalName();

                        if (local.equals( "type" ))
                            _xsiType = attr.getValue();
                        else if (local.equals( "nil" ))
                            _xsiNil = attr.getValue();
                        else if (local.equals( "schemaLocation" ))
                            _xsiLoc = attr.getValue();
                        else if (local.equals( "noNamespaceSchemaLocation" ))
                            _xsiNoLoc = attr.getValue();
                    }
                }

                // Emit the START

                // TODO - should delay the aquisition of the name
                _name = e.getName();

                nextEvent( ValidatorListener.BEGIN );
               
                // Emit the attrs
               
                attrs = se.getAttributes();

                while ( attrs.hasNext() )
                {
                    Attribute attr = attrs.next();

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.