Example usage for javax.xml.stream XMLStreamConstants CHARACTERS

List of usage examples for javax.xml.stream XMLStreamConstants CHARACTERS

Introduction

In this page you can find the example usage for javax.xml.stream XMLStreamConstants CHARACTERS.

Prototype

int CHARACTERS

To view the source code for javax.xml.stream XMLStreamConstants CHARACTERS.

Click Source Link

Document

Indicates an event is characters

Usage

From source file:org.openanzo.services.serialization.XMLBackupReader.java

/**
 * Parse the data within the reader, passing the results to the IRepositoryHandler
 * //from  w w w  . j  a v a2s . c  o m
 * @param reader
 *            reader containing the data
 * @param handler
 *            Handler which will handle the elements within the data
 * @throws AnzoException
 */
private void parseBackup(Reader reader, final IBackupHandler handler) throws AnzoException {
    try {
        XMLStreamReader parser = XMLFactoryFinder.getXMLInputFactory().createXMLStreamReader(reader);

        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
            switch (event) {
            case XMLStreamConstants.START_ELEMENT:
                if (SerializationConstants.namedGraph.equals(parser.getLocalName())) {
                    graphUri = parser.getAttributeValue(null, SerializationConstants.namedGraphUri);
                    String meta = parser.getAttributeValue(null, SerializationConstants.metadataGraphUri);
                    String uuidString = parser.getAttributeValue(null, SerializationConstants.namedGraphUUID);
                    namedGraphUri = Constants.valueFactory.createURI(graphUri);
                    metaURI = Constants.valueFactory.createURI(meta);
                    uuid = Constants.valueFactory.createURI(uuidString);
                    revisioned = Boolean
                            .parseBoolean(parser.getAttributeValue(null, SerializationConstants.revisioned));
                } else if (SerializationConstants.revisions.equals(parser.getLocalName())) {
                    revisions = new ArrayList<BackupRevision>();
                } else if (SerializationConstants.revisionInfo.equals(parser.getLocalName())) {
                    long revision = Long
                            .parseLong(parser.getAttributeValue(null, SerializationConstants.revision));
                    Long start = Long.valueOf(parser.getAttributeValue(null, SerializationConstants.start));
                    String endString = parser.getAttributeValue(null, SerializationConstants.end);
                    Long end = (endString != null) ? Long.valueOf(endString) : -1;
                    lastModified = Constants.valueFactory
                            .createURI(parser.getAttributeValue(null, SerializationConstants.lastModifiedBy));
                    revisions.add(new BackupRevision(revision, start, end, lastModified));
                } else if (SerializationConstants.statement.equals(parser.getLocalName())) {
                    if (processGraph) {
                        if (revisioned) {
                            String startString = parser.getAttributeValue(null, SerializationConstants.start);
                            String endString = parser.getAttributeValue(null, SerializationConstants.end);
                            if (startString != null)
                                start = Long.valueOf(startString);
                            if (endString != null)
                                end = Long.valueOf(endString);
                        }
                    }
                } else if (SerializationConstants.statements.equals(parser.getLocalName())) {
                    if (processGraph) {
                        metadata = !parser.getAttributeValue(null, SerializationConstants.namedGraphUri)
                                .equals(graphUri);
                    }
                } else if (SerializationConstants.subject.equals(parser.getLocalName())) {
                    if (processGraph) {
                        nodeType = parser.getAttributeValue(null, SerializationConstants.subjectType);
                    }
                } else if (SerializationConstants.predicate.equals(parser.getLocalName())) {
                } else if (SerializationConstants.object.equals(parser.getLocalName())) {
                    if (processGraph) {
                        nodeType = parser.getAttributeValue(null, SerializationConstants.objectType);
                        language = parser.getAttributeValue(null, SerializationConstants.language);
                        datatype = parser.getAttributeValue(null, SerializationConstants.dataType);
                    }
                } else if (SerializationConstants.namedGraphUri.equals(parser.getLocalName())) {
                }
                break;
            case XMLStreamConstants.END_ELEMENT:
                if (SerializationConstants.namedGraph.equals(parser.getLocalName())) {
                    graphUri = null;
                    namedGraphUri = null;
                    metaURI = null;
                    uuid = null;
                    revisioned = true;
                    revisions = null;
                } else if (SerializationConstants.revisionInfo.equals(parser.getLocalName())) {
                } else if (SerializationConstants.revisions.equals(parser.getLocalName())) {
                    processGraph = handler.handleNamedGraph(revisioned, namedGraphUri, metaURI, uuid,
                            revisions);
                    revisions = null;
                } else if (SerializationConstants.statement.equals(parser.getLocalName())) {
                    if (processGraph) {
                        handler.handleStatement(metadata, revisioned,
                                Constants.valueFactory.createStatement(currentSubject, currentPredicate,
                                        currentObject, currentNamedGraphURI),
                                start, end);
                        start = null;
                        end = null;
                    }
                } else if (SerializationConstants.subject.equals(parser.getLocalName())) {
                    if (processGraph) {
                        if (NodeType.BNODE.name().equals(nodeType)) {
                            currentSubject = Constants.valueFactory.createBNode(currentValue);
                        } else {
                            currentSubject = Constants.valueFactory.createURI(currentValue);
                        }
                        currentValue = null;
                        nodeType = null;
                    }
                } else if (SerializationConstants.predicate.equals(parser.getLocalName())) {
                    if (processGraph) {
                        currentPredicate = Constants.valueFactory.createURI(currentValue);
                        currentValue = null;
                    }
                } else if (SerializationConstants.object.equals(parser.getLocalName())) {
                    if (processGraph) {
                        if (NodeType.BNODE.name().equals(nodeType)) {
                            currentObject = Constants.valueFactory.createBNode(currentValue);
                        } else if (NodeType.URI.name().equals(nodeType)) {
                            currentObject = Constants.valueFactory.createURI(currentValue);
                        } else if (NodeType.LITERAL.name().equals(nodeType)) {
                            if (currentValue == null) {
                                currentValue = "";
                            } else if (Base64
                                    .isArrayByteBase64(currentValue.getBytes(Constants.byteEncoding))) {
                                currentValue = new String(
                                        Base64.decodeBase64(currentValue.getBytes(Constants.byteEncoding)),
                                        Constants.byteEncoding);
                            }
                            if (datatype != null) {
                                currentObject = Constants.valueFactory.createLiteral(currentValue,
                                        Constants.valueFactory.createURI(datatype));
                            } else if (language != null) {
                                currentObject = Constants.valueFactory.createLiteral(currentValue, language);
                            } else {
                                currentObject = Constants.valueFactory.createLiteral(currentValue);
                            }
                        }
                        currentValue = null;
                        nodeType = null;
                        language = null;
                        datatype = null;
                    }
                } else if (SerializationConstants.namedGraphUri.equals(parser.getLocalName())) {
                    if (processGraph) {
                        currentNamedGraphURI = Constants.valueFactory.createURI(currentValue);
                        currentValue = null;
                    }
                }
                break;
            case XMLStreamConstants.CHARACTERS:
                if (parser.hasText())
                    currentValue = parser.getText();
                break;
            case XMLStreamConstants.CDATA:
                if (parser.hasText())
                    currentValue = parser.getText();
                break;
            }
        }
        parser.close();
    } catch (XMLStreamException ex) {
        throw new AnzoException(ExceptionConstants.IO.READ_ERROR, ex, ex.getMessage());
    } catch (UnsupportedEncodingException uee) {
        throw new AnzoException(ExceptionConstants.IO.ENCODING_ERROR, uee);
    }
}

