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


Java C14nHelper.namespaceIsRelative方法代码示例

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


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

示例1: handleAttributesSubtree

import com.sun.org.apache.xml.internal.security.c14n.helper.C14nHelper; //导入方法依赖的package包/类
/**
 * Returns the Attr[]s to be output for the given element.
 * <br>
 * The code of this method is a copy of {@link #handleAttributes(Element,
 * NameSpaceSymbTable)},
 * whereas it takes into account that subtree-c14n is -- well --
 * subtree-based.
 * So if the element in question isRoot of c14n, it's parent is not in the
 * node set, as well as all other ancestors.
 *
 * @param element
 * @param ns
 * @return the Attr[]s to be output
 * @throws CanonicalizationException
 */
@Override
protected Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
    throws CanonicalizationException {
    if (!element.hasAttributes() && !firstCall) {
        return null;
    }
    // result will contain the attrs which have to be output
    final SortedSet<Attr> result = this.result;
    result.clear();

    if (element.hasAttributes()) {
        NamedNodeMap attrs = element.getAttributes();
        int attrsLength = attrs.getLength();

        for (int i = 0; i < attrsLength; i++) {
            Attr attribute = (Attr) attrs.item(i);
            String NUri = attribute.getNamespaceURI();
            String NName = attribute.getLocalName();
            String NValue = attribute.getValue();

            if (!XMLNS_URI.equals(NUri)) {
                // It's not a namespace attr node. Add to the result and continue.
                result.add(attribute);
            } else if (!(XML.equals(NName) && XML_LANG_URI.equals(NValue))) {
                // The default mapping for xml must not be output.
                Node n = ns.addMappingAndRender(NName, NValue, attribute);

                if (n != null) {
                    // Render the ns definition
                    result.add((Attr)n);
                    if (C14nHelper.namespaceIsRelative(attribute)) {
                        Object exArgs[] = {element.getTagName(), NName, attribute.getNodeValue()};
                        throw new CanonicalizationException(
                            "c14n.Canonicalizer.RelativeNamespace", exArgs
                        );
                    }
                }
            }
        }
    }

    if (firstCall) {
        // It is the first node of the subtree
        // Obtain all the namespaces defined in the parents, and added to the output.
        ns.getUnrenderedNodes(result);
        // output the attributes in the xml namespace.
        xmlattrStack.getXmlnsAttr(result);
        firstCall = false;
    }

    return result.iterator();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:68,代码来源:Canonicalizer11.java

示例2: handleAttributesSubtree

import com.sun.org.apache.xml.internal.security.c14n.helper.C14nHelper; //导入方法依赖的package包/类
/**
 * Returns the Attr[]s to be output for the given element.
 * <br>
 * The code of this method is a copy of {@link #handleAttributes(Element,
 * NameSpaceSymbTable)},
 * whereas it takes into account that subtree-c14n is -- well -- subtree-based.
 * So if the element in question isRoot of c14n, it's parent is not in the
 * node set, as well as all other ancestors.
 *
 * @param element
 * @param ns
 * @return the Attr[]s to be output
 * @throws CanonicalizationException
 */
@Override
protected Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
    throws CanonicalizationException {
    if (!element.hasAttributes() && !firstCall) {
        return null;
    }
    // result will contain the attrs which have to be output
    final SortedSet<Attr> result = this.result;
    result.clear();

    if (element.hasAttributes()) {
        NamedNodeMap attrs = element.getAttributes();
        int attrsLength = attrs.getLength();

        for (int i = 0; i < attrsLength; i++) {
            Attr attribute = (Attr) attrs.item(i);
            String NUri = attribute.getNamespaceURI();
            String NName = attribute.getLocalName();
            String NValue = attribute.getValue();

            if (!XMLNS_URI.equals(NUri)) {
                //It's not a namespace attr node. Add to the result and continue.
                result.add(attribute);
            } else if (!(XML.equals(NName) && XML_LANG_URI.equals(NValue))) {
                //The default mapping for xml must not be output.
                Node n = ns.addMappingAndRender(NName, NValue, attribute);

                if (n != null) {
                    //Render the ns definition
                    result.add((Attr)n);
                    if (C14nHelper.namespaceIsRelative(attribute)) {
                        Object exArgs[] = { element.getTagName(), NName, attribute.getNodeValue() };
                        throw new CanonicalizationException(
                            "c14n.Canonicalizer.RelativeNamespace", exArgs
                        );
                    }
                }
            }
        }
    }

    if (firstCall) {
        //It is the first node of the subtree
        //Obtain all the namespaces defined in the parents, and added to the output.
        ns.getUnrenderedNodes(result);
        //output the attributes in the xml namespace.
        xmlattrStack.getXmlnsAttr(result);
        firstCall = false;
    }

    return result.iterator();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:67,代码来源:Canonicalizer20010315.java

示例3: handleAttributesSubtree

import com.sun.org.apache.xml.internal.security.c14n.helper.C14nHelper; //导入方法依赖的package包/类
/**
 * Returns the Attr[]s to be outputted for the given element.
 * <br>
 * The code of this method is a copy of {@link #handleAttributes(Element,
 * NameSpaceSymbTable)},
 * whereas it takes into account that subtree-c14n is -- well --
 * subtree-based.
 * So if the element in question isRoot of c14n, it's parent is not in the
 * node set, as well as all other ancestors.
 *
 * @param E
 * @param ns
 * @return the Attr[]s to be outputted
 * @throws CanonicalizationException
 */
Iterator handleAttributesSubtree(Element E, NameSpaceSymbTable ns)
    throws CanonicalizationException {
    if (!E.hasAttributes() && !firstCall) {
        return null;
    }
    // result will contain the attrs which have to be outputted
    final SortedSet result = this.result;
    result.clear();
    NamedNodeMap attrs = E.getAttributes();
    int attrsLength = attrs.getLength();

    for (int i = 0; i < attrsLength; i++) {
        Attr N = (Attr) attrs.item(i);
        String NUri = N.getNamespaceURI();

        if (XMLNS_URI != NUri) {
            // It's not a namespace attr node. Add to the result and
            // continue.
            result.add(N);
            continue;
        }

        String NName = N.getLocalName();
        String NValue = N.getValue();
        if (XML.equals(NName)
            && XML_LANG_URI.equals(NValue)) {
            // The default mapping for xml must not be output.
            continue;
        }

        Node n = ns.addMappingAndRender(NName, NValue, N);

        if (n != null) {
            // Render the ns definition
            result.add(n);
            if (C14nHelper.namespaceIsRelative(N)) {
                Object exArgs[] = {E.getTagName(), NName, N.getNodeValue()};
                throw new CanonicalizationException(
                    "c14n.Canonicalizer.RelativeNamespace", exArgs);
            }
        }
    }

    if (firstCall) {
        // It is the first node of the subtree
        // Obtain all the namespaces defined in the parents, and added
        // to the output.
        ns.getUnrenderedNodes(result);
        // output the attributes in the xml namespace.
        xmlattrStack.getXmlnsAttr(result);
        firstCall = false;
    }

    return result.iterator();
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:71,代码来源:Canonicalizer11.java

示例4: handleAttributesSubtree

import com.sun.org.apache.xml.internal.security.c14n.helper.C14nHelper; //导入方法依赖的package包/类
/**
 * Returns the Attr[]s to be outputted for the given element.
 * <br>
 * The code of this method is a copy of {@link #handleAttributes(Element,
 * NameSpaceSymbTable)},
 * whereas it takes into account that subtree-c14n is -- well -- subtree-based.
 * So if the element in question isRoot of c14n, it's parent is not in the
 * node set, as well as all other ancestors.
 *
 * @param E
 * @param ns
 * @return the Attr[]s to be outputted
 * @throws CanonicalizationException
 */
Iterator handleAttributesSubtree(Element E,  NameSpaceSymbTable ns )
        throws CanonicalizationException {
       if (!E.hasAttributes() && !firstCall) {
      return null;
   }
   // result will contain the attrs which have to be outputted
   final SortedSet result = this.result;
   result.clear();
   NamedNodeMap attrs = E.getAttributes();
   int attrsLength = attrs.getLength();

   for (int i = 0; i < attrsLength; i++) {
      Attr N = (Attr) attrs.item(i);
      String NUri =N.getNamespaceURI();

      if (XMLNS_URI!=NUri) {
             //It's not a namespace attr node. Add to the result and continue.
         result.add(N);
         continue;
      }

      String NName=N.getLocalName();
      String NValue=N.getValue();
      if (XML.equals(NName)
              && XML_LANG_URI.equals(NValue)) {
             //The default mapping for xml must not be output.
             continue;
      }

      Node n=ns.addMappingAndRender(NName,NValue,N);

       if (n!=null) {
              //Render the ns definition
          result.add(n);
          if (C14nHelper.namespaceIsRelative(N)) {
             Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() };
             throw new CanonicalizationException(
                "c14n.Canonicalizer.RelativeNamespace", exArgs);
          }
       }
   }

   if (firstCall) {
     //It is the first node of the subtree
     //Obtain all the namespaces defined in the parents, and added to the output.
     ns.getUnrenderedNodes(result);
     //output the attributes in the xml namespace.
     xmlattrStack.getXmlnsAttr(result);
             firstCall=false;
   }

   return result.iterator();
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:68,代码来源:Canonicalizer20010315.java


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