PageRenderTime 89ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/GPX.Server.Extension/GeoRSSClient/DocumentExtensions.cs

https://bitbucket.org/shope/dfu
C# | 31 lines | 29 code | 2 blank | 0 comment | 0 complexity | 41ec93c82316058eb6e3c2cb41f7182a MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Xml;
  6. using System.Xml.Linq;
  7. namespace GeoRSSClient
  8. {
  9. public static class DocumentExtensions
  10. {
  11. public static XmlDocument ToXmlDocument(this XDocument xDocument)
  12. {
  13. var xmlDocument = new XmlDocument();
  14. using (var xmlReader = xDocument.CreateReader())
  15. {
  16. xmlDocument.Load(xmlReader);
  17. }
  18. return xmlDocument;
  19. }
  20. public static XDocument ToXDocument(this XmlDocument xmlDocument)
  21. {
  22. using (var nodeReader = new XmlNodeReader(xmlDocument))
  23. {
  24. nodeReader.MoveToContent();
  25. return XDocument.Load(nodeReader);
  26. }
  27. }
  28. }
  29. }