From source file:org.openanzo.services.serialization.XMLNamedGraphUpdatesReader.java

/**
 * Parse the data within the reader, passing the results to the IRepositoryHandler
 * //from w  w w. j a  v  a 2  s  .c  om
 * @param reader
 *            reader containing the data
 * @param handler
 *            Handler which will handle the elements within the data
 * @throws AnzoException
 */
public void parseUpdates(Reader reader, final INamedGraphUpdateHandler handler) throws AnzoException {
    try {
        XMLStreamReader parser = XMLFactoryFinder.getXMLInputFactory().createXMLStreamReader(reader);

        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
            switch (event) {
            case XMLStreamConstants.START_ELEMENT:
                if (SerializationConstants.namedGraph.equals(parser.getLocalName())) {
                    String uri = parser.getAttributeValue(null, SerializationConstants.namedGraphUri);
                    String uuid = parser.getAttributeValue(null, SerializationConstants.namedGraphUUID);
                    currentNamedGraphUpdate = new NamedGraphUpdate(MemURI.create(uri));
                    if (uuid != null) {
                        currentNamedGraphUpdate.setUUID(MemURI.create(uuid));
                    }
                    String revision = parser.getAttributeValue(null, SerializationConstants.revision);
                    if (revision != null) {
                        currentNamedGraphUpdate.setRevision(Long.parseLong(revision));
                    }
                } else if (SerializationConstants.additions.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getAdditions();
                } else if (SerializationConstants.metaAdditions.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getMetaAdditions();
                } else if (SerializationConstants.removals.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getRemovals();
                } else if (SerializationConstants.metaRemovals.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getMetaRemovals();
                } else if (SerializationConstants.statement.equals(parser.getLocalName())) {
                } else if (SerializationConstants.subject.equals(parser.getLocalName())) {
                    nodeType = parser.getAttributeValue(null, SerializationConstants.subjectType);
                } else if (SerializationConstants.predicate.equals(parser.getLocalName())) {
                } else if (SerializationConstants.object.equals(parser.getLocalName())) {
                    nodeType = parser.getAttributeValue(null, SerializationConstants.objectType);
                    language = parser.getAttributeValue(null, SerializationConstants.language);
                    datatype = parser.getAttributeValue(null, SerializationConstants.dataType);
                } else if (SerializationConstants.namedGraphUri.equals(parser.getLocalName())) {
                }
                break;
            case XMLStreamConstants.END_ELEMENT:
                if (SerializationConstants.namedGraph.equals(parser.getLocalName())) {
                    handler.handleNamedGraphUpdate(currentNamedGraphUpdate);
                    currentNamedGraphUpdate = null;
                } else if (SerializationConstants.additions.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.metaAdditions.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.removals.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.metaRemovals.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.statement.equals(parser.getLocalName())) {
                    currentStatements.add(Constants.valueFactory.createStatement(currentSubject,
                            currentPredicate, currentObject, currentNamedGraphURI));
                } else if (SerializationConstants.subject.equals(parser.getLocalName())) {
                    if (NodeType.BNODE.name().equals(nodeType)) {
                        currentSubject = Constants.valueFactory.createBNode(currentValue);
                    } else {
                        currentSubject = Constants.valueFactory.createURI(currentValue);
                    }
                    currentValue = null;
                    nodeType = null;
                } else if (SerializationConstants.predicate.equals(parser.getLocalName())) {
                    currentPredicate = Constants.valueFactory.createURI(currentValue);
                    currentValue = null;
                } else if (SerializationConstants.object.equals(parser.getLocalName())) {
                    if (NodeType.BNODE.name().equals(nodeType)) {
                        currentObject = Constants.valueFactory.createBNode(currentValue);
                    } else if (NodeType.URI.name().equals(nodeType)) {
                        currentObject = Constants.valueFactory.createURI(currentValue);
                    } else if (NodeType.LITERAL.name().equals(nodeType)) {
                        if (Base64.isArrayByteBase64(currentValue.getBytes(Constants.byteEncoding))) {
                            currentValue = new String(
                                    Base64.decodeBase64(currentValue.getBytes(Constants.byteEncoding)),
                                    Constants.byteEncoding);
                        }
                        if (datatype != null) {
                            currentObject = Constants.valueFactory.createLiteral(currentValue,
                                    Constants.valueFactory.createURI(datatype));
                        } else if (language != null) {
                            currentObject = Constants.valueFactory.createLiteral(currentValue, language);
                        } else {
                            currentObject = Constants.valueFactory.createLiteral(currentValue);
                        }
                    }
                    currentValue = null;
                    nodeType = null;
                    language = null;
                    datatype = null;
                } else if (SerializationConstants.namedGraphUri.equals(parser.getLocalName())) {
                    currentNamedGraphURI = Constants.valueFactory.createURI(currentValue);
                    currentValue = null;
                }
                break;
            case XMLStreamConstants.CHARACTERS:
                currentValue = parser.getText();
                break;
            case XMLStreamConstants.CDATA:
                currentValue = parser.getText();
                break;
            }
        }
        parser.close();
    } catch (XMLStreamException ex) {
        throw new AnzoException(ExceptionConstants.IO.READ_ERROR, ex, ex.getMessage());
    } catch (UnsupportedEncodingException uee) {
        throw new AnzoException(ExceptionConstants.IO.ENCODING_ERROR, uee);
    }
}

