1 17 package com.sun.org.apache.xml.internal.security.signature; 18 19 20 21 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException; 22 import com.sun.org.apache.xml.internal.security.utils.Constants; 23 import com.sun.org.apache.xml.internal.security.utils.IdResolver; 24 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; 25 import com.sun.org.apache.xml.internal.security.utils.XMLUtils; 26 import org.w3c.dom.Document ; 27 import org.w3c.dom.Element ; 28 29 30 39 public class SignatureProperties extends SignatureElementProxy { 40 41 42 static java.util.logging.Logger log = 43 java.util.logging.Logger.getLogger(SignatureProperties.class.getName()); 44 45 50 public SignatureProperties(Document doc) { 51 52 super(doc); 53 54 XMLUtils.addReturnToElement(this._constructionElement); 55 } 56 57 63 public SignatureProperties(Element element, String BaseURI) 64 throws XMLSecurityException { 65 super(element, BaseURI); 66 } 67 68 73 public int getLength() { 74 75 Element [] propertyElems = 76 XMLUtils.selectDsNodes(this._constructionElement, 77 Constants._TAG_SIGNATUREPROPERTY 78 ); 79 80 return propertyElems.length; 81 } 82 83 91 public SignatureProperty item(int i) throws XMLSignatureException { 92 try { 93 Element propertyElem = 94 XMLUtils.selectDsNode(this._constructionElement, 95 Constants._TAG_SIGNATUREPROPERTY, 96 i ); 97 98 if (propertyElem == null) { 99 return null; 100 } 101 return new SignatureProperty(propertyElem, this._baseURI); 102 } catch (XMLSecurityException ex) { 103 throw new XMLSignatureException("empty", ex); 104 } 105 } 106 107 112 public void setId(String Id) { 113 114 if ((this._state == MODE_SIGN) && (Id != null)) { 115 this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); 116 IdResolver.registerElementById(this._constructionElement, Id); 117 } 118 } 119 120 125 public String getId() { 126 return this._constructionElement.getAttributeNS(null, Constants._ATT_ID); 127 } 128 129 134 public void addSignatureProperty(SignatureProperty sp) { 135 this._constructionElement.appendChild(sp.getElement()); 136 XMLUtils.addReturnToElement(this._constructionElement); 137 } 138 139 140 public String getBaseLocalName() { 141 return Constants._TAG_SIGNATUREPROPERTIES; 142 } 143 } 144 | Popular Tags |