Answers for "read xml file c#"

C#
2

How to read a XML on C#

XmlDocument doc = new XmlDocument();
            doc.Load(path);
            doc.Save(Console.Out);

            foreach (XmlNode node in doc.DocumentElement)
            {
                string word_name = node.Attributes[0].Value;
                string word_translation = node["name of node"].InnerText;
            }
Posted by: Guest on February-12-2021
2

read xml file c#

XmlDocument doc = new XmlDocument();
using (StreamReader streamReader = new StreamReader(path_name, Encoding.UTF8))
{
	contents = streamReader.ReadToEnd();
}
doc.LoadXml(contents);
Posted by: Guest on June-11-2020
0

Read XML

from bs4 import BeautifulSoup
 
soup = BeautifulSoup(open('W2Testfile.xml', encoding='utf-8'), 'lxml')
 
# Just copy from and doc and lower search or write lower case
sub_id = soup.find('SubmissionId'.lower())
# Tag and text
print(sub_id)
print(sub_id.text)
 
#---| Take out  part eg doc 2,then <find_all> of a tag that there are several of
doc_2 = soup.find('returndata', {'documentcnt': '2'})
dep_detail =  doc_2.find_all('DependentDetail'.lower())
print('-' * 30)
print(dep_detail[0].find('dependentrelationshipcd'))
print(dep_detail[0].find('dependentrelationshipcd').text)
Posted by: Guest on May-15-2021

C# Answers by Framework

Browse Popular Code Answers by Language