public string ToXml()
{
var xdoc = new XDocument(
new XDeclaration("1.0", "UTF-8", null),
new XElement("caps",
new XElement("searching",
new XElement("search",
new XAttribute("available", SearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", "q")
),
new XElement("tv-search",
new XAttribute("available", TVSearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", SupportedTVSearchParams)
)
),
new XElement("categories",
from c in Categories
select new XElement("category",
new XAttribute("id", c.ID),
new XAttribute("name", c.Name),
from sc in c.SubCategories
select new XElement("subcat",
new XAttribute("id", sc.ID),
new XAttribute("name", sc.Name)
)
)
)
)
);
return xdoc.Declaration.ToString() + Environment.NewLine + xdoc.ToString();
}
}