diff --git a/xml.mod/common.bmx b/xml.mod/common.bmx index 1b984a63..13a4f2fe 100644 --- a/xml.mod/common.bmx +++ b/xml.mod/common.bmx @@ -50,6 +50,7 @@ Extern Function bmx_mxmlGetNextSibling:Byte Ptr(handle:Byte Ptr) Function bmx_mxmlGetPrevSibling:Byte Ptr(handle:Byte Ptr) Function bmx_mxmlFindElement:Byte Ptr(handle:Byte Ptr, element:String, attr:String, value:String) + Function bmx_mxmlFindPath:Byte Ptr(handle:Byte Ptr, path:String) Function bmx_mxmlSaveStdout:Int(handle:Byte Ptr, format:Int) Function bmx_mxmlSaveString:String(handle:Byte Ptr, format:Int) diff --git a/xml.mod/glue.c b/xml.mod/glue.c index 93cdebce..2087fc30 100644 --- a/xml.mod/glue.c +++ b/xml.mod/glue.c @@ -405,3 +405,17 @@ mxml_node_t * bmx_mxmlFindElement(mxml_node_t * node, BBString * element, BBStri return result; } + +mxml_node_t * bmx_mxmlFindPath( mxml_node_t * node, BBString * path) { + char * p = 0; + + if (path != &bbEmptyString) { + p = bbStringToUTF8String(path); + } + + mxml_node_t * result = mxmlFindPath(node, p); + + bbMemFree(p); + + return result; +} \ No newline at end of file diff --git a/xml.mod/xml.bmx b/xml.mod/xml.bmx index e0ae54c6..aa3fc7b3 100644 --- a/xml.mod/xml.bmx +++ b/xml.mod/xml.bmx @@ -272,6 +272,14 @@ Type TxmlNode Extends TxmlBase Return TxmlNode._create(bmx_mxmlFindElement(nodePtr, element, attr, value)) End Method + Rem + bbdoc: Finds an element fitting to the given path. Wildcards ("*") allowed. + returns: A node or Null if no match was found. + End Rem + Method findPath:TxmlNode(path:String) + Return TxmlNode._create(bmx_mxmlFindPath(nodePtr, path)) + End Method + Rem bbdoc: Frees a node and all of its children. End Rem