rdonkin 2003/03/18 14:30:43
Modified: betwixt/src/resources dotbetwixt.dtd
betwixt/src/java/org/apache/commons/betwixt/digester
ElementRule.java
Log:
Made name attribute mandatory and added test for attribute to rule.
Revision Changes Path
1.4 +2 -2 jakarta-commons/betwixt/src/resources/dotbetwixt.dtd
Index: dotbetwixt.dtd
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/src/resources/dotbetwixt.dtd,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dotbetwixt.dtd 18 Jan 2003 18:59:18 -0000 1.3
+++ dotbetwixt.dtd 18 Mar 2003 22:30:42 -0000 1.4
@@ -16,7 +16,7 @@
<!ELEMENT element (attribute|addDefaults|element)*>
<!ATTLIST element
- name CDATA #IMPLIED
+ name CDATA #REQUIRED
type CDATA #IMPLIED
uri CDATA #IMPLIED
value CDATA #IMPLIED
1.8 +6 -0
jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/ElementRule.java
Index: ElementRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/ElementRule.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElementRule.java 19 Jan 2003 23:25:52 -0000 1.7
+++ ElementRule.java 18 Mar 2003 22:30:43 -0000 1.8
@@ -99,9 +99,15 @@
* @param attributes The attribute list of this element
* @throws SAXException 1. If this tag's parent is not either an info or
element tag.
* 2. If the name attribute is not valid XML element name.
+ * 3. If the name attribute is not present
*/
public void begin(Attributes attributes) throws SAXException {
String name = attributes.getValue( "name" );
+
+ // check that the name attribute is present
+ if ( name == null || name.trim().equals( "" ) ) {
+ throw new SAXException("Name attribute is required.");
+ }
// check that name is well formed
if ( !XMLUtils.isWellFormedXMLName( name ) ) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]