From source file:org.openanzo.services.serialization.XMLUpdatesReader.java

/**
 * Parse the data within the reader, passing the results to the IRepositoryHandler
 * /*from  w w w .  j  av a 2  s.c o  m*/
 * @param reader
 *            reader containing the data
 * @param handler
 *            Handler which will handle the elements within the data
 * @throws AnzoException
 */
private void parseUpdateTransactions(Reader reader, final IUpdatesHandler handler) throws AnzoException {
    try {
        XMLStreamReader parser = XMLFactoryFinder.getXMLInputFactory().createXMLStreamReader(reader);

        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
            switch (event) {
            case XMLStreamConstants.START_ELEMENT:
                if (SerializationConstants.transaction.equals(parser.getLocalName())) {
                    currentTransaction = parseTransaction(parser);
                } else if (SerializationConstants.transactionContext.equals(parser.getLocalName())) {
                    currentStatements = currentTransaction.getTransactionContext();
                } else if (SerializationConstants.preconditions.equals(parser.getLocalName())) {
                    currentStatements = new ArrayList<Statement>();
                } else if (SerializationConstants.namedGraphUpdates.equals(parser.getLocalName())) {
                    currentValue = null;
                } else if (SerializationConstants.namedGraph.equals(parser.getLocalName())) {
                    String uri = parser.getAttributeValue(null, SerializationConstants.namedGraphUri);
                    String uuid = parser.getAttributeValue(null, SerializationConstants.namedGraphUUID);
                    currentNamedGraphUpdate = new NamedGraphUpdate(MemURI.create(uri));
                    if (uuid != null) {
                        currentNamedGraphUpdate.setUUID(MemURI.create(uuid));
                    }
                    String revision = parser.getAttributeValue(null, SerializationConstants.revision);
                    if (revision != null) {
                        currentNamedGraphUpdate.setRevision(Long.parseLong(revision));
                    }
                } else if (SerializationConstants.additions.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getAdditions();
                } else if (SerializationConstants.metaAdditions.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getMetaAdditions();
                } else if (SerializationConstants.removals.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getRemovals();
                } else if (SerializationConstants.metaRemovals.equals(parser.getLocalName())) {
                    currentStatements = currentNamedGraphUpdate.getMetaRemovals();
                } else if (SerializationConstants.statement.equals(parser.getLocalName())) {
                } else if (SerializationConstants.subject.equals(parser.getLocalName())) {
                    nodeType = parser.getAttributeValue(null, SerializationConstants.subjectType);
                } else if (SerializationConstants.predicate.equals(parser.getLocalName())) {
                } else if (SerializationConstants.object.equals(parser.getLocalName())) {
                    nodeType = parser.getAttributeValue(null, SerializationConstants.objectType);
                    language = parser.getAttributeValue(null, SerializationConstants.language);
                    datatype = parser.getAttributeValue(null, SerializationConstants.dataType);
                } else if (SerializationConstants.namedGraphUri.equals(parser.getLocalName())) {
                } else if (SerializationConstants.errorResult.equals(parser.getLocalName())) {
                    String errorCodeStr = parser.getAttributeValue(null, SerializationConstants.errorCode);
                    errorCode = Long.parseLong(errorCodeStr);
                    errorArgs = new ArrayList<String>();
                } else if (SerializationConstants.errorMessageArg.equals(parser.getLocalName())) {

                }
                break;
            case XMLStreamConstants.END_ELEMENT:
                if (SerializationConstants.transaction.equals(parser.getLocalName())) {
                    handler.handleTransaction(currentTransaction);
                    currentTransaction = null;
                } else if (SerializationConstants.transactionContext.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.preconditions.equals(parser.getLocalName())) {
                    currentTransaction.getPreconditions()
                            .addAll(CommonSerializationUtils.parsePreconditionStatements(currentStatements));
                } else if (SerializationConstants.namedGraphUpdates.equals(parser.getLocalName())) {
                    if (currentValue != null)
                        currentTransaction.getUpdatedNamedGraphRevisions()
                                .putAll(CommonSerializationUtils.readNamedGraphRevisions(currentValue));
                } else if (SerializationConstants.namedGraph.equals(parser.getLocalName())) {
                    currentTransaction.addNamedGraphUpdate(currentNamedGraphUpdate);
                } else if (SerializationConstants.additions.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.metaAdditions.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.removals.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.metaRemovals.equals(parser.getLocalName())) {
                    currentStatements = null;
                } else if (SerializationConstants.statement.equals(parser.getLocalName())) {
                    currentStatements.add(Constants.valueFactory.createStatement(currentSubject,
                            currentPredicate, currentObject, currentNamedGraphURI));
                } else if (SerializationConstants.subject.equals(parser.getLocalName())) {
                    if (NodeType.BNODE.name().equals(nodeType)) {
                        currentSubject = Constants.valueFactory.createBNode(currentValue);
                    } else {
                        currentSubject = Constants.valueFactory.createURI(currentValue);
                    }
                    currentValue = null;
                    nodeType = null;
                } else if (SerializationConstants.predicate.equals(parser.getLocalName())) {
                    currentPredicate = Constants.valueFactory.createURI(currentValue);
                    currentValue = null;
                } else if (SerializationConstants.object.equals(parser.getLocalName())) {
                    if (NodeType.BNODE.name().equals(nodeType)) {
                        currentObject = Constants.valueFactory.createBNode(currentValue);
                    } else if (NodeType.URI.name().equals(nodeType)) {
                        currentObject = Constants.valueFactory.createURI(currentValue);
                    } else if (NodeType.LITERAL.name().equals(nodeType)) {
                        if (currentValue == null) {
                            currentValue = "";
                        } else if (Base64.isArrayByteBase64(currentValue.getBytes(Constants.byteEncoding))) {
                            currentValue = new String(
                                    Base64.decodeBase64(currentValue.getBytes(Constants.byteEncoding)),
                                    Constants.byteEncoding);
                        }
                        if (datatype != null) {
                            currentObject = Constants.valueFactory.createLiteral(currentValue,
                                    Constants.valueFactory.createURI(datatype));
                        } else if (language != null) {
                            currentObject = Constants.valueFactory.createLiteral(currentValue, language);
                        } else {
                            currentObject = Constants.valueFactory.createLiteral(currentValue);
                        }
                    }
                    currentValue = null;
                    nodeType = null;
                    language = null;
                    datatype = null;
                } else if (SerializationConstants.namedGraphUri.equals(parser.getLocalName())) {
                    currentNamedGraphURI = Constants.valueFactory.createURI(currentValue);
                    currentValue = null;
                } else if (SerializationConstants.errorResult.equals(parser.getLocalName())) {
                    currentTransaction.getErrors()
                            .add(new AnzoException(errorCode, errorArgs.toArray(new String[0])));
                    errorCode = 0;
                    errorArgs = null;
                } else if (SerializationConstants.errorMessageArg.equals(parser.getLocalName())) {
                    errorArgs.add(currentValue);
                    currentValue = null;
                }
                break;
            case XMLStreamConstants.CHARACTERS:
                if (parser.hasText())
                    currentValue = parser.getText();
                break;
            case XMLStreamConstants.CDATA:
                if (parser.hasText())
                    currentValue = parser.getText();
                break;
            }
        }
        parser.close();
    } catch (XMLStreamException ex) {
        throw new AnzoException(ExceptionConstants.IO.READ_ERROR, ex, ex.getMessage());
    } catch (UnsupportedEncodingException uee) {
        throw new AnzoException(ExceptionConstants.IO.ENCODING_ERROR, uee);
    }
}

