Exemple #1
0
		internal static Rhino.Xmlimpl.XmlNode NewElementWithText(XmlProcessor processor, Rhino.Xmlimpl.XmlNode reference, Rhino.Xmlimpl.XmlNode.QName qname, string value)
		{
			if (reference is XmlDocument)
			{
				throw new ArgumentException("Cannot use Document node as reference");
			}
			XmlDocument document = null;
			if (reference != null)
			{
				document = reference.dom.OwnerDocument;
			}
			else
			{
				document = processor.NewDocument();
			}
			System.Xml.XmlNode referenceDom = (reference != null) ? reference.dom : null;
			Rhino.Xmlimpl.XmlNode.Namespace ns = qname.GetNamespace();
			XmlElement e = (ns == null || ns.GetUri().Length == 0) ? document.CreateElementNS(null, qname.GetLocalName()) : document.CreateElementNS(ns.GetUri(), qname.Qualify(referenceDom));
			if (value != null)
			{
				e.AppendChild(document.CreateTextNode(value));
			}
			return Rhino.Xmlimpl.XmlNode.CreateImpl(e);
		}
Exemple #2
0
		internal bool MatchesElement(Rhino.Xmlimpl.XmlNode.QName qname)
		{
			if (this.Uri() == null || this.Uri().Equals(qname.GetNamespace().GetUri()))
			{
				if (this.LocalName().Equals("*") || this.LocalName().Equals(qname.GetLocalName()))
				{
					return true;
				}
			}
			return false;
		}