Find answers from the community

Updated 3 months ago

is there an xml reader

is there an xml reader
a
d
15 comments
Yes! XMLReader is defined in the llama-index-readers-file package which is bundled in the main llama-index package.

In other words
Plain Text
pip install llama-index


Plain Text
from llama_index.readers.file import XMLReader
cannot import name 'XMLReader' from 'llama_index.readers.file'
wait think its this pip install llama-index-readers-file
ohh did you pip install llama-index? And if so, which version?
llama-index-readers-file does come with llama-index v0.10.8 (and a few patch versions before it actually)
Successfully installed llama-index-0.10.9
yeah nothing is working on my end
Are you using an virtual environment? Any legacy installs of llama-index i.e. 0.9.xx or earlier will break things.
Plain Text
pip uninstall llama-index
pip install llama-index --upgrade


If using virtual environments (recommended)
Plain Text
python -m venv venv
source venv/bin/activate
pip install llama-index


Then with venv active, run python (interpreter)
Plain Text
from llama_index.readers.file import XMLReader
umport worked wait so how do i have it read the file
Plain Text
loader = XMLReader()
documents = loader.load_data(file=Path("../example.xml"))
aweseome thank you!
Add a reply
Sign up and join the conversation on Discord