Two namespaces : Namespace « XML LINQ « C# / C Sharp

Two namespaces


using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;

public class MainClass{
   public static void Main(){
        XNamespace aw = "";
        XNamespace fc = "";
        XElement root = new XElement(aw + "Root",
            new XAttribute("xmlns", ""),
            new XAttribute(XNamespace.Xmlns + "fc", ""),
            new XElement(fc + "Child",
                new XElement(aw + "DifferentChild", "other content")
            new XElement(aw + "Child2", "c2 content"),
            new XElement(fc + "Child3", "c3 content")


Related examples in the same category

1.XElement with namespace
2.Create XElement with namespace
3.Attribute with namespace
4.Query Attributes with namespace
5.Query attributes with namespace
6.XElement.GetDefaultNamespace gets the default XNamespace of this XElement.
7.XElement.GetNamespaceOfPrefix gets the namespace associated with a particular prefix for this XElement.
8.XElement.GetPrefixOfNamespace gets the prefix associated with a namespace for this XElement.