Работа с XML - C# (194688)
Формулировка задачи:
Есть условие задачи.
Нашёл пример здесь, вроде разобрался. Но возникла одна проблема: не видны данные в строках типа:<test name="oop" date="2013-03-20" mark="8.5"/>, вместо этого выводится <test>. В чём косяк? И как проверить на ошибки xml и xsd файлы?
Листинг программы
- <?xml version="1.0" encoding="UTF-8"?>
- <results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="results.xsd">
- <student>
- <login>cool</login>
- <tests>
- <test name="oop" date="2013-03-20" mark="8.5"/>
- <test name="xml" date="2013-03-23" mark="7.3"/>
- <test name="oop" date="2013-03-27" mark="9.4"/>
- <test name="jdbc" date="2013-03-27" mark="6.8"/>
- <test name="xml" date="2013-03-29" mark="7.9"/>
- </tests>
- </student>
- <student>
- <login>clever</login>
- <tests>
- <test name="oop" date="2013-03-27" mark="7.0"/>
- <test name="collections" date="2013-03-28" mark="6.4"/>
- </tests>
- </student>
- </results>
Решение задачи: «Работа с XML»
textual
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Task1
- {
- class TestResults
- {
- private string login;
- private string test;
- private DateTime date;
- private int mark;
- public TestResults()
- { }
- public TestResults(string login, string test, DateTime date, int mark)
- {
- this.login = login;
- this.test = test;
- this.date = date;
- this.mark = mark;
- }
- public override string ToString()
- {
- return string.Format("{0};{1};{2};{3}", login, test, date.ToShortDateString(), mark);
- }
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д