XPath is a W3C language for navigating XML nodes and selecting specific nodes. With SQL Server OPENXML(), an XPath pattern identifies the hierarchy level treated as rows. section 3.4.1
Use XPath carefully when shredding hierarchical XML:
- Point the XPath expression at the lowest hierarchy level that should produce rows. section 3.4.1
- Use the ../ operator in mappings to traverse from a lower-level node to its parent data. section 3.4.1
- Prepare the XML with sp_xml_preparedocument before OPENXML(), then call sp_xml_removedocument to release the in-memory tree. section 3.4.1
Employee contracts
For XML containing Employee, Contract, and Skill nodes, select the lowest-level row hierarchy with an XPath pattern, then map employee and contract values by traversing upward with ../. section 3.4.1


