IsAttributeName() private method

private IsAttributeName ( ) : bool
return bool
コード例 #1
0
ファイル: XMLList.cs プロジェクト: hazzik/Rhino.Net
		private Rhino.Xmlimpl.XMLList GetPropertyList(XMLName name)
		{
			Rhino.Xmlimpl.XMLList propertyList = NewXMLList();
			Rhino.Xmlimpl.XmlNode.QName qname = null;
			if (!name.IsDescendants() && !name.IsAttributeName())
			{
				// Only set the targetProperty if this is a regular child get
				// and not a descendant or attribute get
				qname = name.ToQname();
			}
			propertyList.SetTargets(this, qname);
			for (int i = 0; i < Length(); i++)
			{
				propertyList.AddToList(GetXmlFromAnnotation(i).GetPropertyList(name));
			}
			return propertyList;
		}
コード例 #2
0
ファイル: XMLList.cs プロジェクト: hazzik/Rhino.Net
		internal override void PutXMLProperty(XMLName xmlName, object value)
		{
			//Log("put property: " + name);
			// Special-case checks for undefined and null
			if (value == null)
			{
				value = "null";
			}
			else
			{
				if (value is Undefined)
				{
					value = "undefined";
				}
			}
			if (Length() > 1)
			{
				throw ScriptRuntime.TypeError("Assignment to lists with more than one item is not supported");
			}
			else
			{
				if (Length() == 0)
				{
					// Secret sauce for super-expandos.
					// We set an element here, and then add ourselves to our target.
					if (targetObject != null && targetProperty != null && targetProperty.GetLocalName() != null && targetProperty.GetLocalName().Length > 0)
					{
						// Add an empty element with our targetProperty name and
						// then set it.
						XML xmlValue = NewTextElementXML(null, targetProperty, null);
						AddToList(xmlValue);
						if (xmlName.IsAttributeName())
						{
							SetAttribute(xmlName, value);
						}
						else
						{
							XML xml = Item(0);
							xml.PutXMLProperty(xmlName, value);
							// Update the list with the new item at location 0.
							Replace(0, Item(0));
						}
						// Now add us to our parent
						XMLName name2 = XMLName.FormProperty(targetProperty.GetNamespace().GetUri(), targetProperty.GetLocalName());
						targetObject.PutXMLProperty(name2, this);
						Replace(0, targetObject.GetXML().GetLastXmlChild());
					}
					else
					{
						throw ScriptRuntime.TypeError("Assignment to empty XMLList without targets not supported");
					}
				}
				else
				{
					if (xmlName.IsAttributeName())
					{
						SetAttribute(xmlName, value);
					}
					else
					{
						XML xml = Item(0);
						xml.PutXMLProperty(xmlName, value);
						// Update the list with the new item at location 0.
						Replace(0, Item(0));
					}
				}
			}
		}