Caplin Trader 5.1.0

Class: module:ct-core/XmlParser

module:ct-core/XmlParser()

new module:ct-core/XmlParser()

Constructs an XmlParser. This has been included for backwards compatibility.

It is recommended that the module:ct-core/XmlParser#getInstance method is used to get an instance instead of generating a new XmlParser every time.

Utility class that provides methods for parsing XML strings into Document Objects. The object is a singleton so XmlParser should be used to obtain an instance of an XmlParser.

Example:

var doc = XmlParser.parse("<test />");
console.log(doc);

The module:ct-core/XmlUtility singleton provides further helper methods to manipulate XML.

Deprecated:
  • This functionality is provided by an equivalent 'br-' library, and this proxy class will be removed from CaplinTrader in a future release. Please update any references to this class in your code.
See:

Methods

(static) getInstance() → {module:ct-core/XmlParser}

Gets an instance of XmlParser. This is intended to allow a single instance to be used throughout the application.

Deprecated:
  • This method is no longer needed as XmlParser is now a singleton.
Returns:

An instance of XmlParser.

Type
module:ct-core/XmlParser

(static) parse()

Deprecated:
  • This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
See:

(static) parseString(sXml) → {DOMDocument}

Parses an XML string and returns a document object representation.

Parameters:
Name Type Description
sXml String

The XML string to be parsed.

Deprecated:
  • This method produces different XML DOM representations for the specified XML depending on which browser it is run within. For example, IE strips out whitespace whilst Firefox keeps it. It is recommended that the module:br-util/XmlParser.parse method is used instead.
Returns:

An XML DOM representing the specified XML. If the XML failed to be parsed an XML DOM with the root node parsererror will be returned.

Type
DOMDocument

(static) stripWhitespace()

Deprecated:
  • This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
See: