A generic utility object that contains functions used
throughout MetacatUI to perform useful functions related to XML, but not
used to store or manipulate any state about the application.
- Since:
- Source:
Methods
cleanXMLText(textString) → {string}
Cleans up the given text so that it is XML-valid by escaping reserved
characters, trimming white space, etc.
Parameters:
| Name |
Type |
Description |
textString |
string
|
The string to clean up |
- Source:
Returns:
- The cleaned up string
-
Type
-
string
Extracts text content from the given XML string using the provided CSS
selectors
Parameters:
| Name |
Type |
Description |
xmlString |
string
|
The XML string to extract text from |
selectors |
Array.<string>
|
An array of CSS selectors to use for
extracting text. The first selector that matches will be used. |
- Source:
Returns:
- The extracted text, or an empty string if no text
was found
-
Type
-
string
parseXml(xmlString) → {Document|null}
Parses the given XML string into an XML Document object
Parameters:
| Name |
Type |
Description |
xmlString |
string
|
The XML string to parse |
- Source:
Returns:
- The parsed XML Document, or null if parsing
failed
-
Type
-
Document
|
null