Examples of Attr


Examples of org.w3c.dom.Attr

        //     <attribute name='URI' type='anyURI' use='required'/>
        // </complexType>
        CipherReference newCipherReference(Element element) throws
                XMLEncryptionException {

      Attr URIAttr =
        element.getAttributeNodeNS(null, EncryptionConstants._ATT_URI);
      CipherReference result = new CipherReferenceImpl(URIAttr);

      // Find any Transforms
View Full Code Here

Examples of org.w3c.dom.Attr

         // Parse
         NodeList list = sec.getElementsByTagName("role");
         int l = list.getLength();
         for(int i = 0; i<l;i++) {
            Element role = (Element)list.item(i);
            Attr na = role.getAttributeNode("name");
            if (na == null)
               throw new SAXException("There must exist a name attribute of role");
            String n = na.getValue();
            boolean r = role.getAttributeNode("read") != null ? Boolean.valueOf( role.getAttributeNode("read").getValue() ).booleanValue() : false;
            boolean w = role.getAttributeNode("write") != null ? Boolean.valueOf( role.getAttributeNode("write").getValue() ).booleanValue() : false;
            boolean c = role.getAttributeNode("create") != null ? Boolean.valueOf( role.getAttributeNode("create").getValue() ).booleanValue() : false;
            addRole(n,r,w,c);
View Full Code Here

Examples of org.w3c.dom.Attr

         
          Iterator attrs = this.handleAttributesSubtree(currentElement,ns);
          if (attrs!=null) {
            //we output all Attrs which are available
            while (attrs.hasNext()) {
              Attr attr = (Attr) attrs.next();
              outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer);
            }
          }
          writer.write('>');       
          sibling= currentNode.getFirstChild();
          if (sibling==null) {
View Full Code Here

Examples of org.w3c.dom.Attr

     
      Iterator attrs = handleAttributes(currentElement,ns);
      if (attrs!=null) {
        //we output all Attrs which are available
        while (attrs.hasNext()) {
          Attr attr = (Attr) attrs.next();
          outputAttrToWriter(attr.getNodeName(),attr.getNodeValue(), writer);
        }
      }
      if (currentNodeIsVisible) {
        writer.write('>');
      }
View Full Code Here

Examples of org.w3c.dom.Attr

          continue;
        }
    NamedNodeMap attrs = ele.getAttributes();
       int attrsLength = attrs.getLength();
        for (int i = 0; i < attrsLength; i++) {
            Attr N = (Attr) attrs.item(i);
            if (!Constants.NamespaceSpecNS.equals(N.getNamespaceURI())) {
               //Not a namespace definition, ignore.
               continue;
            }

            String NName=N.getLocalName();
            String NValue=N.getNodeValue();
            if (XML.equals(NName)
                    && Constants.XML_LANG_SPACE_SpecNS.equals(NValue)) {
               continue;
            }           
            ns.addMapping(NName,NValue,N);            
        }        
       }
        Attr nsprefix;
        if (((nsprefix=ns.getMappingWithoutRendered("xmlns"))!=null)
                && "".equals(nsprefix.getValue())) {
             ns.addMappingAndRender("xmlns","",nullNode);
        }
     }
View Full Code Here

Examples of org.w3c.dom.Attr

      CipherReference cr = _cipherData.getCipherReference();

      // Need to wrap the uri in an Attribute node so that we can
      // Pass to the resource resolvers

      Attr uriAttr = cr.getURIAsAttr();
      XMLSignatureInput input = null;

      try {
        ResourceResolver resolver =
          ResourceResolver.getInstance(uriAttr, null);
View Full Code Here

Examples of org.w3c.dom.Attr

        }
    //The prefix visibly utilized(in the attribute or in the name) in the element
    SortedSet visiblyUtilized =(SortedSet) _inclusiveNSSet.clone();
         
    for (int i = 0; i < attrsLength; i++) {
      Attr N = (Attr) attrs.item(i);
      String NName=N.getLocalName();
      String NNodeValue=N.getNodeValue();
           
      if (!XMLNS_URI.equals(N.getNamespaceURI())) {
        //Not a namespace definition.
        //The Element is output element, add his prefix(if used) to visibyUtilized
        String prefix = N.getPrefix();
        if ( (prefix != null) && (!prefix.equals(XML) && !prefix.equals(XMLNS)) ) {
            visiblyUtilized.add(prefix);
        }         
        //Add to the result.
         result.add(N);       
        continue;
      }
 
      if (ns.addMapping(NName, NNodeValue,N)) {
        //New definition check if it is relative.
                if (C14nHelper.namespaceIsRelative(NNodeValue)) {
                    Object exArgs[] = {E.getTagName(), NName,
                            N.getNodeValue()};
                    throw new CanonicalizationException(
                            "c14n.Canonicalizer.RelativeNamespace", exArgs);
                }
            }
    }   
             
    if (E.getNamespaceURI() != null) {
      String prefix = E.getPrefix();
      if ((prefix == null) || (prefix.length() == 0)) {
        visiblyUtilized.add(XMLNS);
      } else {
        visiblyUtilized.add(prefix);
      }
    } else {
      visiblyUtilized.add(XMLNS);
    }
                 
    //This can be optimezed by I don't have time
    Iterator it=visiblyUtilized.iterator();
    while (it.hasNext()) {
      String s=(String)it.next();                 
      Attr key=ns.getMapping(s);
      if (key==null) {
        continue;
      }
      result.add(key);
    }