From source file:org.openo.nfvo.emsdriver.collector.TaskThread.java

private boolean processCMXml(File tempfile, String nename, String type) {

    String csvpath = localPath + nename + "/" + type + "/";
    File csvpathfile = new File(csvpath);
    if (!csvpathfile.exists()) {
        csvpathfile.mkdirs();//from w ww  .  java  2 s  .com
    }
    String csvFileName = nename + dateFormat.format(new Date()) + System.nanoTime();
    String csvpathAndFileName = csvpath + csvFileName + ".csv";
    BufferedOutputStream bos = null;
    FileOutputStream fos = null;
    try {
        fos = new FileOutputStream(csvpathAndFileName, false);
        bos = new BufferedOutputStream(fos, 10240);
    } catch (FileNotFoundException e1) {
        log.error("FileNotFoundException " + StringUtil.getStackTrace(e1));
    }

    boolean FieldNameFlag = false;
    boolean FieldValueFlag = false;
    //line num
    int countNum = 0;
    String xmlPathAndFileName = null;
    String localName = null;
    String endLocalName = null;
    String rmUID = null;
    int index = -1;
    ArrayList<String> names = new ArrayList<String>();// colname
    LinkedHashMap<String, String> nameAndValue = new LinkedHashMap<String, String>();

    FileInputStream fis = null;
    InputStreamReader isr = null;
    XMLStreamReader reader = null;
    try {
        fis = new FileInputStream(tempfile);
        isr = new InputStreamReader(fis, Constant.ENCODING_UTF8);
        XMLInputFactory fac = XMLInputFactory.newInstance();
        reader = fac.createXMLStreamReader(isr);
        int event = -1;
        boolean setcolum = true;
        while (reader.hasNext()) {
            try {
                event = reader.next();
                switch (event) {
                case XMLStreamConstants.START_ELEMENT:
                    localName = reader.getLocalName();
                    if ("FieldName".equalsIgnoreCase(localName)) {
                        FieldNameFlag = true;
                    }
                    if (FieldNameFlag) {
                        if ("N".equalsIgnoreCase(localName)) {
                            String colName = reader.getElementText().trim();
                            names.add(colName);
                        }
                    }
                    if ("FieldValue".equalsIgnoreCase(localName)) {
                        FieldValueFlag = true;

                    }
                    if (FieldValueFlag) {
                        if (setcolum) {
                            xmlPathAndFileName = this.setColumnNames(nename, names, type);
                            setcolum = false;
                        }

                        if ("Object".equalsIgnoreCase(localName)) {
                            int ac = reader.getAttributeCount();
                            for (int i = 0; i < ac; i++) {
                                if ("rmUID".equalsIgnoreCase(reader.getAttributeLocalName(i))) {
                                    rmUID = reader.getAttributeValue(i).trim();
                                }
                            }
                            nameAndValue.put("rmUID", rmUID);
                        }
                        if ("V".equalsIgnoreCase(localName)) {
                            index = Integer.parseInt(reader.getAttributeValue(0)) - 1;
                            String currentName = names.get(index);
                            String v = reader.getElementText().trim();
                            nameAndValue.put(currentName, v);
                        }
                    }
                    break;
                case XMLStreamConstants.CHARACTERS:
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    endLocalName = reader.getLocalName();

                    if ("FieldName".equalsIgnoreCase(endLocalName)) {
                        FieldNameFlag = false;
                    }
                    if ("FieldValue".equalsIgnoreCase(endLocalName)) {
                        FieldValueFlag = false;
                    }
                    if ("Object".equalsIgnoreCase(endLocalName)) {
                        countNum++;
                        this.appendLine(nameAndValue, bos);
                        nameAndValue.clear();
                    }
                    break;
                }
            } catch (Exception e) {
                log.error("" + StringUtil.getStackTrace(e));
                event = reader.next();
            }
        }

        if (bos != null) {
            bos.close();
            bos = null;
        }
        if (fos != null) {
            fos.close();
            fos = null;
        }

        String[] fileKeys = this.createZipFile(csvpathAndFileName, xmlPathAndFileName, nename);
        //ftp store
        Properties ftpPro = configurationInterface.getProperties();
        String ip = ftpPro.getProperty("ftp_ip");
        String port = ftpPro.getProperty("ftp_port");
        String ftp_user = ftpPro.getProperty("ftp_user");
        String ftp_password = ftpPro.getProperty("ftp_password");

        String ftp_passive = ftpPro.getProperty("ftp_passive");
        String ftp_type = ftpPro.getProperty("ftp_type");
        String remoteFile = ftpPro.getProperty("ftp_remote_path");
        this.ftpStore(fileKeys, ip, port, ftp_user, ftp_password, ftp_passive, ftp_type, remoteFile);
        //create Message
        String message = this.createMessage(fileKeys[1], ftp_user, ftp_password, ip, port, countNum, nename);

        //set message
        this.setMessage(message);
    } catch (Exception e) {
        log.error("" + StringUtil.getStackTrace(e));
        return false;
    } finally {
        try {
            if (reader != null) {
                reader.close();
            }
            if (isr != null) {
                isr.close();
            }
            if (fis != null) {
                fis.close();
            }
            if (bos != null) {
                bos.close();
            }

            if (fos != null) {
                fos.close();
            }
        } catch (Exception e) {
            log.error(e);
        }
    }
    return true;
}

