How to use an XML based file register class.
The XMLModels module (pyMez.Code.DataHandlers.XMLModels) has the FileRegister class.
from pyMez import *
# Create a new file register
new_file_register=FileRegister()
# now add all the files in the current working directory
new_file_register.add_tree(os.getcwd())
# now we have created an xml sheet with all of the current files and directories and a ip like id
new_file_register.get_data_dictionary_list()[0]
# we can create html and show it
html_text=new_file_register.to_HTML(os.path.join(TESTS_DIRECTORY,"../XSL/FR_STYLE.xsl"))
html=HTMLBase(html_text=html_text)
html.show()
# we can add another file
new_file_register.add_entry(os.path.join(PYMEASURE_ROOT,"Documentation/pyMez_Documentation.html"))
# now we have a dictionary representation
new_file_register.get_data_dictionary_list()[-1]
# A list representation
new_file_register.get_data()[0]
# and we can use xpath syntax
print(new_file_register[".//File"][0])