Maven: исключить файл Java из упаковки

Загрузите xml в качестве документа

XmlDocument doc = new XmlDocument();
doc.LoadXml(your_xml_data);

Затем выполните итерацию через дочерние узлы

Configuration configuration = new Configuration();
XmlNode root = doc.FirstChild;

//fill the configuration from the child nodes.
if (root.HasChildNodes)
{
 if(root.ChildNodes[0].Name == "host")
 {
    configuration.host = root.ChildNodes[0].InnerText;
 }
 if(root.ChildNodes[1].Name == "port")
 {   
    configuration.port = root.ChildNodes[1].InnerText;
 }
}
2
задан Joe Almore 18 January 2019 в 23:22
поделиться