Guest User

Untitled

a guest
Aug 23rd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <nsiOrganization>
  2. <oos:regNumber></oos:regNumber>
  3. <oos:shortName></oos:shortName>
  4. <oos:fullName></oos:fullName>
  5. <oos:factualAddress>
  6. <oos:OKATO></oos:OKATO>
  7. <oos:addressLine></oos:addressLine>
  8. <oos:building></oos:building>
  9. <oos:country>
  10. <oos:countryCode></oos:countryCode>
  11. <oos:countryFullName></oos:countryFullName>
  12. </oos:country>
  13. ...
  14. ...
  15. ...
  16. ...
  17. ...
  18. </nsiOrganization>
  19. <nsiOrganization>
  20. ...
  21. ...
  22. ...
  23. ...
  24. ...
  25. </nsiOrganization>
  26. ...
  27. ...
  28. ...
  29. ...
  30. ...
  31.  
  32. // Загружаем xml файл
  33. XDocument xDoc = XDocument.Load("C:/myXml.xml");
  34.  
  35. // делим на части
  36. XElement[] xmls = xDoc.Root.Elements().ToArray();
  37.  
  38. for (int i = 0; i < xmls.Length; i++)
  39. {
  40. // Записываем каждый элемент в разные файл (ну или в базу)
  41. using (var file = File.CreateText(string.Format("xml{0}.xml", i + 1)))
  42. {
  43. file.Write(xmls[i].ToString());
  44. }
Add Comment
Please, Sign In to add comment