How to use Python read attributes values in XML file, non standard format [closed]
up vote
0
down vote
favorite
XML format
<datas>
<data> field1=abc, field2=cde,field3=fgh <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Bit more complicated, nested format
<datas>
<data> field1=abc, field2=[[field3=fgh, field4=fhg,field5=kjk]] <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Is there any tool can be use to parse this kind of format to retrieve value of the fields?
python xml
New contributor
closed as off-topic by Martijn Pieters♦ Nov 9 at 16:53
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Martijn Pieters
add a comment |
up vote
0
down vote
favorite
XML format
<datas>
<data> field1=abc, field2=cde,field3=fgh <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Bit more complicated, nested format
<datas>
<data> field1=abc, field2=[[field3=fgh, field4=fhg,field5=kjk]] <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Is there any tool can be use to parse this kind of format to retrieve value of the fields?
python xml
New contributor
closed as off-topic by Martijn Pieters♦ Nov 9 at 16:53
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Martijn Pieters
1
That's just text data, and any structured format in text data is entirely outside of the XML standard. Just parse it like you would a Python string of the format.
– Martijn Pieters♦
Nov 9 at 16:53
See a similar question, parsing space-separated key-value pairs: Creating dictionary from space separated key=value string in Python
– Martijn Pieters♦
Nov 9 at 16:54
Also look at Extracting key value pairs from string with quotes, which handles quoted values, similar to your nested key-value pairs.
– Martijn Pieters♦
Nov 9 at 16:56
And lastly, Split "Nested" String By Parentheses into Nested List is probably interesting too.
– Martijn Pieters♦
Nov 9 at 16:56
That's cool.Thank you very much!
– netbbq
Nov 9 at 19:59
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
XML format
<datas>
<data> field1=abc, field2=cde,field3=fgh <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Bit more complicated, nested format
<datas>
<data> field1=abc, field2=[[field3=fgh, field4=fhg,field5=kjk]] <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Is there any tool can be use to parse this kind of format to retrieve value of the fields?
python xml
New contributor
XML format
<datas>
<data> field1=abc, field2=cde,field3=fgh <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Bit more complicated, nested format
<datas>
<data> field1=abc, field2=[[field3=fgh, field4=fhg,field5=kjk]] <data/>
<data> field1=abc, field2=cde,field3=fgh <data/>
</datas>
Is there any tool can be use to parse this kind of format to retrieve value of the fields?
python xml
python xml
New contributor
New contributor
New contributor
asked Nov 9 at 16:52
netbbq
1
1
New contributor
New contributor
closed as off-topic by Martijn Pieters♦ Nov 9 at 16:53
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Martijn Pieters
closed as off-topic by Martijn Pieters♦ Nov 9 at 16:53
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Martijn Pieters
1
That's just text data, and any structured format in text data is entirely outside of the XML standard. Just parse it like you would a Python string of the format.
– Martijn Pieters♦
Nov 9 at 16:53
See a similar question, parsing space-separated key-value pairs: Creating dictionary from space separated key=value string in Python
– Martijn Pieters♦
Nov 9 at 16:54
Also look at Extracting key value pairs from string with quotes, which handles quoted values, similar to your nested key-value pairs.
– Martijn Pieters♦
Nov 9 at 16:56
And lastly, Split "Nested" String By Parentheses into Nested List is probably interesting too.
– Martijn Pieters♦
Nov 9 at 16:56
That's cool.Thank you very much!
– netbbq
Nov 9 at 19:59
add a comment |
1
That's just text data, and any structured format in text data is entirely outside of the XML standard. Just parse it like you would a Python string of the format.
– Martijn Pieters♦
Nov 9 at 16:53
See a similar question, parsing space-separated key-value pairs: Creating dictionary from space separated key=value string in Python
– Martijn Pieters♦
Nov 9 at 16:54
Also look at Extracting key value pairs from string with quotes, which handles quoted values, similar to your nested key-value pairs.
– Martijn Pieters♦
Nov 9 at 16:56
And lastly, Split "Nested" String By Parentheses into Nested List is probably interesting too.
– Martijn Pieters♦
Nov 9 at 16:56
That's cool.Thank you very much!
– netbbq
Nov 9 at 19:59
1
1
That's just text data, and any structured format in text data is entirely outside of the XML standard. Just parse it like you would a Python string of the format.
– Martijn Pieters♦
Nov 9 at 16:53
That's just text data, and any structured format in text data is entirely outside of the XML standard. Just parse it like you would a Python string of the format.
– Martijn Pieters♦
Nov 9 at 16:53
See a similar question, parsing space-separated key-value pairs: Creating dictionary from space separated key=value string in Python
– Martijn Pieters♦
Nov 9 at 16:54
See a similar question, parsing space-separated key-value pairs: Creating dictionary from space separated key=value string in Python
– Martijn Pieters♦
Nov 9 at 16:54
Also look at Extracting key value pairs from string with quotes, which handles quoted values, similar to your nested key-value pairs.
– Martijn Pieters♦
Nov 9 at 16:56
Also look at Extracting key value pairs from string with quotes, which handles quoted values, similar to your nested key-value pairs.
– Martijn Pieters♦
Nov 9 at 16:56
And lastly, Split "Nested" String By Parentheses into Nested List is probably interesting too.
– Martijn Pieters♦
Nov 9 at 16:56
And lastly, Split "Nested" String By Parentheses into Nested List is probably interesting too.
– Martijn Pieters♦
Nov 9 at 16:56
That's cool.Thank you very much!
– netbbq
Nov 9 at 19:59
That's cool.Thank you very much!
– netbbq
Nov 9 at 19:59
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
That's just text data, and any structured format in text data is entirely outside of the XML standard. Just parse it like you would a Python string of the format.
– Martijn Pieters♦
Nov 9 at 16:53
See a similar question, parsing space-separated key-value pairs: Creating dictionary from space separated key=value string in Python
– Martijn Pieters♦
Nov 9 at 16:54
Also look at Extracting key value pairs from string with quotes, which handles quoted values, similar to your nested key-value pairs.
– Martijn Pieters♦
Nov 9 at 16:56
And lastly, Split "Nested" String By Parentheses into Nested List is probably interesting too.
– Martijn Pieters♦
Nov 9 at 16:56
That's cool.Thank you very much!
– netbbq
Nov 9 at 19:59