1 /**
  2  * @fileoverview A class representing the attribute node of the
  3  * XDM interface.
  4  */
  5 
  6 goog.provide('xrx.node.Attribute');
  7 
  8 
  9 
 10 goog.require('xrx.node');
 11 goog.require('xrx.token');
 12 goog.require('xrx.xpath.NodeSet');
 13 
 14 
 15 
 16 /** 
 17  * @constructor 
 18  */
 19 xrx.node.Attribute = function(pilot, token, parent, instance) {
 20   goog.base(this, pilot, xrx.node.ATTRIBUTE, token, instance);
 21   this.parent_ = parent;
 22 };
 23 goog.inherits(xrx.node.Attribute, xrx.node);
 24 
 25 xrx.node.Attribute.prototype.accAttributes = function() {};
 26 xrx.node.Attribute.prototype.accBaseUri = function() {};
 27 xrx.node.Attribute.prototype.accChildren = function() {};
 28 xrx.node.Attribute.prototype.accDocumentUri = function() {};
 29 xrx.node.Attribute.prototype.accIsId = function() {};
 30 xrx.node.Attribute.prototype.accIsIdrefs = function() {};
 31 xrx.node.Attribute.prototype.accNamespaceNodes = function() {};
 32 xrx.node.Attribute.prototype.accNilled = function() {};
 33 xrx.node.Attribute.prototype.accNodeKind = function() {};
 34 xrx.node.Attribute.prototype.accNodeName = function() {};
 35 xrx.node.Attribute.prototype.accParent = function() {};
 36 xrx.node.Attribute.prototype.accStringValue = function() {};
 37 xrx.node.Attribute.prototype.accTypeName = function() {};
 38 xrx.node.Attribute.prototype.accTypedValue = function() {};
 39 xrx.node.Attribute.prototype.accUnparsedEntityPublicId = function() {};
 40 xrx.node.Attribute.prototype.accUnparsedEntitySystemId = function() {};
 41 
 42 
 43 
 44 /**
 45  * @override
 46  */
 47 xrx.node.Attribute.prototype.getChildNodes = function() {
 48   return new xrx.xpath.NodeSet();
 49 };
 50 
 51 
 52 
 53 /**
 54  * @override
 55  */
 56 xrx.node.Attribute.prototype.getDescendantNodes = function() {
 57   return new xrx.xpath.NodeSet();
 58 };
 59 
 60 
 61 
 62 /**
 63  * @override
 64  */
 65 xrx.node.Attribute.prototype.getFollowingSiblingNodes = function() {
 66   return new xrx.xpath.NodeSet();
 67 };
 68 
 69 
 70 
 71 /**
 72  * @override
 73  */
 74 xrx.node.Attribute.prototype.getFollowingNodes = function() {
 75   return new xrx.xpath.NodeSet();
 76 };
 77 
 78 
 79 
 80 /**
 81  * @override
 82  */
 83 xrx.node.Attribute.prototype.getAttributeNodes = function() {
 84   return new xrx.xpath.NodeSet();
 85 };
 86 
 87 
 88 
 89 /**
 90  * @override
 91  */
 92 xrx.node.Attribute.prototype.getParentNodes = function(test) {
 93   var nodeset = new xrx.xpath.NodeSet();
 94   if (test.matches(this.parent_)) nodeset.add(this.parent_); 
 95 
 96   return nodeset;
 97 };
 98 
 99 
100 
101 /**
102  * @override
103  */
104 xrx.node.Attribute.prototype.expandedName = function() {
105   var stream = this.pilot_.stream();
106   var attrName = new xrx.token.AttrName(this.label().clone());
107   var parentXml = this.parent_.token().xml(this.pilot_.xml());
108   var location = stream.attrName(parentXml, 
109       attrName.label().last(), this.offset());
110   
111   return '' + location.xml(parentXml);
112 };
113 
114 
115 
116 /**
117  * @override
118  */
119 xrx.node.Attribute.prototype.stringValue = function() {
120   var stream = this.pilot_.stream();
121   var attrValue = new xrx.token.AttrValue(this.label().clone());
122   var parentXml = this.parent_.token().xml(this.pilot_.xml());
123   var location = stream.attrValue(parentXml, attrValue.label().last(), 
124       this.offset());
125   
126   return location.xml(parentXml);
127 };
128 
129 
130 
131 /**
132  * @override
133  */
134 xrx.node.Attribute.prototype.namespaceUri = function() {
135   return undefined;
136 };