package com.thaiopensource.relaxng;

import org.relaxng.datatype.ValidationContext;

import org.xml.sax.SAXException;

class AttributeAtom extends Atom {
  String namespaceURI;
  String localName;
  StringAtom value;

  AttributeAtom(String namespaceURI, String localName, String value, ValidationContext vc) {
    this.namespaceURI = namespaceURI;
    this.localName = localName;
    this.value = value == null ? null : new StringAtom(value, vc);
  }
  boolean matchesAttribute(PatternBuilder b, NameClass nc, Pattern valuePattern) {
    return (nc.contains(namespaceURI, localName)
	    && (value == null
		|| valuePattern.residual(b, value).isNullable()));
  }
  boolean isAttribute() {
    return true;
  }
}

@@ -536,16 +536,13 @@
     
-return
+if
  (
+!
 nc.c
@@ -577,36 +577,155 @@
 ame)
+)
 %0A
-%09
     
-&& (value == null%0A%09%09%7C%7C
+  return false;%0A    if (value == null)%0A      return true;%0A    if (value.isEmpty() && valuePattern.isNullable())%0A      return true;%0A    return
  val
@@ -765,18 +765,16 @@
 llable()
-))
 ;%0A  %7D%0A  

Allow an empty attribute value to match <empty/>.