From source file:org.opentestsystem.delivery.AccValidator.handlers.ValidationHandler.java

public void validateXmlAccs(String filePath, String xsdPath) throws ValidationException {
    try {//from   ww  w  .  j  a va2s  .c o m
        InputStream xmlInput = new FileInputStream(new File(filePath));
        InputStream xsdInput = new FileInputStream(new File(xsdPath));

        String text = null;
        XMLInputFactory factory = XMLInputFactory.newInstance();
        factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
        XMLStreamReader reader = factory.createXMLStreamReader(xmlInput);

        boolean firstSelect = true;
        MasterResourceAccommodation masterResource = null;
        List<MasterResourceAccommodation> resourceFamiltyMasterResourceAccommodations = null;
        AccommodationText accommodationText = null;
        List<AccommodationText> accommodationTexts = null;
        AccommodationOption accommodationOption = null;
        List<AccommodationOption> accommodationOptions = null;
        AccFamilySubject familySubject = null;
        List<AccFamilySubject> familySubjects = null;
        ResourceFamily resourceFamily = null;
        List<String> grades = null;

        while (reader.hasNext()) {
            int Event = reader.next();
            switch (Event) {
            case XMLStreamConstants.START_ELEMENT: {
                switch (reader.getLocalName()) {
                case "MasterResourceFamily":
                    _masterResourceAccommodations = new ArrayList<MasterResourceAccommodation>();

                    break;
                case "SingleSelectResource":
                    masterResource = new MasterResourceAccommodation();
                    accommodationTexts = new ArrayList<AccommodationText>();
                    accommodationOptions = new ArrayList<AccommodationOption>();
                    break;

                case "MultiSelectResource":
                    masterResource = new MasterResourceAccommodation();
                    accommodationTexts = new ArrayList<AccommodationText>();
                    accommodationOptions = new ArrayList<AccommodationOption>();
                    break;
                case "EditResource":
                    masterResource = new MasterResourceAccommodation();
                    accommodationTexts = new ArrayList<AccommodationText>();
                    accommodationOptions = new ArrayList<AccommodationOption>();
                    break;
                case "ResourceFamily":
                    masterResource = new MasterResourceAccommodation();
                    familySubjects = new ArrayList<AccFamilySubject>();
                    resourceFamily = new ResourceFamily();
                    accommodationTexts = new ArrayList<AccommodationText>();
                    accommodationText = new AccommodationText();
                    resourceFamiltyMasterResourceAccommodations = new ArrayList<MasterResourceAccommodation>();
                    grades = new ArrayList<String>();
                    break;
                case "Subject":
                    familySubject = new AccFamilySubject();
                    break;
                case "Selection":
                    if (firstSelect) {
                        masterResource.setHeader(accommodationTexts);
                        accommodationOption = new AccommodationOption();
                        accommodationTexts = new ArrayList<AccommodationText>();
                    } else {
                        accommodationOption = new AccommodationOption();
                    }
                    firstSelect = false;
                    break;

                case "Text":
                    accommodationText = new AccommodationText();

                    break;
                default:
                    break;
                }
                break;
            }
            case XMLStreamConstants.CHARACTERS: {
                String nodeValue = getContents(reader.getText());
                if (nodeValue.length() > 0) {
                    text = nodeValue;
                }
                break;
            }
            case XMLStreamConstants.END_ELEMENT: {
                switch (reader.getLocalName()) {
                case "Code":
                    if (accommodationOption == null) {
                        if (familySubject == null) {
                            masterResource.setCode(text);
                        } else {
                            familySubject.setCode(text);
                        }
                    } else {
                        accommodationOption.setCode(text);
                    }
                    text = null;
                    break;
                case "Order":
                    if (accommodationOption == null) {
                        masterResource.setOrder(Integer.valueOf(text));
                    } else {
                        accommodationOption.setOrder(Integer.valueOf(text));
                    }
                    text = null;
                    break;
                case "MutuallyExclusive":
                    accommodationOption.setMutuallyExclusive(true);
                    text = null;
                    break;
                case "DefaultSelection":
                    masterResource.setDefaultSelection(text);
                    text = null;
                    break;
                case "Disabled":
                    masterResource.setDisabled(true);
                    text = null;
                    break;
                case "Language":
                    accommodationText.setLanguage(text);
                    text = null;
                    break;
                case "Label":
                    accommodationText.setLabel(text);
                    text = null;
                    break;
                case "Description":
                    accommodationText.setDescription(text);
                    text = null;
                    break;
                case "Message":
                    accommodationText.setMessage(text);
                    text = null;
                    break;
                case "Text":
                    accommodationTexts.add(accommodationText);
                    text = null;
                    break;
                case "Selection":
                    accommodationOption.setText(accommodationTexts);
                    accommodationOptions.add(accommodationOption);
                    accommodationOption = new AccommodationOption();
                    accommodationTexts = new ArrayList<AccommodationText>();
                    text = null;
                    break;
                case "SingleSelectResource":
                    masterResource.setResourceType("SingleSelectResource");
                    if (accommodationTexts.size() > 0) {
                        masterResource.setHeader(accommodationTexts);
                    }
                    masterResource.setOptions(accommodationOptions);
                    if (resourceFamily == null) {
                        _masterResourceAccommodations.add(masterResource);
                    } else {
                        resourceFamiltyMasterResourceAccommodations.add(masterResource);
                    }
                    masterResource = null;
                    accommodationOption = null;
                    accommodationOption = null;
                    firstSelect = true;
                    text = null;
                    break;
                case "MultiSelectResource":
                    masterResource.setResourceType("MultiSelectResource");
                    if (accommodationTexts.size() > 0) {
                        masterResource.setHeader(accommodationTexts);
                    }
                    masterResource.setOptions(accommodationOptions);
                    if (resourceFamily == null) {
                        _masterResourceAccommodations.add(masterResource);
                    } else {
                        resourceFamiltyMasterResourceAccommodations.add(masterResource);
                    }
                    masterResource = null;
                    accommodationOption = null;
                    accommodationOption = null;
                    firstSelect = true;
                    text = null;
                    break;
                case "EditResource":
                    masterResource.setResourceType("EditResource");
                    if (accommodationTexts.size() > 0) {
                        masterResource.setHeader(accommodationTexts);
                    }
                    masterResource.setOptions(accommodationOptions);
                    if (resourceFamily == null) {
                        _masterResourceAccommodations.add(masterResource);
                    } else {
                        resourceFamiltyMasterResourceAccommodations.add(masterResource);
                    }
                    masterResource = null;
                    accommodationOption = null;
                    accommodationOption = null;
                    firstSelect = true;
                    text = null;
                    break;
                case "ResourceFamily":
                    resourceFamily.setSubject(familySubjects);
                    resourceFamily.setGrade(grades);
                    resourceFamily.setMasterResourceAccommodation(resourceFamiltyMasterResourceAccommodations);
                    _resourceFamilies.add(resourceFamily);
                    familySubjects = null;
                    grades = null;
                    resourceFamily = null;
                    resourceFamiltyMasterResourceAccommodations = null;
                    text = null;
                    break;
                case "Name":
                    familySubject.setName(text);
                    text = null;
                    break;
                case "Subject":
                    familySubjects.add(familySubject);
                    familySubject = null;
                    text = null;
                    break;
                case "Grade":
                    grades.add(text);
                    text = null;
                    break;
                }
                break;
            }
            }
        }

        validateRules(_masterResourceAccommodations, _resourceFamilies);
        // validation against xsd
        xmlInput = new FileInputStream(new File(filePath));
        xsdInput = new FileInputStream(new File(xsdPath));
        validateAgainstXSD(xmlInput, xsdInput);

    } catch (IOException e) {
        throw new ValidationException("failed",
                "The xml could not be parsed into objects. The error message is:" + e.getMessage());
    } catch (XMLStreamException e) {
        throw new ValidationException("failed",
                "The xml could not be parsed into objects. The error message is:" + e.getMessage());
    }
}

