Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr
In directory sc8-pr-cvs1:/tmp/cvs-serv10187/com/sun/xacml/attr
Modified Files:
StringAttribute.java
Log Message:
changed to clarify the problem with XML Elements
Index: StringAttribute.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/StringAttribute.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** StringAttribute.java 29 Aug 2003 18:51:27 -0000 1.2
--- StringAttribute.java 7 Nov 2003 17:35:32 -0000 1.3
***************
*** 40,43 ****
--- 40,44 ----
import org.w3c.dom.Node;
+ import org.w3c.dom.NodeList;
***************
*** 46,49 ****
--- 47,57 ----
* xs:string values. All objects of this class are immutable and
* all methods of the class are thread-safe.
+ * <p>
+ * Note that there is currently some confusion in the XACML specification
+ * about whether this datatype should be able to handle XML elements (ie,
+ * whether <AttributeValue DataType="...string"><foo/>
+ * </AttributeValue> is valid). Until that is clarified the strict
+ * definition of the string datatype is used in this code, which means that
+ * elements are not valid.
*
* @author Marco Barreno
***************
*** 122,132 ****
public static StringAttribute getInstance(Node root) {
Node node = root.getFirstChild();
!
// Strings are allowed to have an empty AttributeValue element and are
// just treated as empty strings...we have to handle this case
if (node == null)
return new StringAttribute("");
! else
return getInstance(node.getNodeValue());
}
--- 130,152 ----
public static StringAttribute getInstance(Node root) {
Node node = root.getFirstChild();
!
// Strings are allowed to have an empty AttributeValue element and are
// just treated as empty strings...we have to handle this case
if (node == null)
return new StringAttribute("");
!
! // get the type of the node
! short type = node.getNodeType();
!
! // now see if we have (effectively) a simple string value
! if ((type == Node.TEXT_NODE) || (type == Node.CDATA_SECTION_NODE) ||
! (type == Node.COMMENT_NODE)) {
return getInstance(node.getNodeValue());
+ }
+
+ // there is some confusion in the specifications about what should
+ // happen at this point, but the strict reading of the XMLSchema
+ // specification suggests that this should be an error
+ return null;
}
|