Skip Headers

# XMLType Functions

Previous

Next

You can use the following operators when constructing queries against data mapped to an Oracle Database XMLType column:

- `extract`: Takes an XPath string and returns an XMLType which corresponds to the part of the original document that matches the XPath.

- `extractValue`: Takes an Xpath string and returns either a numerical or string value based on the contents of the node pointed to by the XPath.

- `existsNode`: Takes an Xpath expression and returns the number of nodes that match the Xpath.

- `getStringVal`: Gets the string representation of an XMLType object.

- `getNumberVal`: Gets the numerical representation of an XMLType object.

- `isFragment`: Evaluates to 0 if the XML is a well formed document. Evaluates to 1 if the document is a fragment.

Example: Using the XMLType Extract Operator illustrates how to use the extract operator in a query:

Using the XMLType Extract Operator

    Expression criteria = builder.get("resume").extract("//education/degree/text()").getStringVal().equal("BCS");
    Vector employees = session.readAllObject(Employee.class, criteria);