Package mf.javax.xml.stream.events

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


            Augmentations augs) throws XNIException {
        try {
            int length = attributes.getLength();
            if (length == 0) {
                /** Avoid creating a new StartElement event object (if possible). */
                XMLEvent start = fStAXValidatorHelper.getCurrentEvent();
                if (start != null) {
                    fEventWriter.add(start);
                    return;
                }
            }
View Full Code Here


    public void endElement(QName element, Augmentations augs)
            throws XNIException {
        try {
            /** Avoid creating a new EndElement event object (if possible). */
            XMLEvent end = fStAXValidatorHelper.getCurrentEvent();
            if (end != null) {
                fEventWriter.add(end);
            }
            else {
                fEventWriter.add(fEventFactory.createEndElement(element.prefix,
View Full Code Here

    public Document getDocument() {
        return fSchemaDOMParser.getDocument();
    }

    public void parse(XMLEventReader input) throws XMLStreamException, XNIException {
        XMLEvent currentEvent = input.peek();
        if (currentEvent != null) {
            int eventType = currentEvent.getEventType();
            if (eventType != XMLStreamConstants.START_DOCUMENT &&
                eventType != XMLStreamConstants.START_ELEMENT) {
                throw new XMLStreamException();
            }
            fLocationWrapper.setLocation(currentEvent.getLocation());
            fSchemaDOMParser.startDocument(fLocationWrapper, null, fNamespaceContext, null);
            loop: while (input.hasNext()) {
                currentEvent = input.nextEvent();
                eventType = currentEvent.getEventType();
                switch (eventType) {
                case XMLStreamConstants.START_ELEMENT:
                    ++fDepth;
                    StartElement start = currentEvent.asStartElement();
                    fillQName(fElementQName, start.getName());
                    fLocationWrapper.setLocation(start.getLocation());
                    fNamespaceContext.setNamespaceContext(start.getNamespaceContext());
                    fillXMLAttributes(start);
                    fillDeclaredPrefixes(start);
                    addNamespaceDeclarations();
                    fNamespaceContext.pushContext();
                    fSchemaDOMParser.startElement(fElementQName, fAttributes, null);
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    EndElement end = currentEvent.asEndElement();
                    fillQName(fElementQName, end.getName());
                    fillDeclaredPrefixes(end);
                    fLocationWrapper.setLocation(end.getLocation());
                    fSchemaDOMParser.endElement(fElementQName, null);
                    fNamespaceContext.popContext();
                    --fDepth;
                    if (fDepth <= 0) {
                        break loop;
                    }
                    break;
                case XMLStreamConstants.CHARACTERS:
                    sendCharactersToSchemaParser(currentEvent.asCharacters().getData(), false);
                    break;
                case XMLStreamConstants.SPACE:
                    sendCharactersToSchemaParser(currentEvent.asCharacters().getData(), true);
                    break;
                case XMLStreamConstants.CDATA:
                    fSchemaDOMParser.startCDATA(null);
                    sendCharactersToSchemaParser(currentEvent.asCharacters().getData(), false);
                    fSchemaDOMParser.endCDATA(null);
                    break;
                case XMLStreamConstants.PROCESSING_INSTRUCTION:
                    ProcessingInstruction pi = (ProcessingInstruction)currentEvent;
                    fillProcessingInstruction(pi.getData());
View Full Code Here

        // there is no way to know the current position(event) of
        // XMLEventReader.  peek() is the only way to know the next event.
        // The next event on the input stream should be
        // XMLStreamConstants.START_DOCUMENT or
        // XMLStreamConstants.START_ELEMENT.
        XMLEvent event = xmlEventReader.peek();
        int eventType = event.getEventType();
        if (eventType != XMLStreamConstants.START_DOCUMENT
                && eventType != XMLStreamConstants.START_ELEMENT) {
            throw new IllegalStateException(
                "StAXSource(XMLEventReader) with XMLEventReader "
                + "not in XMLStreamConstants.START_DOCUMENT or "
                + "XMLStreamConstants.START_ELEMENT state");
        }

        this.xmlEventReader = xmlEventReader;
        systemId = event.getLocation().getSystemId();
    }
View Full Code Here

TOP

Related Classes of mf.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.