I make function for parsing evernote note xml content. The note contain buisness card data. And it represented by evernote xml-tags. The tags which value I have to get, don't have any specific id. And the only way to get needed tag, it's to find it by specific css value that contained in style attribute of this tag.
The xml content looks like this:
<span>
<span style="x-evernote:contact-org;
-evernote-editable:field;
font-size: 16px;
font-family: Helvetica;
color: #6f6f6f;
line-height: 22px;">Avratech</span>
</span>
The unique css attribute here is x-evernote:contact-org;
I used "find" method with X-path value from xml.etree.ElementTree module. And I encountered with two problems:
- The X-path looks very long.
For example:
company = contact_info.find('.//span[@style="x-evernote:contact-org;-evernote-editable:field;font-size: 16px;font-family: Helvetica; color: #6f6f6f;line-height: 22px;"]')
If I skiped one of the css parameters, it don't find needed tag.
- If all css
key:value;
written at new line, my X-path searching don't work.
Could you help me? May be there is another module that more applicable for this purpose?
There is an example of evernote note xml-content.
For the reasons you mentioned (and a few others), I gave up on that approach to parsing contact-card notes and I use straight text-matching instead - meaning I search the contents of the note as a text string, look for the relevant substrings that I need and extract those values.