new Passage(urn, endpoint, inventory)
Create a Passage object representing part of a full text
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
urn |
string | URN identifying the text | |
endpoint |
string | CTS.endpoint.Endpoint |
<nullable> |
CTS API Endpoint. |
inventory |
inventory |
<nullable> |
Inventory Identifier |
Properties:
Name | Type | Argument | Description |
---|---|---|---|
document |
Document | The XML document representing the passage | |
xml |
string | String representation of the XML representing the passage | |
text |
string | Text of the passage | |
urn |
string | URN identifying the passage | |
inventory |
inventory |
<nullable> |
Inventory containing the text |
endpoint |
CTS.endpoint.Endpoint | Endpoint to get the text |
Methods
-
<static> checkXML() → {boolean}
-
Check if the body of the XML is not empty
Returns:
Boolean indecating if we got xml or not.- Type
- boolean
-
<static> getText(removedNodes, strip) → {string}
-
Get the text, removing nodes if necessary. if the instance has the text.property set, returns it.
Parameters:
Name Type Argument Description removedNodes
?Array.<string> <nullable>
List of nodes' tagname to remove strip
boolean <nullable>
If true, strip the spaces in the text Returns:
Instance text- Type
- string
-
<static> getXml(elementName, format) → {Document|string}
-
Gets the xml using the URN
Parameters:
Name Type Argument Description elementName
string <nullable>
The name of the element to retrieve. Should be null to access format and still get whole document format
string <nullable>
Type of data to retrieve. Default : xml. Available : xml, string Returns:
Asked dom- Type
- Document | string
-
<static> retrieve()
-
Load the text from the endpoint
Parameters:
Name Type Argument Description options.success
function <nullable>
Function to call when text is retrieved options.error
function <nullable>
Function to call when an error occured options.endpoint
string <nullable>
CTS API Endpoint options.metadata
boolean <nullable>
Retrieve metadata and create a this.Text -
<static> setText(text)
-
Set the text for the Text instance
Parameters:
Name Type Description text
string Text embodied by object.urn