View Full Code Here

Examples of org.w3c.dom.Attr

    if (isOutputElement) {
      visiblyUtilized =  (Set) this._inclusiveNSSet.clone();
    }
   
    for (int i = 0; i < attrsLength; i++) {
      Attr N = (Attr) attrs.item(i);
      String NName=N.getLocalName();
      String NNodeValue=N.getNodeValue();
      if ( !isVisible(N) )  {
        //The node is not in the nodeset(if there is a nodeset)
        continue;
      }     
           
      if (!XMLNS_URI.equals(N.getNamespaceURI())) {
        //Not a namespace definition.
        if (isOutputElement) {
          //The Element is output element, add his prefix(if used) to visibyUtilized
          String prefix = N.getPrefix();
          if ((prefix != null) && (!prefix.equals(XML) && !prefix.equals(XMLNS)) ){
              visiblyUtilized.add(prefix);
          }         
          //Add to the result.
            result.add(N);
        }
        continue;
      }
           
     
      if (ns.addMapping(NName, NNodeValue,N)) {
                //New definiton check if it is relative
                if (C14nHelper.namespaceIsRelative(NNodeValue)) {
                    Object exArgs[] = {E.getTagName(), NName,
                            N.getNodeValue()};
                    throw new CanonicalizationException(
                            "c14n.Canonicalizer.RelativeNamespace", exArgs);
                }   
            }
    }

    if (isOutputElement) {                
           //The element is visible, handle the xmlns definition   
           Attr xmlns = E.getAttributeNodeNS(XMLNS_URI, XMLNS);
           if ((xmlns!=null) &&  (!isVisible(xmlns))) {
              //There is a definition but the xmlns is not selected by the xpath.
              //then xmlns=""
              ns.addMapping(XMLNS,"",nullNode);                              
            }

      if (E.getNamespaceURI() != null) {
        String prefix = E.getPrefix();
        if ((prefix == null) || (prefix.length() == 0)) {
          visiblyUtilized.add(XMLNS);
        } else {
          visiblyUtilized.add( prefix);
        }
      } else {
        visiblyUtilized.add(XMLNS);
      }                 
      //This can be optimezed by I don't have time
      //visiblyUtilized.addAll(this._inclusiveNSSet);
      Iterator it=visiblyUtilized.iterator();
      while (it.hasNext()) {
        String s=(String)it.next();                   
        Attr key=ns.getMapping(s);
        if (key==null) {
          continue;
        }
        result.add(key);
      }
    } else /*if (_circunvented)*/ {     
      Iterator it=this._inclusiveNSSet.iterator();
      while (it.hasNext()) {
        String s=(String)it.next();       
        Attr key=ns.getMappingWithoutRendered(s);
        if (key==null) {
          continue;
        }
        result.add(key);               
      }
View Full Code Here

Examples of org.w3c.dom.Attr

      result.clear();
      NamedNodeMap attrs = E.getAttributes();
      int attrsLength = attrs.getLength();     
           
      for (int i = 0; i < attrsLength; i++) {
         Attr N = (Attr) attrs.item(i);
         String NName=N.getLocalName();
         String NValue=N.getValue();
         String NUri =N.getNamespaceURI();

         if (!XMLNS_URI.equals(NUri)) {
           //It's not a namespace attr node. Add to the result and continue.
            result.add(N);
            continue;
         }
        
         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);
             }
          }       
      }
View Full Code Here

Examples of org.w3c.dom.Attr

               // for all ancestor elements
               NamedNodeMap ancestorAttrs = el.getAttributes();

               for (int i = 0; i < ancestorAttrs.getLength(); i++) {
                  // for all attributes in the ancestor element
                  Attr currentAncestorAttr = (Attr) ancestorAttrs.item(i);

                  if (XML_LANG_URI.equals(
                          currentAncestorAttr.getNamespaceURI())) {

                     // do we have an xml:* ?
                     if (!E.hasAttributeNS(
                             XML_LANG_URI,
                             currentAncestorAttr.getLocalName())) {

                        // the xml:* attr is not in E
                        if (!loa.containsKey(currentAncestorAttr.getName())) {
                           loa.put(currentAncestorAttr.getName(),
                                   currentAncestorAttr);
                        }
                     }
                  }
               }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.