KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > crypto > dom > DOMStructure


1 /*
2  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3  */

4 /*
5  * $Id: DOMStructure.java,v 1.6 2005/05/09 18:33:26 mullan Exp $
6  */

7 package javax.xml.crypto.dom;
8
9 import org.w3c.dom.Node JavaDoc;
10 import javax.xml.crypto.XMLStructure;
11 import javax.xml.crypto.dsig.XMLSignature;
12
13 /**
14  * A DOM-specific {@link XMLStructure}. The purpose of this class is to
15  * allow a DOM node to be used to represent extensible content (any elements
16  * or mixed content) in XML Signature structures.
17  *
18  * <p>If a sequence of nodes is needed, the node contained in the
19  * <code>DOMStructure</code> is the first node of the sequence and successive
20  * nodes can be accessed by invoking {@link Node#getNextSibling}.
21  *
22  * <p>If the owner document of the <code>DOMStructure</code> is different than
23  * the target document of an <code>XMLSignature</code>, the
24  * {@link XMLSignature#sign(XMLSignContext)} method imports the node into the
25  * target document before generating the signature.
26  *
27  * @author Sean Mullan
28  * @author JSR 105 Expert Group
29  * @since 1.6
30  */

31 public class DOMStructure implements XMLStructure {
32
33     private final Node JavaDoc node;
34
35     /**
36      * Creates a <code>DOMStructure</code> containing the specified node.
37      *
38      * @param node the node
39      * @throws NullPointerException if <code>node</code> is <code>null</code>
40      */

41     public DOMStructure(Node JavaDoc node) {
42         if (node == null) {
43         throw new NullPointerException JavaDoc("node cannot be null");
44     }
45     this.node = node;
46     }
47
48     /**
49      * Returns the node contained in this <code>DOMStructure</code>.
50      *
51      * @return the node
52      */

53     public Node JavaDoc getNode() {
54     return node;
55     }
56
57     /**
58      * @throws NullPointerException {@inheritDoc}
59      */

60     public boolean isFeatureSupported(String JavaDoc feature) {
61         if (feature == null) {
62             throw new NullPointerException JavaDoc();
63         } else {
64             return false;
65         }
66     }
67 }
68
Popular Tags