From source file:org.orbisgis.core.layerModel.mapcatalog.RemoteMapCatalog.java

/**
 * Read the parser and feed the provided list with workspaces
 * @param workspaces Writable, empty list of workspaces
 * @param parser Opened parser//from w w  w.  j  a v  a  2s  . c  o  m
 * @throws XMLStreamException 
 */
public void parseXML(List<Workspace> workspaces, XMLStreamReader parser) throws XMLStreamException {
    List<String> hierarchy = new ArrayList<String>();
    // Hold workspace name
    StringBuilder characters = new StringBuilder();
    // Starting with a valid event, iterating while the parser
    // does not reach the end document XML tag
    for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
        // For each XML elements
        switch (event) {
        case XMLStreamConstants.START_ELEMENT:
            hierarchy.add(parser.getLocalName());
            break;
        case XMLStreamConstants.END_ELEMENT:
            if (RemoteCommons.endsWith(hierarchy, "workspaces", "workspace", "name")) {
                workspaces.add(new Workspace(cParams, characters.toString().trim()));
            }
            hierarchy.remove(hierarchy.size() - 1);
            characters = new StringBuilder(); // Clear the string buffer
            break;
        case XMLStreamConstants.CHARACTERS:
            characters.append(StringEscapeUtils.unescapeHtml(parser.getText()));
            break;
        }
    }
}

From source file:org.orbisgis.core.layerModel.mapcatalog.Workspace.java

/**
 * Read the parser and feed the provided list with workspaces
 * @param mapContextList Writable, empty list of RemoteMapContext
 * @param parser Opened parser/*from  www .jav  a  2 s  .c  o  m*/
 * @throws XMLStreamException 
 */
public void parseXML(List<RemoteMapContext> mapContextList, XMLStreamReader parser)
        throws XMLStreamException, UnsupportedEncodingException {
    List<String> hierarchy = new ArrayList<String>();
    RemoteMapContext curMapContext = null;
    Locale curLocale = null;
    StringBuilder characters = new StringBuilder();
    for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
        // For each XML elements
        switch (event) {
        case XMLStreamConstants.START_ELEMENT:
            hierarchy.add(parser.getLocalName());
            if (RemoteCommons.endsWith(hierarchy, "contexts", "context")) {
                curMapContext = new RemoteOwsMapContext(cParams);
                curMapContext.setWorkspaceName(workspaceName);
            }
            // Parse attributes
            for (int attributeId = 0; attributeId < parser.getAttributeCount(); attributeId++) {
                String attributeName = parser.getAttributeLocalName(attributeId);
                if (attributeName.equals("id")) {
                    curMapContext.setId(Integer.parseInt(parser.getAttributeValue(attributeId)));
                } else if (attributeName.equals("date")) {
                    String attributeValue = parser.getAttributeValue(attributeId);
                    try {
                        curMapContext.setDate(parseDate(attributeValue));
                    } catch (ParseException ex) {
                        LOGGER.warn(I18N.tr("Cannot parse the provided date {0}", attributeValue), ex);
                    }
                } else if (attributeName.equals("lang")) {
                    curLocale = LocalizedText.forLanguageTag(parser.getAttributeValue(attributeId));
                }
            }
            break;
        case XMLStreamConstants.END_ELEMENT:
            if (RemoteCommons.endsWith(hierarchy, "contexts", "context")) {
                mapContextList.add(curMapContext);
                curMapContext = null;
            } else if (RemoteCommons.endsWith(hierarchy, "contexts", "context", "title")) {
                Locale descLocale = Locale.getDefault();
                if (curLocale != null) {
                    descLocale = curLocale;
                }
                curMapContext.getDescription().addTitle(descLocale,
                        StringEscapeUtils.unescapeHtml(characters.toString().trim()));
            } else if (RemoteCommons.endsWith(hierarchy, "contexts", "context", "abstract")) {
                Locale descLocale = Locale.getDefault();
                if (curLocale != null) {
                    descLocale = curLocale;
                }
                curMapContext.getDescription().addAbstract(descLocale,
                        StringEscapeUtils.unescapeHtml(characters.toString().trim()));
            }
            characters = new StringBuilder();
            curLocale = null;
            hierarchy.remove(hierarchy.size() - 1);
            break;
        case XMLStreamConstants.CHARACTERS:
            characters.append(StringEscapeUtils.unescapeHtml(parser.getText()));
            break;
        }
    }
}

From source file:org.orbisgis.coremap.layerModel.mapcatalog.RemoteMapCatalog.java

/**
 * Read the parser and feed the provided list with workspaces
 * @param workspaces Writable, empty list of workspaces
 * @param parser Opened parser/*from   www.jav a 2  s  .  c  o m*/
 * @throws XMLStreamException 
 */
