Package com.tnsai.tools.file
Class XmlTools
java.lang.Object
com.tnsai.tools.file.XmlTools
Function-shape XML tools — the LangChain-style replacement for the legacy
XMLParserTool that took filepath|xpath as one string with a
single-pipe separator (see issue #188 — RFC).
The XML parser is configured with XMLConstants.FEATURE_SECURE_PROCESSING
and external-entity resolution disabled — XXE-safe defaults that match the
legacy tool's behavior plus the explicit XEE feature flips.
- Since:
- 0.5.7 (Phase 2 — built-in tool migration to function shape, see #188)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DEFAULT_EXTENSIONS
-
-
Constructor Details
-
XmlTools
public XmlTools() -
XmlTools
-
-
Method Details
-
xmlQuery
@Tool(name="xml_query", description="Query an XML file with an XPath expression and return matching node text-content values, one per line. Common XPath shapes: //tagname (all elements), //tagname/@attr (attribute values), //tagname/text() (text), //tagname[@id=\'x\'] (attribute filter). Returns \'No matches found for XPath: \u2026\' when the expression matches nothing.", keywords={"xml","xpath","query","parse"}, idempotent=true) public String xmlQuery(@ToolParam(description="Absolute file path to a .xml file") String filePath, @ToolParam(description="XPath expression to evaluate against the XML document") String xpath) throws IOException, XPathExpressionException, ParserConfigurationException, SAXException
-