SparkXmlReader
Provides read only access to an Xml document in gamesparks storage.
e.g.
var myXmlReader = Spark.uploadedXml("7359237762da4245add41e44bc994cdd");
or
var myXmlReader = Spark.downloadableXml("SHORTCODE");
registerCallback
signature registerCallback(string path, Function startCallback)
returns void
Registers a function to be called when a given element is found.
params
path - A dot notated path representing the element to attach to
function - Your javascript function that should be called when the element is found
example
uploadedXml.registerCallback("catalog.book", processBookElement);
process
signature process()
returns void
Processes each document element and triggers any registered callback
example
uploadedXml.process();
getElement
signature getElement()
returns JSON
Returns the current element in the document, generally only useful during callbacks
The returned element only contains the element name and any attributes, it does not include children
returns
The current element
example
var element = uploadedXml.element;
getXml
signature getXml()
returns JSON
Returns the current element in the document as a complete xml structure including all children
returns
The current element as a document
example
var element = uploadedXml.xml;