Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xml.mod] Add TxmlNode.findPath:TxmlNode(path) #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions xml.mod/common.bmx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions xml.mod/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 8 additions & 0 deletions xml.mod/xml.bmx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down