Platforms to show: All Mac Windows Linux Cross-Platform

CFTreeMBS.AppendChild(tree as CFTreeMBS)
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Appends a tree as a child.
Example:
dim documentinfo as new CFXMLDocumentInfoMBS
dim docnode as new CFXMLNodeMBS
dim instructionNode as new CFXMLNodeMBS
dim xmldocument as new CFTreeMBS
dim rootInfo as new CFXMLElementInfoMBS
dim rootNode as new CFXMLNodeMBS
dim rootTree as new CFTreeMBS
dim nameInfo as new CFXMLElementInfoMBS
dim nameNode as new CFXMLNodeMBS
dim nameTree as new CFTreeMBS
dim nameTextNode as new CFXMLNodeMBS
dim nameTextTree as new CFTreeMBS
dim nameTextNode2 as new CFXMLNodeMBS
dim nameTextTree2 as new CFTreeMBS
dim root as CFStringMBS

const kCFStringEncodingUTF8=&h08000100

// create a document node
documentinfo.SourceURL=nil
documentinfo.CFStringEncoding=kCFStringEncodingUTF8

docnode.CreateDocument(documentinfo)

xmldocument.CreateWithXMLNode docNode

// root element

rootInfo.XMLAttributes=nil
rootInfo.AttributeOrder=nil
rootInfo.IsEmpty=false

root=NewCFStringMBS("root")
rootNode.CreateElement root, rootInfo
rootTree.CreateWithXMLNode rootNode

nameInfo.XMLAttributes=nil
nameInfo.AttributeOrder=nil
nameInfo.IsEmpty=false

namenode.CreateElement NewCFStringMBS("FirstName"), nameInfo
nameTree.CreateWithXMLNode nameNode
rootTree.AppendChild nameTree

nameTextNode.CreateText NewCFStringMBS("Dean")
nameTextTree.CreateWithXMLNode nameTextNode
nameTree.AppendChild nameTextTree

nameInfo.XMLAttributes=nil
nameInfo.AttributeOrder=nil
nameInfo.IsEmpty=false

namenode.CreateElement NewCFStringMBS("LastName"), nameInfo
nameTree.CreateWithXMLNode nameNode
rootTree.AppendChild nameTree

nameTextNode2.CreateText NewCFStringMBS("Davis")
nameTextTree2.CreateWithXMLNode nameTextNode2
nameTree.AppendChild nameTextTree2

CFShowMBS(xmldocument)

xmldocument.AppendChild rootTree

MsgBox xmldocument.XMLData.str

// shows "<root><FirstName>Dean</FirstName><LastName>Davis</LastName></root>"
CFTreeMBS.ChildAtIndex(index as Integer) as CFTreeMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the child with the given index.
Notes: nil on any error.
CFTreeMBS.ChildCount as Integer
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the number of child nodes.
Notes: 0 on any error.
CFTreeMBS.Children as CFTreeMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the child tree node.
Notes: nil on any error.
CFTreeMBS.Create
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Creates a new empty tree and stores the handle in this object.
Notes: Handle is 0 on failure.
CFTreeMBS.CreateFromXMLData(data as CFBinaryDataMBS, url as CFURLMBS, ParseOptions as Integer)
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Creates a new XMLTree from the given data.
Notes:
URL is needed to resolve external references.

These are the various options you can configure the parser with. These are chosen such that an option flag of 0 (kCFXMLParserNoOptions) leaves the XML as "intact" as possible (reports all structures; performs no replacements).
Hence, to make the parser do the most work, returning only the pure element tree, set the option flag to kCFXMLParserAllOptions:

