void ParseExtensions(XmlElement xcard, XmlNamespaceManager nsm, vCard vcard) { nsm.AddNamespace("ex", "http://here.net"); XmlNode xwhy = xcard.SelectSingleNode("ex:why/text()", nsm); if (xwhy != null) { vcard.AddExtendedProperty("why", "http://here.net", new vCardTextProperty(xwhy.Value)); } }
public void CanAddExtendedUriProperty() { vCard v = new vCard(); v.AddExtendedProperty("where", "http://here.net", new vCardUriProperty("ldap://somefellow")); vCardUriProperty p = v.GetExtendedProperty("where", "http://here.net") as vCardUriProperty; Assert.IsNotNull(p); Assert.AreEqual("ldap://somefellow", p.ToString()); Assert.AreEqual("ldap://somefellow", p.Uri); }
public void CanAddExtendedTextProperty() { vCard v = new vCard(); v.AddExtendedProperty("why", "http://because.net", new vCardTextProperty("It is red")); vCardTextProperty p = v.GetExtendedProperty("why", "http://because.net") as vCardTextProperty; Assert.IsNotNull(p); Assert.AreEqual("It is red", p.ToString()); Assert.AreEqual("It is red", p.Text); }
public void CanWritevCardWithExtendedProperties() { vCard v = new vCard(); v.Fn.Items.Add(new vCardMultiString("John Doe")); v.AddExtendedProperty("where", "http://here.net", new vCardUriProperty("ldap://somefellow")); v.AddExtendedProperty("why", "http://because.net", new vCardTextProperty("It is red")); VerifyOutput(v, @"<?xml version=""1.0"" encoding=""utf-8""?> <vcards xmlns=""urn:ietf:params:xml:ns:vcard-4.0""> <vcard> <fn> <text>John Doe</text> </fn> <ex:where xmlns:ex=""http://here.net""> <ex:uri>ldap://somefellow</ex:uri> </ex:where> <ex:why xmlns:ex=""http://because.net""> <ex:text>It is red</ex:text> </ex:why> </vcard> </vcards>"); }