The xml module

The xml module is an extension module, and provides functions to manipulate XML documents: reading nodes, and changing nodes and properties.  Creating XML documents is done by other modules, such as idmef or iodef.

Configuration options

None.

Primitives

  • xml_get_str : xmldoc, strstr
    get value from a node in an XML document

    • usage: xml_get_str(xml-document, path)
      fetches value of node referenced by path in xml-document
    • returns: a string, if path is a valid XPath path in xml-document, the undefined null object otherwise
  • xml_set_str : xmldoc, strstrint
    set node value  in an XML document, creating it if necessary

    • usage: xml_set_str(xml-document, path, value)
      sets value of node referenced by path in xml-document to value
    • returns: 1 (true) if path is a valid XPath path in xml-document, 0 (false) otherwise
  • xml_set_prop : xmldoc, strstrstrint
    set node property (a.k.a., attribute)  in an XML document, creating it if necessary

    • usage: xml_set_prop(xml-document, path, property, value)
      sets property property of node referenced by path in xml-document to value
    • returns: 1 (true) if path is a valid XPath path in xml-document, 0 (false) otherwise