XMLtoJSON
1.0.0
該項目提供了一組腳本和工具,用於將XML文件轉換為JSON格式。它旨在與不同的XML數據源一起使用,並且可以完全自定義,從而支持多個轉換模塊。該項目分為單獨的Python模塊,用於處理不同類型的數據,包括文檔,人員和檔案。
解決方案包括:
convert/
archiveLinkConvert.py # Handles conversion of archive link XMLs
artworkConvert.py # Handles artwork XML data
commonConvert.py # Contains common conversion utilities
personConvert.py # Handles conversion of person-related XMLs
docs/
pictures/ # Picture documentation related to the project
Analyza_SP.md # Analysis related documentation
documentaria_rudolphina.md # Project-specific documentation
model/
ArchiveLink.py # Data model for archive links
Document.py # Data model for documents
Person.py # Data model for person records
scripts/
main_convert.py # Main script to execute conversion
.gitignore # Git ignore configuration
README.md # This documentation file 要使用此工具,您需要安裝Python和PIP。
然後,運行以下命令:
pip install -r requirements.txt這將安裝必要的庫來運行腳本。然後,只需使用適當的選項運行main_convert.py腳本。這是從XMLtoJSON目錄運行程序的主要命令:
顯示幫助信息:
python3 scripts/main_convert.py --help或者
python3 scripts/main_convert.py --h轉換所有類型的XML文件:
python3 scripts/main_convert.py --type all --input_path " path_for_input_data " --output_path " path_for_output_data "轉換與名稱相關的XML文件:
python3 scripts/main_convert.py --type names --input_path " path_for_input_data " --output_path " path_for_output_data "轉換與寄存器相關的XML文件:
python3 scripts/main_convert.py --type registers --input_path " path_for_input_data " --output_path " path_for_output_data "轉換與存檔相關的XML文件:
python3 scripts/main_convert.py --type archive --input_path " path_for_input_data " --output_path " path_for_output_data "輸入數據文件夾應如下構造:
input_data/
Archiv/ # Archive-related XML files
Regesten/ # Register-related XML files
Namen/ # Name-related XML files
Indicies/ # Index-related XML files git clone https://github.com/VandlJ.git
cd XMLtoJSON要開始轉換,請使用主轉換腳本。例如,轉換所有XML文件:
python3 scripts/main_convert.py --type all --input_path " ../test_data " --output_path " ../test_data/output "您還可以查看所有可用選項,並通過運行獲取詳細信息:
python3 scripts/main_convert.py --help此命令將開始處理指定的--input_path目錄中的XML文件,並將結果輸出到--output_path目錄。
該項目是從另一個團隊繼承的,我們進行了一些重大改進和修復以提高其功能和可靠性:
錯誤處理:文本中的空格/空白字符 - 在regesten文件中
display :此字段用於在前端顯示文本,以確保其保留原始格式以進行可讀性。processable :此字段包含文本的更清潔版本,已針對計算機處理和分析進行了優化。元數據處理:Regesten的問題元數據
.p中存在不一致之處。一些元素缺少或錯誤地捕獲。我們進行了徹底的審查,並確保在我們的程序迭代中準確捕獲和處理所有元數據元素。增強的交互性:添加信息onmouseover="highlightWords(event, '...')"
onmouseover在懸停時的單詞。處理後的數據現在包括: "names" : [
{
"Aichholz_Johann" : " Johann Aichholz " ,
"alias" : " Johann Aichholz Ehrzney doctor "
},
{
"Strauben_Franz" : " Franz Strauben " ,
"alias" : " Frannzen Strauben "
}
]名稱處理:通過外部工具分開名稱和姓氏-Gettyulan
轉換的統一主腳本
--type , --input_path和--output_path 。此更改簡化了執行並增強了轉換過程的靈活性。改進的文檔和設置說明
性能增強和錯誤修復
修復Archiv類型JSON輸出
hasSublink , linkTo和next_link變量的處理。這樣可以確保這些變量在JSON輸出中準確表示和鏈接。這些改進大大提高了XML對JSON Converter項目的功能,可用性和可靠性,從而使其更強大和用戶友好。