# SXP Reference

Usage | General

#### Description

To work with SXP, the user needs to instantiate a `SablotSituation`, register a DOM handler (a set of DOM-like callback functions) using `SXP_registerDOMHandler`, and create a query context using `SXP_createQueryContext`.

#### Example

         SablotSituation S;
         SXP_QueryContext Q;
         DOMHandler my_domhandler=
         {
           &getNodeType,
           /* ... more callbacks follow ... */
         };
         /* let us say the root is 123 */
         SXP_Node root = (SXP_Node) 123;
         SXP_char *result;

         SablotCreateSituation(&S);
         SXP_registerDOMHandler(S, &my_domhandler);
         SXP_createQueryContext(S, &Q);
         /* perform the query with the root as the context node */
         SXP_query(Q, "//*", root, 1, 1);
         SXP_getResultString(Q, &result);
         puts(result);
         SXP_destroyQueryContext(Q);
         SablotDestroySituation(S);

#### Notes

For clarity, error checking has been omitted from the above excerpt.

#### See Also

Groups | [ General ]
Entries | [ SXP_createQueryContext | SXP_registerDOMHandler | SablotSituation ]

© 2001-2003 Ginger Alliance
revision 03-01-31
This page was generated by APIDOC