martinblech/xmltodict

Get element parsed location

Adri123131 opened this issue · 0 comments

Hello, I'm trying to parse a custom xml like this:

<First name="first">
    <Second name="second">
        <Third name="third"/>
    </Second>
</First>

The tool will return me a object like this:

OrderedDict([('First', 
	OrderedDict([('@name', 'first'), 
	('Second', 
		OrderedDict([('@name', 'second'), 
		('Third', 
			OrderedDict([('@name', 'third')]))]))]))])

Is there a way to get the position of the original text that each parsed element belongs to?
I want something like that:

OrderedDict([(['First',2], 
	OrderedDict([(['@name',8], ['first',14]), 
	(['Second',28], 
		OrderedDict([(['@name',35], ['second',41]), 
		(['Third',60], 
			OrderedDict([(['@name',66], ['third',72])]))]))]))])