It's really easy in LINQ to XML: XNamespace ns = "sphinx"; XElement element = new XElement(ns + "docset") Or to make the "alias" work properly to make it look like your examples, something like this: XNamespace ns = "url/for/sphinx"; XElement element = new XElement("container", new XAttribute(XNamespace. Xmlns + "sphinx", ns), new XElement(ns + "docset", new XElement(ns + "schema"), new XElement(ns + "field", new XAttribute("name", "subject")), new XElement(ns + "field", new XAttribute("name", "content")), new XElement(ns + "attr", new XAttribute("name", "published"), new XAttribute("type", "timestamp")))) That produces: container xmlns:sphinx="http://url/for/sphinx.
It's really easy in LINQ to XML: XNamespace ns = "sphinx"; XElement element = new XElement(ns + "docset"); Or to make the "alias" work properly to make it look like your examples, something like this: XNamespace ns = "url/for/sphinx"; XElement element = new XElement("container", new XAttribute(XNamespace. Xmlns + "sphinx", ns), new XElement(ns + "docset", new XElement(ns + "schema"), new XElement(ns + "field", new XAttribute("name", "subject")), new XElement(ns + "field", new XAttribute("name", "content")), new XElement(ns + "attr", new XAttribute("name", "published"), new XAttribute("type", "timestamp")))); That produces.
Thank you, but for first version I got it is not what I want;))) – Edward83 Feb 13 at 18:37 @Edward83: See my other example. Basically you'll need the namespace to be specified in xmlns somewhere... – Jon Skeet Feb 13 at 18:38 thank you again! I'll try it now;) – Edward83 Feb 13 at 18:38.
You can read the namespace of your document and use it in queries like this: XDocument xml = XDocument. Load(address); XNamespace ns = xml.Root.Name. Namespace; foreach (XElement el in xml.
Descendants(ns + "whateverYourElementNameIs")) //do stuff.
Thank you! I'll try your version;) – Edward83 Feb 13 at 18:39.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.