public void parseXML(List<Workspace> workspaces, XMLStreamReader parser) throws XMLStreamException {
    List<String> hierarchy = new ArrayList<String>();
    // Hold workspace name
    StringBuilder characters = new StringBuilder();
    // Starting with a valid event, iterating while the parser
    // does not reach the end document XML tag
    for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
        // For each XML elements
        switch (event) {
        case XMLStreamConstants.START_ELEMENT:
            hierarchy.add(parser.getLocalName());
            break;
        case XMLStreamConstants.END_ELEMENT:
            if (RemoteCommons.endsWith(hierarchy, "workspaces", "workspace", "name")) {
                workspaces.add(new Workspace(cParams, characters.toString().trim()));
            }
            hierarchy.remove(hierarchy.size() - 1);
            characters = new StringBuilder(); // Clear the string buffer
            break;
        case XMLStreamConstants.CHARACTERS:
            characters.append(StringEscapeUtils.unescapeHtml4(parser.getText()));
            break;
        }
    }
}

From source file:org.orbisgis.coremap.layerModel.mapcatalog.Workspace.java

/**
 * Read the parser and feed the provided list with workspaces
 * @param mapContextList Writable, empty list of RemoteMapContext
 * @param parser Opened parser//from   w w  w.  ja  v  a2s  . c  o  m
 * @throws XMLStreamException 
 */
public void parseXML(List<RemoteMapContext> mapContextList, XMLStreamReader parser)
        throws XMLStreamException, UnsupportedEncodingException {
    List<String> hierarchy = new ArrayList<String>();
    RemoteMapContext curMapContext = null;
    Locale curLocale = null;
    StringBuilder characters = new StringBuilder();
    for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
        // For each XML elements
        switch (event) {
        case XMLStreamConstants.START_ELEMENT:
            hierarchy.add(parser.getLocalName());
            if (RemoteCommons.endsWith(hierarchy, "contexts", "context")) {
                curMapContext = new RemoteOwsMapContext(cParams);
                curMapContext.setWorkspaceName(workspaceName);
            }
            // Parse attributes
            for (int attributeId = 0; attributeId < parser.getAttributeCount(); attributeId++) {
                String attributeName = parser.getAttributeLocalName(attributeId);
                if (attributeName.equals("id")) {
                    curMapContext.setId(Integer.parseInt(parser.getAttributeValue(attributeId)));
                } else if (attributeName.equals("date")) {
                    String attributeValue = parser.getAttributeValue(attributeId);
                    try {
                        curMapContext.setDate(parseDate(attributeValue));
                    } catch (ParseException ex) {
                        LOGGER.warn(I18N.tr("Cannot parse the provided date {0}", attributeValue), ex);
                    }
                } else if (attributeName.equals("lang")) {
                    curLocale = LocalizedText.forLanguageTag(parser.getAttributeValue(attributeId));
                }
            }
            break;
        case XMLStreamConstants.END_ELEMENT:
            if (RemoteCommons.endsWith(hierarchy, "contexts", "context")) {
                mapContextList.add(curMapContext);
                curMapContext = null;
            } else if (RemoteCommons.endsWith(hierarchy, "contexts", "context", "title")) {
                Locale descLocale = Locale.getDefault();
                if (curLocale != null) {
                    descLocale = curLocale;
                }
                curMapContext.getDescription().addTitle(descLocale,
                        StringEscapeUtils.unescapeHtml4(characters.toString().trim()));
            } else if (RemoteCommons.endsWith(hierarchy, "contexts", "context", "abstract")) {
                Locale descLocale = Locale.getDefault();
                if (curLocale != null) {
                    descLocale = curLocale;
                }
                curMapContext.getDescription().addAbstract(descLocale,
                        StringEscapeUtils.unescapeHtml4(characters.toString().trim()));
            }
            characters = new StringBuilder();
            curLocale = null;
            hierarchy.remove(hierarchy.size() - 1);
            break;
        case XMLStreamConstants.CHARACTERS:
            characters.append(StringEscapeUtils.unescapeHtml4(parser.getText()));
            break;
        }
    }
}

From source file:org.pentaho.di.trans.steps.webservices.WebService.java

