A generic utility object that contains functions used
throughout MetacatUI to perform useful functions related to EML, but not
used to store or manipulate any state about the application.
- Since:
- Source:
Methods
cleanXMLText(value) → {*}
Clean text so it can be safely serialized into EML XML.
Parameters:
| Name |
Type |
Description |
value |
*
|
Candidate text value. |
- Since:
- Source:
Returns:
Cleaned text, or the original non-string value.
-
Type
-
*
getParentEML(model, maxTriesopt) → {EML211|false}
Climbs up the model hierarchy until it finds the EML model
Parameters:
| Name |
Type |
Attributes |
Description |
model |
Backbone.Model
|
|
The starting model |
maxTries |
number
|
<optional>
|
The maximum number of levels to climb |
- Source:
Returns:
- Returns the EML 211 Model or null if not found
-
Type
-
EML211
|
false
Validate a year with four digits or a YYYY-MM-DD calendar date.
Parameters:
| Name |
Type |
Description |
dateString |
string
|
Date text to check |
- Since:
- Source:
Returns:
True if the format and calendar date are valid
-
Type
-
boolean
markRootDataPackageChanged()
Mark the active package as edited after an EML model or view change.
- Since:
- Source:
parseTime(time) → {Object|null}
Parse an EML xs:time value without rounding fractional seconds or
assuming a time zone when none is given.
Parameters:
| Name |
Type |
Description |
time |
string
|
HH:MM:SS with optional fractional seconds and Z or
a signed HH:MM offset. Surrounding whitespace is trimmed before parsing |
- Since:
- Source:
- See:
-
Returns:
Parsed time, or null for an invalid value. seconds counts whole seconds
from midnight (86400 for 24:00:00); fraction contains the digits after the
decimal point, or ""; offset is seconds ahead of UTC, or null if no time
zone is given
-
Type
-
Object
|
null
serializeDOM(dom) → {string}
Serialize a DOM element to a string, removing the XML declaration and any
namespace declarations. Namespaces are added to the elements because the
codebase currently combines older ways of handling XML (using jQuery's
parseHTML and document.createElement) with newer ways (using DOMParser).
While we transition to using modern methods, this function can be used to
clean up the serialized XML.
Parameters:
| Name |
Type |
Description |
dom |
Element
|
The DOM element to serialize |
- Since:
- Source:
Returns:
The serialized XML string
-
Type
-
string