I wanted to use XPath in ash, but the current xpath function only partially implemented xpath, so I wrote added in a new xpath function, as well as some other xml stuff.
Ash things added:
type: xmlnode - A type to hold an xml node.
function: to_xml(string xml, boolean cleanHtml) - Turns a string of xml in an xml document, returns an xmlnode which is a reference to the root element. If cleanHtml is true, it runs the string throught the htmlCleaner class.
function: to_xml(string xml) - Same as above, doesn't html clean the xml.
function: xpath(xmlnode node, string expression) - Runs an xpath expression on the xmlnode node/document that is passed in.
function: to_string(xmlnode node) - Returns a string of the xml of node and its children
to_string - Same as to_string(xmlnode node).
name - Returns the xmlnode tag name.
inner - Concatenates a to_string of all children of the xmlnode and returns it. (Not sure if this really has much use besides getting the value of an attribute or maybe for a node that only has text inside it.)
On the internal side I also modified the LibraryFunction class. I added a 4th parameter, so that the ash function name and java function name in the RuntimeLibrary class don't need to be the same. This allows better overloading of ash functions. There were issues because because all parameter types of the RuntimeLibrary functions are Value, which means an ash function couldn't have any overloads that had the same number of arguments. I also added/kept a 3 parameter constructor for the class, for compatibility and.. brevity? less wordlyness? (there's a coding word I'm thinking of but I can't remember it right now), which chains to the 4 parameter constructor.
Anyways, let me know what you guys think. It hasn't been thoroughly tested so there could be errors, but everything seemed to work for me.