private void compatibleProcessRows(InputStream anXml, Object[] rowData, RowMetaInterface rowMeta,
        boolean ignoreNamespacePrefix, String encoding) throws KettleException {

    // First we should get the complete string
    // The problem is that the string can contain XML or any other format such as HTML saying the service is no longer
    // available.
    // We're talking about a WEB service here.
    // As such, to keep the original parsing scheme, we first read the content.
    // Then we create an input stream from the content again.
    // It's elaborate, but that way we can report on the failure more correctly.
    ///*from  w ww  .  j  a  va  2s  . c  o  m*/
    String response = readStringFromInputStream(anXml, encoding);

    // Create a new reader to feed into the XML Input Factory below...
    //
    StringReader stringReader = new StringReader(response.toString());

    // TODO Very empirical : see if we can do something better here
    try {
        XMLInputFactory vFactory = XMLInputFactory.newInstance();
        XMLStreamReader vReader = vFactory.createXMLStreamReader(stringReader);

        Object[] outputRowData = RowDataUtil.allocateRowData(data.outputRowMeta.size());
        int outputIndex = 0;

        boolean processing = false;
        boolean oneValueRowProcessing = false;
        for (int event = vReader.next(); vReader.hasNext(); event = vReader.next()) {
            switch (event) {
            case XMLStreamConstants.START_ELEMENT:

                // Start new code
                // START_ELEMENT= 1
                //
                if (log.isRowLevel()) {
                    logRowlevel("START_ELEMENT / " + vReader.getAttributeCount() + " / "
                            + vReader.getNamespaceCount());
                }

                // If we start the xml element named like the return type,
                // we start a new row
                //
                if (log.isRowLevel()) {
                    logRowlevel("vReader.getLocalName = " + vReader.getLocalName());
                }
                if (Const.isEmpty(meta.getOutFieldArgumentName())) {
                    // getOutFieldArgumentName() == null
                    if (oneValueRowProcessing) {
                        WebServiceField field = meta.getFieldOutFromWsName(vReader.getLocalName(),
                                ignoreNamespacePrefix);
                        if (field != null) {
                            outputRowData[outputIndex++] = getValue(vReader.getElementText(), field);
                            putRow(data.outputRowMeta, outputRowData);
                            oneValueRowProcessing = false;
                        } else {
                            if (meta.getOutFieldContainerName().equals(vReader.getLocalName())) {
                                // meta.getOutFieldContainerName() = vReader.getLocalName()
                                if (log.isRowLevel()) {
                                    logRowlevel("OutFieldContainerName = " + meta.getOutFieldContainerName());
                                }
                                oneValueRowProcessing = true;
                            }
                        }
                    }
                } else {
                    // getOutFieldArgumentName() != null
                    if (log.isRowLevel()) {
                        logRowlevel("OutFieldArgumentName = " + meta.getOutFieldArgumentName());
                    }
                    if (meta.getOutFieldArgumentName().equals(vReader.getLocalName())) {
                        if (log.isRowLevel()) {
                            logRowlevel("vReader.getLocalName = " + vReader.getLocalName());
                        }
                        if (log.isRowLevel()) {
                            logRowlevel("OutFieldArgumentName = ");
                        }
                        if (processing) {
                            WebServiceField field = meta.getFieldOutFromWsName(vReader.getLocalName(),
                                    ignoreNamespacePrefix);
                            if (field != null) {
                                int index = data.outputRowMeta.indexOfValue(field.getName());
                                if (index >= 0) {
                                    outputRowData[index] = getValue(vReader.getElementText(), field);
                                }
                            }
                            processing = false;
                        } else {
                            WebServiceField field = meta.getFieldOutFromWsName(vReader.getLocalName(),
                                    ignoreNamespacePrefix);
                            if (meta.getFieldsOut().size() == 1 && field != null) {
                                // This can be either a simple return element, or a complex type...
                                //
                                try {
                                    if (meta.isPassingInputData()) {
                                        for (int i = 0; i < rowMeta.getValueMetaList().size(); i++) {
                                            ValueMetaInterface valueMeta = getInputRowMeta().getValueMeta(i);
                                            outputRowData[outputIndex++] = valueMeta.cloneValueData(rowData[i]);

                                        }
                                    }

                                    outputRowData[outputIndex++] = getValue(vReader.getElementText(), field);
                                    putRow(data.outputRowMeta, outputRowData);
                                } catch (WstxParsingException e) {
                                    throw new KettleStepException("Unable to get value for field ["
                                            + field.getName()
                                            + "].  Verify that this is not a complex data type by looking at the response XML.",
                                            e);
                                }
                            } else {
                                for (WebServiceField curField : meta.getFieldsOut()) {
                                    if (!Const.isEmpty(curField.getName())) {
                                        outputRowData[outputIndex++] = getValue(vReader.getElementText(),
                                                curField);
                                    }
                                }
                                processing = true;
                            }
                        }

                    } else {
                        if (log.isRowLevel()) {
                            logRowlevel("vReader.getLocalName = " + vReader.getLocalName());
                        }
                        if (log.isRowLevel()) {
                            logRowlevel("OutFieldArgumentName = " + meta.getOutFieldArgumentName());
                        }
                    }
                }
                break;

            case XMLStreamConstants.END_ELEMENT:
                // END_ELEMENT= 2
                if (log.isRowLevel()) {
                    logRowlevel("END_ELEMENT");
                }
                // If we end the xml element named as the return type, we
                // finish a row
                if ((meta.getOutFieldArgumentName() == null
                        && meta.getOperationName().equals(vReader.getLocalName()))) {
                    oneValueRowProcessing = false;
                } else if (meta.getOutFieldArgumentName() != null
                        && meta.getOutFieldArgumentName().equals(vReader.getLocalName())) {
                    putRow(data.outputRowMeta, outputRowData);
                    processing = false;
                }
                break;
            case XMLStreamConstants.PROCESSING_INSTRUCTION:
                // PROCESSING_INSTRUCTION= 3
                if (log.isRowLevel()) {
                    logRowlevel("PROCESSING_INSTRUCTION");
                }
                break;
            case XMLStreamConstants.CHARACTERS:
                // CHARACTERS= 4
                if (log.isRowLevel()) {
                    logRowlevel("CHARACTERS");
                }
                break;
            case XMLStreamConstants.COMMENT:
                // COMMENT= 5
                if (log.isRowLevel()) {
                    logRowlevel("COMMENT");
                }
                break;
            case XMLStreamConstants.SPACE:
                // PROCESSING_INSTRUCTION= 6
                if (log.isRowLevel()) {
                    logRowlevel("PROCESSING_INSTRUCTION");
                }
                break;
            case XMLStreamConstants.START_DOCUMENT:
                // START_DOCUMENT= 7
                if (log.isRowLevel()) {
                    logRowlevel("START_DOCUMENT");
                }
                if (log.isRowLevel()) {
                    logRowlevel(vReader.getText());
                }
                break;
            case XMLStreamConstants.END_DOCUMENT:
                // END_DOCUMENT= 8
                if (log.isRowLevel()) {
                    logRowlevel("END_DOCUMENT");
                }
                break;
            case XMLStreamConstants.ENTITY_REFERENCE:
                // ENTITY_REFERENCE= 9
                if (log.isRowLevel()) {
                    logRowlevel("ENTITY_REFERENCE");
                }
                break;
            case XMLStreamConstants.ATTRIBUTE:
                // ATTRIBUTE= 10
                if (log.isRowLevel()) {
                    logRowlevel("ATTRIBUTE");
                }
                break;
            case XMLStreamConstants.DTD:
                // DTD= 11
                if (log.isRowLevel()) {
                    logRowlevel("DTD");
                }
                break;
            case XMLStreamConstants.CDATA:
                // CDATA= 12
                if (log.isRowLevel()) {
                    logRowlevel("CDATA");
                }
                break;
            case XMLStreamConstants.NAMESPACE:
                // NAMESPACE= 13
                if (log.isRowLevel()) {
                    logRowlevel("NAMESPACE");
                }
                break;
            case XMLStreamConstants.NOTATION_DECLARATION:
                // NOTATION_DECLARATION= 14
                if (log.isRowLevel()) {
                    logRowlevel("NOTATION_DECLARATION");
                }
                break;
            case XMLStreamConstants.ENTITY_DECLARATION:
                // ENTITY_DECLARATION= 15
                if (log.isRowLevel()) {
                    logRowlevel("ENTITY_DECLARATION");
                }
                break;
            default:
                break;
            }
        }
    } catch (Exception e) {
        throw new KettleStepException(
                BaseMessages.getString(PKG, "WebServices.ERROR0010.OutputParsingError", response.toString()),
                e);
    }
}