Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/crewai-tools/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"python-docx~=1.2.0",
"youtube-transcript-api~=1.2.2",
"pymupdf~=1.26.6",
"defusedxml>=0.7.1,<1",
]


Expand Down
7 changes: 4 additions & 3 deletions lib/crewai-tools/src/crewai_tools/rag/loaders/xml_loader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any
from xml.etree.ElementTree import ParseError, fromstring, parse

from defusedxml.ElementTree import ParseError, fromstring, parse

from crewai_tools.rag.base_loader import BaseLoader, LoaderResult
from crewai_tools.rag.loaders.utils import load_from_url
Expand Down Expand Up @@ -40,9 +41,9 @@ def _load_from_file(path: str) -> str:
def _parse_xml(self, content: str, source_ref: str) -> LoaderResult:
try:
if content.strip().startswith("<"):
root = fromstring(content) # noqa: S314
root = fromstring(content)
else:
root = parse(source_ref).getroot() # noqa: S314
root = parse(source_ref).getroot()

text_parts = []
for text_content in root.itertext():
Expand Down