當前位置: 首頁>>代碼示例>>Java>>正文


Java TransformerException.getMessage方法代碼示例

本文整理匯總了Java中javax.xml.transform.TransformerException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java TransformerException.getMessage方法的具體用法?Java TransformerException.getMessage怎麽用?Java TransformerException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.transform.TransformerException的用法示例。


在下文中一共展示了TransformerException.getMessage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadSource

import javax.xml.transform.TransformerException; //導入方法依賴的package包/類
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:28,代碼來源:TransformerFactoryImpl.java

示例2: writeXml

import javax.xml.transform.TransformerException; //導入方法依賴的package包/類
private static void writeXml(final Document doc, final File file) throws IOException {
    doc.normalize();

    final TransformerFactory transformerFactory = TransformerFactory.newInstance(XML_FACTORY, null);

    try {
        final Transformer transformer = transformerFactory.newTransformer();
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
        transformer.transform(new DOMSource(doc), new StreamResult(file));
    } catch (final TransformerException ex) {
        throw new IOException(ex.getMessage(), ex);
    }
}
 
開發者ID:minijax,項目名稱:minijax,代碼行數:17,代碼來源:LiquibaseHelper.java

示例3: outputXML

import javax.xml.transform.TransformerException; //導入方法依賴的package包/類
private static String outputXML(Document doc) throws CteException {


        try {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer trans = tf.newTransformer();
            trans.transform(new DOMSource(doc), new StreamResult(os));
            String xml = os.toString();
            xml = xml.replaceAll("\\r\\n", "");
            xml = xml.replaceAll(" standalone=\"no\"", "");
            return xml;
        } catch (TransformerException e) {
            throw new CteException("Erro ao Transformar Documento:" + e.getMessage());
        }

    }
 
開發者ID:Samuel-Oliveira,項目名稱:Java_CTe,代碼行數:18,代碼來源:Assinatura.java

示例4: getBooleanValue

import javax.xml.transform.TransformerException; //導入方法依賴的package包/類
/**
         * @see org.w3c.dom.xpath.XPathResult#getBooleanValue()
         */
        public boolean getBooleanValue() throws XPathException {
                if (getResultType() != BOOLEAN_TYPE) {
                        String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_BOOLEAN, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
                        throw new XPathException(XPathException.TYPE_ERR,fmsg);
//              "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a boolean."
                } else {
                        try {
                           return m_resultObj.bool();
                        } catch (TransformerException e) {
                                // Type check above should prevent this exception from occurring.
                                throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
                        }
                }
        }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:XPathResultImpl.java

示例5: getSingleNodeValue

import javax.xml.transform.TransformerException; //導入方法依賴的package包/類
/**
         * The value of this single node result, which may be <code>null</code>.
     * @exception XPathException
     *   TYPE_ERR: raised if <code>resultType</code> is not
     *   <code>ANY_UNORDERED_NODE_TYPE</code> or
     *   <code>FIRST_ORDERED_NODE_TYPE</code>.
     *
         * @see org.w3c.dom.xpath.XPathResult#getSingleNodeValue()
         */
        public Node getSingleNodeValue() throws XPathException {

                if ((m_resultType != ANY_UNORDERED_NODE_TYPE) &&
                    (m_resultType != FIRST_ORDERED_NODE_TYPE)) {
                                String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_SINGLENODE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
                                throw new XPathException(XPathException.TYPE_ERR,fmsg);
//                              "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a single node.
//                               This method applies only to types ANY_UNORDERED_NODE_TYPE and FIRST_ORDERED_NODE_TYPE."
            }

                NodeIterator result = null;
                try {
                        result = m_resultObj.nodeset();
                } catch (TransformerException te) {
                        throw new XPathException(XPathException.TYPE_ERR,te.getMessage());
                }

        if (null == result) return null;

        Node node = result.nextNode();

        // Wrap "namespace node" in an XPathNamespace
        if (isNamespaceNode(node)) {
            return new XPathNamespaceImpl(node);
        } else {
            return node;
        }
        }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:38,代碼來源:XPathResultImpl.java


注:本文中的javax.xml.transform.TransformerException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。