Package com.xmultra.util

Examples of com.xmultra.util.DOMPrinter


        fileUtils = (FileUtils)initMapHolder.getEntry(
                        InitMapHolder.FILE_UTILS);
        xmlParseUtils = (XmlParseUtils)initMapHolder.getEntry(
                        InitMapHolder.XML_PARSE_UTILS);

        domPrinter = new DOMPrinter();

        // Check to see if the SystemErrorLog is being created.
        if (!systemLog) {

            // If not, its a Manager node so get the child
View Full Code Here


                callString += "?, ";
            }
            callString += "?)}";
            CallableStatement cstmt = con.prepareCall(callString.toString());

            DOMPrinter domPrinter = new DOMPrinter();

            // Parse the xml document for the row of the table
            for (int j = 0; j < paramNodeList.getLength(); j++) {
                // Get the node from the node list
                Node paramNode = paramNodeList.item(j);

                // Get name for the field
                String nameValue = xmlParseUtils.getAttributeValueFromNode(paramNode,
                                                                           "Name");
                // Get type for the field
                String typeValue = xmlParseUtils.getAttributeValueFromNode(paramNode,
                                                                           "Type");
                // Get text value for the node
                String textValue = "";
                if (typeValue.equals("String")) {
                    // Get child nodes
                    NodeList paramChildNodeList = paramNode.getChildNodes();
                    // If child node is not empty
                    if (paramChildNodeList.getLength() > 0) {
                        for (int k = 0; k < paramNodeList.getLength(); k++) {
                            textValue += domPrinter.printToString(paramChildNodeList.item(k),
                                                                  "", "", false);
                        }
                    } else {
                        textValue = xmlParseUtils.getTextFromNode(paramNode);
                    }
View Full Code Here

        fileUtils = (FileUtils)initMapHolder.getEntry(
                        InitMapHolder.FILE_UTILS);
        xmlParseUtils = (XmlParseUtils)initMapHolder.getEntry(
                        InitMapHolder.XML_PARSE_UTILS);

        domPrinter = new DOMPrinter();

        // Check to see if the SystemErrorLog is being created.
        if (!systemLog) {

            // If not, its a Manager node so get the child
View Full Code Here

            String callString = callStringBuffer.toString();

            CallableStatement cstmt = con.prepareCall(callString);

            DOMPrinter domPrinter = new DOMPrinter();

            // Parse the XML document for parameters to the db call.
            for (int j = 0; j < paramNodeList.getLength(); j++) {
                // Get the node from the node list
                Node paramNode = paramNodeList.item(j);

                // Get name of the parameter.
                String nameValue = xmlParseUtils.getAttributeValueFromNode(paramNode,
                                                                           DBXmlConfig.NAME);
                // Get type of the parameter.
                String typeValue = xmlParseUtils.getAttributeValueFromNode(paramNode,
                                                                           DBXmlConfig.TYPE);
                // Get text value for the node
                String textValue = "";
                if (typeValue.equals(DBXmlConfig.STRING)) {
                    // Get child nodes
                    NodeList paramChildNodeList = paramNode.getChildNodes();
                    // If child node is not empty
                    if (paramChildNodeList.getLength() > 0) {
                        for (int k = 0; k < paramNodeList.getLength(); k++) {
                            textValue += domPrinter.printToString(paramChildNodeList.item(k),
                                                                  "", "", false);
                        }
                    } else {
                        textValue = xmlParseUtils.getTextFromNode(paramNode);
                    }
                } else {
                    textValue = xmlParseUtils.getTextFromNode(paramNode);
                }

                if (typeValue.equals(DBXmlConfig.STRING)) {
                    // Set the string
                    cstmt.setString(nameValue, textValue);
                } else if (typeValue.equals(DBXmlConfig.INT)) {
                    // Convert string into int data type
                    int myInteger = Integer.valueOf(textValue).intValue() ;

                    // Set the int
                    cstmt.setInt(nameValue, myInteger);
                } else if (typeValue.equals(DBXmlConfig.DATE)) {
                    // Convert string into date data type
                    Date myDate = Date.valueOf(textValue);

                    // Set the date
                    cstmt.setDate(nameValue, myDate);
                }
            } // end for each parameter

            // Call the stored procedure to insert the data
            try {
                cstmt.execute();

                if (writeData) {
                    ResultSet rs = null;

                    try {
                        rs = cstmt.getResultSet();

                        while (rs.next()) {
                            if (writeData) {
                                this.dataWriter.append(rs);
                            }
                        }   // end while next record is available
                    }
                    finally {
                        try {
                            if (writeData) {
                                this.dataWriter.write(this.currentFilename, procedureNameValue);
                            }
                            if (rs != null) {
                                rs.close();
                            }
                        }
                        catch (SQLException sqle) {
                            super.msgEntry.setAppContext("callStoredProcedure()");
                            super.msgEntry.setDocInfo(currentFilename);
                            super.msgEntry.setMessageText("Unable to close result set.");
                            StringBuffer buffer = new StringBuffer(100);
                            // Multiple exceptions may be chained together. Get all information.
                            while (sqle != null) {
                                buffer.append( "Message: "    + sqle.getMessage() );
                                buffer.append( " SQLState: "  + sqle.getSQLState() );
                                buffer.append( " ErrorCode: " + sqle.getErrorCode() );
                                sqle = sqle.getNextException();
                            }
                            super.msgEntry.setError( new String(buffer) );
                            logger.logWarning(super.msgEntry);
                        }
                    }
                }
            }
            catch (MysqlDataTruncation mdt) {
                msgEntry.setAppContext("callStoredProcedure()");
                msgEntry.setMessageText("Truncation error: Data is too long for column");
                msgEntry.setDocInfo( domPrinter.simplePrintToString(modelDoc, "", "").substring(0, 350) );
                msgEntry.setError(mdt.getMessage());
                logger.logWarning(msgEntry);
                throw(mdt);
            }
            finally {
View Full Code Here

        else {       // otherwise node is the Manager Node
            emailNode = xmlParseUtils.getChildNode(node.getParentNode(),
                        XmultraConfig.EMAIL_LOG_ELEMENT);
        }

        domPrinter = new DOMPrinter();

        // Make the DOC_TYPE tag.
        docTypeTagWithRoot  = DOC_TYPE_TAG +
                                fileUtils.addRoot(EMAIL_DTD_FILE) + "\">\n";
    }
View Full Code Here

        if (!super.init(n, imh, sf, stopFlag)) return false;

        this.fileHolder = new FileHolder();
        this.strings = new Strings();
        this.printer = new DOMPrinter(this.xmlParseUtils);

        Element rssMergeEl = (Element)n;

        this.destWriter = new DestinationWriter();
View Full Code Here

            String callString = callStringBuffer.toString();

            OracleCallableStatement cstmt =
                (OracleCallableStatement) con.prepareCall(callString.toString());

            DOMPrinter domPrinter = new DOMPrinter();

            // Iterate through list of Param nodes.
            for (int paramIndex = 0; paramIndex < paramCount; paramIndex++) {

                // Get the node from the node list
View Full Code Here

        String newsPreParserStr = super.xmlParseUtils.getAttributeValueFromNode(
                aProcessorNode,XmultraConfig.NEWS_PRE_PARSER_CLASS_ATTR);

        // Store a DOMPrinter reference.
        initMapHolder.setEntry(this, InitMapHolder.DOM_PRINTER,
            new DOMPrinter());

        // Get the name of the preParserConfig configuration file.
        preParserConfigStr = super.xmlParseUtils.getAttributeValueFromNode(
                aProcessorNode, XmultraConfig.NEWS_PRE_PARSER_CONFIG_DOC_ATTR);
        preParserConfigStr = fileUtils.addRoot(preParserConfigStr);
View Full Code Here

        // Make the DOC_TYPE tag.
        String docTypeTagWithRoot   = DOC_TYPE_TAG +
            fileUtils.addRoot(GetMessageConfig.GET_MESSAGE_DTD_FILE) + "\">";

        DOMPrinter domPrinter  = new DOMPrinter();

        String docStr = domPrinter.printToString(docElements,XML_DOC_HEAD,
                                                  docTypeTagWithRoot);

        String xmlDocStr = strings.substitute("&amp;((amp;)?#?\\w+;)",
                                               "&$1", docStr);
        /*String uniqueName = fileUtils.getUniqueFileName(
View Full Code Here

TOP

Related Classes of com.xmultra.util.DOMPrinter

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.