当前位置: 首页>>代码示例>>Java>>正文


Java XMLUtils.getOwnerDocument方法代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.security.utils.XMLUtils.getOwnerDocument方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUtils.getOwnerDocument方法的具体用法?Java XMLUtils.getOwnerDocument怎么用?Java XMLUtils.getOwnerDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.xml.internal.security.utils.XMLUtils的用法示例。


在下文中一共展示了XMLUtils.getOwnerDocument方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHTMLRepresentation

import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
 * Method getHTMLRepresentation
 *
 * @return The HTML Representation.
 * @throws XMLSignatureException
 */
public String getHTMLRepresentation() throws XMLSignatureException {
    if ((this.xpathNodeSet == null) || (this.xpathNodeSet.size() == 0)) {
        return HTMLPrefix + "<blink>no node set, sorry</blink>" + HTMLSuffix;
    }

    // get only a single node as anchor to fetch the owner document
    Node n = this.xpathNodeSet.iterator().next();

    this.doc = XMLUtils.getOwnerDocument(n);

    try {
        this.writer = new StringWriter();

        this.canonicalizeXPathNodeSet(this.doc);
        this.writer.close();

        return this.writer.toString();
    } catch (IOException ex) {
        throw new XMLSignatureException("empty", ex);
    } finally {
        this.xpathNodeSet = null;
        this.doc = null;
        this.writer = null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:XMLSignatureInputDebugger.java

示例2: circumventBugIfNeeded

import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
protected void circumventBugIfNeeded(XMLSignatureInput input)
    throws CanonicalizationException, ParserConfigurationException,
           IOException, SAXException {
    if (!input.isNeedsToBeExpanded() || inclusiveNSSet.isEmpty() || inclusiveNSSet.isEmpty()) {
        return;
    }
    Document doc = null;
    if (input.getSubNode() != null) {
        doc = XMLUtils.getOwnerDocument(input.getSubNode());
    } else {
        doc = XMLUtils.getOwnerDocument(input.getNodeSet());
    }
    XMLUtils.circumventBug2650(doc);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Canonicalizer20010315Excl.java

示例3: circumventBugIfNeeded

import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
protected void circumventBugIfNeeded(XMLSignatureInput input)
    throws CanonicalizationException, ParserConfigurationException,
    IOException, SAXException {
    if (!input.isNeedsToBeExpanded()) {
        return;
    }
    Document doc = null;
    if (input.getSubNode() != null) {
        doc = XMLUtils.getOwnerDocument(input.getSubNode());
    } else {
        doc = XMLUtils.getOwnerDocument(input.getNodeSet());
    }
    XMLUtils.circumventBug2650(doc);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Canonicalizer11.java

示例4: circumventBugIfNeeded

import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
protected void circumventBugIfNeeded(XMLSignatureInput input)
    throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
    if (!input.isNeedsToBeExpanded()) {
        return;
    }
    Document doc = null;
    if (input.getSubNode() != null) {
        doc = XMLUtils.getOwnerDocument(input.getSubNode());
    } else {
        doc = XMLUtils.getOwnerDocument(input.getNodeSet());
    }
    XMLUtils.circumventBug2650(doc);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Canonicalizer20010315.java

示例5: execute

import com.sun.org.apache.xml.internal.security.utils.XMLUtils; //导入方法依赖的package包/类
/**
 * The here function returns a node-set containing the attribute or
 * processing instruction node or the parent element of the text node
 * that directly bears the XPath expression.  This expression results
 * in an error if the containing XPath expression does not appear in the
 * same XML document against which the XPath expression is being evaluated.
 *
 * @param xctxt
 * @return the xobject
 * @throws javax.xml.transform.TransformerException
 */
@Override
public XObject execute(XPathContext xctxt)
    throws javax.xml.transform.TransformerException {

    Node xpathOwnerNode = (Node) xctxt.getOwnerObject();

    if (xpathOwnerNode == null) {
        return null;
    }

    int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode);

    int currentNode = xctxt.getCurrentNode();
    DTM dtm = xctxt.getDTM(currentNode);
    int docContext = dtm.getDocument();

    if (DTM.NULL == docContext) {
        error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
    }

    {
        // check whether currentNode and the node containing the XPath expression
        // are in the same document
        Document currentDoc =
            XMLUtils.getOwnerDocument(dtm.getNode(currentNode));
        Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode);

        if (currentDoc != xpathOwnerDoc) {
            throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer"));
        }
    }

    XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
    NodeSetDTM nodeSet = nodes.mutableNodeset();

    {
        int hereNode = DTM.NULL;

        switch (dtm.getNodeType(xpathOwnerNodeDTM)) {

        case Node.ATTRIBUTE_NODE :
        case Node.PROCESSING_INSTRUCTION_NODE : {
            // returns a node-set containing the attribute /  processing instruction node
            hereNode = xpathOwnerNodeDTM;

            nodeSet.addNode(hereNode);

            break;
        }
        case Node.TEXT_NODE : {
            // returns a node-set containing the parent element of the
            // text node that directly bears the XPath expression
            hereNode = dtm.getParent(xpathOwnerNodeDTM);

            nodeSet.addNode(hereNode);

            break;
        }
        default :
            break;
        }
    }

    /** $todo$ Do I have to do this detach() call? */
    nodeSet.detach();

    return nodes;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:80,代码来源:FuncHere.java


注:本文中的com.sun.org.apache.xml.internal.security.utils.XMLUtils.getOwnerDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。