public void FindElementByNameAttribute_Should_Succeed(XpsName name) { var document = XDocument.Parse(XElementExtensionsTests.DefaultXmlContent); var root = document.Root; var result = root.FindElementByNameAttribute(name); Assert.IsNotNull(result); }
public void Get(string expandedName, XNamespace @namespace, string localName) { var xpsName = XpsName.Get(expandedName); Assert.AreEqual(@namespace, xpsName.Namespace); Assert.AreEqual(localName, xpsName.LocalName); }
public static XElement FindElementByNameAttribute([NotNull] this XElement element, [NotNull] XpsName name) { if (element == null) { throw new ArgumentNullException(nameof(element)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } var prefix = element.GetPrefixOfNamespace(name.Namespace); var result = element.FindElementByNameAttribute(name.ToString(prefix)); return(result); }
public static XpsName GetXpsName([NotNull] this XNamespace @namespace, [NotNull] string localName) { if (@namespace == null) { throw new ArgumentNullException(nameof(@namespace)); } if (localName == null) { throw new ArgumentNullException(nameof(localName)); } var result = new XpsName(@namespace, localName); return(result); }