2012-11-27 79 views
1

我需要在以下情況下寫測試用XML數據比較MongoDB的數據

- I have a ruby script to read xml data and store the resultant data in MongoDB. 
- I want to write a test, which compares the xml and the imported content in the db and make sure the data in xml and imported data are similar. 

考慮下面的示例XML文件:

<employees> 
    <employee> 
     <name>xxx</name> 
    </employee> 
    <employee> 
     <name>yyy</name> 
    </employee> 
</employees> 

employees (table) 
----------------- 
name 
xxx 
yyy 

how do i write test for this case? 

回答

0

如果您使用的是Java,你可以確保你的MongoDB文檔匹配你的Java對象,然後使用JAXB轉換爲XML。