src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java

Print this page




 121             } else if (localName.equals("KeyName")) {
 122                 content.add(new DOMKeyName(childElem));
 123             } else if (localName.equals("KeyValue")) {
 124                 content.add(DOMKeyValue.unmarshal(childElem));
 125             } else if (localName.equals("RetrievalMethod")) {
 126                 content.add(new DOMRetrievalMethod(childElem,
 127                                                    context, provider));
 128             } else if (localName.equals("PGPData")) {
 129                 content.add(new DOMPGPData(childElem));
 130             } else { //may be MgmtData, SPKIData or element from other namespace
 131                 content.add(new javax.xml.crypto.dom.DOMStructure((childElem)));
 132             }
 133         }
 134         keyInfoTypes = Collections.unmodifiableList(content);
 135     }
 136 
 137     public String getId() {
 138         return id;
 139     }
 140 
 141     public List getContent() {
 142         return keyInfoTypes;
 143     }
 144 
 145     public void marshal(XMLStructure parent, XMLCryptoContext context)
 146         throws MarshalException
 147     {
 148         if (parent == null) {
 149             throw new NullPointerException("parent is null");
 150         }
 151         if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
 152             throw new ClassCastException("parent must be of type DOMStructure");
 153         }
 154 
 155         Node pNode = ((javax.xml.crypto.dom.DOMStructure)parent).getNode();
 156         String dsPrefix = DOMUtils.getSignaturePrefix(context);
 157         Element kiElem = DOMUtils.createElement
 158             (DOMUtils.getOwnerDocument(pNode), "KeyInfo",
 159              XMLSignature.XMLNS, dsPrefix);
 160         if (dsPrefix == null || dsPrefix.length() == 0) {
 161             kiElem.setAttributeNS("http://www.w3.org/2000/xmlns/",




 121             } else if (localName.equals("KeyName")) {
 122                 content.add(new DOMKeyName(childElem));
 123             } else if (localName.equals("KeyValue")) {
 124                 content.add(DOMKeyValue.unmarshal(childElem));
 125             } else if (localName.equals("RetrievalMethod")) {
 126                 content.add(new DOMRetrievalMethod(childElem,
 127                                                    context, provider));
 128             } else if (localName.equals("PGPData")) {
 129                 content.add(new DOMPGPData(childElem));
 130             } else { //may be MgmtData, SPKIData or element from other namespace
 131                 content.add(new javax.xml.crypto.dom.DOMStructure((childElem)));
 132             }
 133         }
 134         keyInfoTypes = Collections.unmodifiableList(content);
 135     }
 136 
 137     public String getId() {
 138         return id;
 139     }
 140 
 141     public List<XMLStructure> getContent() {
 142         return keyInfoTypes;
 143     }
 144 
 145     public void marshal(XMLStructure parent, XMLCryptoContext context)
 146         throws MarshalException
 147     {
 148         if (parent == null) {
 149             throw new NullPointerException("parent is null");
 150         }
 151         if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
 152             throw new ClassCastException("parent must be of type DOMStructure");
 153         }
 154 
 155         Node pNode = ((javax.xml.crypto.dom.DOMStructure)parent).getNode();
 156         String dsPrefix = DOMUtils.getSignaturePrefix(context);
 157         Element kiElem = DOMUtils.createElement
 158             (DOMUtils.getOwnerDocument(pNode), "KeyInfo",
 159              XMLSignature.XMLNS, dsPrefix);
 160         if (dsPrefix == null || dsPrefix.length() == 0) {
 161             kiElem.setAttributeNS("http://www.w3.org/2000/xmlns/",