anchor.diff:    group('entities', () {
       String decode(String input) => parse('<data>$input</data>').rootElement.text;
       String encodeText(String input) => new XmlText(input).toString();
  -    String encodeAttributeValue(String input) {
  -      var attribute = new XmlAttribute(new XmlName('a'), input, XmlAttributeType.DOUBLE_QUOTE).toString();
  +    String encodeAttributeValue(XmlAttributeType type, String input) {
  +      var attribute = new XmlAttribute(new XmlName('a'), input, type).toString();
  +      var quote = type == XmlAttributeType.SINGLE_QUOTE ? "'" : '"';
  +      expect(attribute.substring(0, 3), 'a=' + quote);
  +      expect(attribute[attribute.length - 1], quote);
         return attribute.substring(3, attribute.length - 1);
       }
       test('decode &#xHHHH;', () {
  
positive.code:       expect(node.toString(), "attr=''");
      });
      test('attribute (single, character references)', () {
        XmlDocument document = parse('<data ns:attr=\'&lt;&gt;&amp;&apos;&quot;\' />');
        XmlAttribute node = document.rootElement.attributes.single;
        expect(node.value, '<>&\'"');
        expect(node.toString(), "ns:attr='&lt;>&amp;&apos;\"'");
      });
      test('text', () {
        XmlDocument document = parse('<data>Am I or are the other crazy?</data>');
  
negative.code:       expect(encodeText('hello'), 'hello');
        expect(encodeText('<foo &amp;>'), '&lt;foo &amp;amp;>');
      });
      test('encode attribute (single quote)', () {
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, "'"), '&apos;');
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, '"'), '"');
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, '\t'), '&#x9;');
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, '\n'), '&#xA;');
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, '\r'), '&#xD;');
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, 'hello'), 'hello');
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, "'hello'"), '&apos;hello&apos;');
        expect(encodeAttributeValue(XmlAttributeType.SINGLE_QUOTE, '"hello"'), '"hello"');
      });
      test('encode attribute (double quote)', () {
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, "'"), "'");
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, '"'), '&quot;');
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, '\t'), '&#x9;');
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, '\n'), '&#xA;');
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, '\r'), '&#xD;');
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, 'hello'), 'hello');
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, "'hello'"), "'hello'");
        expect(encodeAttributeValue(XmlAttributeType.DOUBLE_QUOTE, '"hello"'), '&quot;hello&quot;');
      });
    });
    group('axis', () {
  