0
考慮到OmniFocus中沒有一個API,我已經創建了一個拉的OmniFocus數據是XML格式的經常性的基礎如何解析Omnifocus XML數據以獲取有關特定任務的詳細信息?
See linked here for the full omnifocus data set
我想我最好的解析這個數據集上的腳本這樣我就可以得到這些屬性對於一個名爲任務「這是一個測試任務」
我想從XML數據
- 任務名稱提取此任務以下屬性:「這是一個 測試任務 「
- 完成日期: 」2016年10月2日「
- 上架日期: 」2016年10月2日「
- 項目: 」測試項目「
- 截止日期:」 2016年10月11日「
- 時間:10分鐘
見下面我的Python腳本:
from bs4 import BeautifulSoup
text_data = BeautifulSoup(xml_data_set)
list_of_tags = s.find_all(tag.has_attr('id'))
#This creates an array of strings. The string that I'm interested looks like the following:
#>> e.g. <task id="lyZY7EINc02" op="update"><added>2016-10-02T19:53:09.672Z</added><modified>2016-10-02T19:53:13.912Z</modified><name>This is a test task</name></task>
list_of_dicts = [loads(dumps(xmltodict.parse(str(i)))) for i in l]
#I then use xmltodict to change each tag into an a dictionary. The tag that I'm interested looks like the following:
#>> e.g. {'[email protected]': 'lyZY7EINc02', 'task_modified': '2016-10-02T19:53:13.912Z', 'task_added': '2016-10-02T19:53:09.672Z', 'task_name': 'This is a test task', '[email protected]': 'update'}
雖然,我可以得到TA sk_added日期和task_name,我無法獲得我希望獲得的其他屬性。
這是一個測試任務嗎? –
幾乎沒有任何內容顯示在您鏈接到的文件中 –
對於混淆,我很抱歉,但是文件被截斷,但現在已經修復了新鏈接。你應該能夠找到線58395 – Chris