kCFXMLParserValidateDocument1validate the document against its grammar from the DTD, reporting any errors. Currently not supported.
kCFXMLParserSkipMetaData2silently skip over metadata constructs (the DTD and comments)
kCFXMLParserReplacePhysicalEntities4replace declared entities like &lt;. Note that other than the 5 predefined entities (lt, gt, quot, amp, apos), these must be defined in the DTD. Currently not supported.
kCFXMLParserSkipWhitespace8skip over all whitespace that does not abut non-whitespace character data. In other words, given <foo> <bar> blah </bar></foo>, the whitespace between foo's open tag and bar's open tag would be suppressed, but the whitespace around blah would be preserved.
kCFXMLParserResolveExternalEntities16
kCFXMLParserAddImpliedAttributes32where the DTD specifies implied attribute-value pairs for a particular element, add those pairs to any occurances of the element in the element tree. Currently not supported.
kCFXMLParserAllOptions&hFFFFFF
kCFXMLParserNoOptions0
CFTreeMBS.CreateWithXMLDataFromURL(URL as CFURLMBS, ParseOptions as Integer)
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Creates a new XMLTree from the given data at the URL.
Notes:
The handle property is set if the function is successfull.

These are the various options you can configure the parser with. These are chosen such that an option flag of 0 (kCFXMLParserNoOptions) leaves the XML as "intact" as possible (reports all structures; performs no replacements).
Hence, to make the parser do the most work, returning only the pure element tree, set the option flag to kCFXMLParserAllOptions:

kCFXMLParserValidateDocument1validate the document against its grammar from the DTD, reporting any errors. Currently not supported.
kCFXMLParserSkipMetaData2silently skip over metadata constructs (the DTD and comments)
kCFXMLParserReplacePhysicalEntities4replace declared entities like &lt;. Note that other than the 5 predefined entities (lt, gt, quot, amp, apos), these must be defined in the DTD. Currently not supported.
kCFXMLParserSkipWhitespace8skip over all whitespace that does not abut non-whitespace character data. In other words, given <foo> <bar> blah </bar></foo>, the whitespace between foo's open tag and bar's open tag would be suppressed, but the whitespace around blah would be preserved.
kCFXMLParserResolveExternalEntities16
kCFXMLParserAddImpliedAttributes32where the DTD specifies implied attribute-value pairs for a particular element, add those pairs to any occurances of the element in the element tree. Currently not supported.
kCFXMLParserAllOptions&hFFFFFF
kCFXMLParserNoOptions0

Some examples using this method:

CFTreeMBS.CreateWithXMLNode(node as CFXMLNodeMBS)
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Creates a XML tree based on the given node.
CFTreeMBS.FindRoot as CFTreeMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the tree root node.
Notes: nil on any error.
CFTreeMBS.FirstChild as CFTreeMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the first child node.
Notes: nil on any error.
CFTreeMBS.InsertSibling(tree as CFTreeMBS)
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Inserts a new tree as the sibling of this tree.
CFTreeMBS.NextSibling as CFTreeMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the next sibiling.
Notes: nil on any error.
CFTreeMBS.Parent as CFTreeMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the parent of the tree.
Notes: nil on any error.
CFTreeMBS.PrependChild(tree as CFTreeMBS)
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Inserts a new tree as the first child.
CFTreeMBS.Remove
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Removes this tree from its parent.
CFTreeMBS.RemoveAllChildren
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Removes all child nodes.
CFTreeMBS.XMLBinaryData as CFBinaryDataMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Creates XML Data from the tree.
Notes:
Generate the XMLData (ready to be written to whatever permanent storage is to be used) from an CFXMLTree. Will NOT regenerate entity references (except those required for syntactic correctness) if they were replaced at the parse time; clients that wish this should walk the tree and re-insert any entity references that should appear in the final output file.

Returns nil on any error.
Renamed from XMLData to XMLBinaryData for version 19.0.
CFTreeMBS.XMLNode as CFXMLNodeMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: Returns the xml node for this tree node.
Notes: nil on any error.

Some examples using this method:

The items on this page are in the following plugins: MBS MacCF Plugin.

Feedback: Report problem or ask question.

The biggest plugin in space...