Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Python

Idiom #103 Load XML file into object

Read from the file data.xml and write its contents into the object x.
Assume the XML data is suitable for the type of x.

import lxml.etree
x = lxml.etree.parse('data.xml')

Use "pip install" to get this third-party library. It's industry standard for python xml.
using System.Xml.Linq;
XDocument x = XDocument.Load("data.xml");


New implementation...