$k. HTMLDocument

new $k.HTMLDocument()

Methods

(static) fromXslTransformation(sourceDocument, xsltSring)

Transforms the document with a XSLT stylesheet and returns the transformed document as an instance of the constructor

Parameters:
NameTypeDescription
sourceDocumentXMLDocument

Document to transform

xsltSringstring

XSLT stylesheet

Throws:

If the stylesheet is invalid

Type
$k.exception.InvalidValue

asCompleteUrl(relativeURL)

complete relative url to absolute url

Parameters:
NameTypeDescription
relativeURLstring

The relative url to be completed

collect(xPath)

collect matching elements

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the dita element

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue

collectJSON(xPath, stringProperties)

collect matching elements

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the dita element

stringPropertiesarray

element tags for elements with full subelements

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue

collectXML(xPath)

collect matching elements

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the dita element

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue

completeUrl(xPath, attributeName)

complete relative urls to absolute urls

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the dita element

attributeNamestring

name of the url-attribute

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue

flatten(xPath)

xml-encode all the contents of all matching nodes

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the nodes to flatten

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue

getUrl() → {String}

Returns the URL of this DitaDocument

Returns:

URL string

Type: 
String

insertAfter(xmlString, xPath)

insert xmlString after each matching element

Parameters:
NameTypeDescription
xmlStringstring

The string representing the element to insert

xPathstring

The xpath to determine the dita element

Throws:

If the xmlString or the xpath is invalid

Type
$k.exception.InvalidValue

remove(xPath)

remove matching elements

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the dita element

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue

replace(xPath, replaceFunction)

replace the contents of all matching nodes using the give function

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the nodes to flatten

replaceFunctionfunction

The function to determine the replacement

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue

setString(string, xPath) → {integer}

Adds the dita url

Parameters:
NameTypeDescription
stringstring

The string to be inserted

xPathstring

The xpath to determine the element

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue
Returns:

number of modified xml elements/attributes

Type: 
integer

setUrl(xPath) → {integer}

Adds the dita url

Parameters:
NameTypeDescription
xPathstring

The xpath to determine the dita element

Throws:

If the xpath is invalid

Type
$k.exception.InvalidValue
Returns:

number of modified xml elements/attributes

Type: 
integer

xmlString()

document string

xslTransform(xsltSring)

Transforms the document with a XSLT stylesheet and returns the transformed document

Parameters:
NameTypeDescription
xsltSringstring

XSLT stylesheet

Throws:

If the stylesheet is invalid

Type
$k.exception.InvalidValue