You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lightweight but powful package to encode, decode and traverse XML
0. API
Refer to the comments:
publicfinalclassXMLNode:NSObject{publicvarname=""publicvarattributes=[String:String]()publicvarvalue=""publicvarchildren=[XMLNode]()public weak varparent:XMLNode?
//build a node from XML
publicstaticfunc node(_ string:String)->XMLNode?{}
//turn a node to XML
publicvarstring:String{get}
/*
depth first traverse
Regex pattern: `|?(name(/other)*([key(=value(/other)*)?])?)+`
Instructions:
|: matches from current node
/: or
name: tag name
key: keys in attributes
value: values in attributes
*/
public subscript(path:String)->XMLNode?{}publicvarroot:XMLNode{get}}
Regex pattern: `|?(name(/other)*([key(=value(/other)*)?])?)+`
Instructions:
`|`: matches from current node
`/`: or
`name`: tag name
`key`: keys in attributes
`value`: values in attributes