A set of XML utility functions.
- Source:
Methods
- 
    
        
            
            (static) evalDivision(exprString) → (nullable) {number}
- 
    
    Evaluate a division expressed as a stringParameters:Name Type Description exprStringstring The expression to evaluate, e.g. "200/2". Can also be a single number - Source:
 Returns:The evaluated expression as floating point number on success; otherwise return null.- Type
- number
 
- 
    
        
            
            (static) findChild(elemnon-null, name) → {Element}
- 
    
    Finds a child XML element.Parameters:Name Type Description elemElement The parent XML element. namestring The child XML element's tag name. - Source:
 Returns:The child XML element, or null if a child XML element does not exist with the given tag name OR if there exists more than one child XML element with the given tag name.- Type
- Element
 
- 
    
        
            
            (static) findChildren(elemnon-null, name) → (non-null) {Array.<!Element>}
- 
    
    Finds child XML elements.Parameters:Name Type Description elemElement The parent XML element. namestring The child XML element's tag name. - Source:
 Returns:The child XML elements.- Type
- Array.<!Element>
 
- 
    
        
            
            (static) getContents(elemnon-null) → (nullable) {string}
- 
    
    Gets the text contents of a node.Parameters:Name Type Description elemElement The XML element. - Source:
 Returns:The text contents, or null if there are none.- Type
- string
 
- 
    
        
            
            (static) parseAttr(elemnon-null, name, parseFunction, opt_defaultValueopt) → {T|null}
- 
    
    Parses an attribute by its name.Parameters:Name Type Attributes Description elemElement The XML element. namestring The attribute name. parseFunctionfunction(string): (T|null) A function that parses the attribute. opt_defaultValueT | null <optional> 
 The attribute's default value, if not specified, the attibute's default value is null. - Source:
 Returns:The parsed attribute on success, or the attribute's default value if the attribute does not exist or could not be parsed.- Type
- T | null
 
- 
    
        
            
            (static) parseDate(dateString) → (nullable) {number}
- 
    
    Parses an XML date string.Parameters:Name Type Description dateStringstring - Source:
 Returns:The parsed date in seconds on success; otherwise, return null.- Type
- number
 
- 
    
        
            
            (static) parseDuration(durationString) → (nullable) {number}
- 
    
    Parses an XML duration string. Negative values are not supported. Years and months are treated as exactly 365 and 30 days respectively.Parameters:Name Type Description durationStringstring The duration string, e.g., "PT1H3M43.2S", which means 1 hour, 3 minutes, and 43.2 seconds. Returns:The parsed duration in seconds on success; otherwise, return null.- Type
- number
 
- 
    
        
            
            (static) parseFloat(floatString) → (nullable) {number}
- 
    
    Parses a floating point number.Parameters:Name Type Description floatStringstring The floating point number string. - Source:
 Returns:The parsed floating point number on success; otherwise, return null. May return -Infinity or Infinity.- Type
- number
 
- 
    
        
            
            (static) parseInt(intString) → (nullable) {number}
- 
    
    Parses an integer.Parameters:Name Type Description intStringstring The integer string. - Source:
 Returns:The parsed integer on success; otherwise, return null.- Type
- number
 
- 
    
        
            
            (static) parseNonNegativeInt(intString) → (nullable) {number}
- 
    
    Parses a non-negative integer.Parameters:Name Type Description intStringstring The integer string. - Source:
 Returns:The parsed non-negative integer on success; otherwise, return null.- Type
- number
 
- 
    
        
            
            (static) parsePositiveInt(intString) → (nullable) {number}
- 
    
    Parses a positive integer.Parameters:Name Type Description intStringstring The integer string. - Source:
 Returns:The parsed positive integer on success; otherwise, return null.- Type
- number
 
- 
    
        
            
            (static) parseRange(rangeString) → (nullable) {?{start: number, end: number}}
- 
    
    Parses a range string.Parameters:Name Type Description rangeStringstring The range string, e.g., "101-9213". - Source:
 Returns:The parsed range on success; otherwise, return null.- Type
- ?{start: number, end: number}