Interface ARange
- All Known Implementing Classes:
RangeImpl
Range interface.
ARange adds four read-only attributes (startOID
, startPos, endOID, endPos) that
give the start and end points of the Range as strings that may be
spliced into ACL commands. Note that ACL represents a point as an
OID/POS pair.
PTC Arbortext Editor (and PTC Arbortext Publishing Engine) and the DOM
represent ranges differently. Therefore, the individual components of a
DOM range endpoint (attributes startNode,
startOffset) and PTC Arbortext endpoint (attributes
startOID, startPos) may differ. That is, the
OID indicated by startOID will not necessarily be the
starting OID for the node indicated by startNode, and the
integer value startOffset will not necessarily be equal to
the integer value startPos. Nor will there necessarily be
equivalences between endNode and endOID or
endOffset and endPos.
We only guarantee that the point in the document represented by the pair
(startNode, startOffset) will be the same
point as that indicated by the pair (startOID,
startPos) and that the point represented by the pair (
endNode, endOffset) will be the same point as
that represented by the pair (endOID, endPos).
The DOM allows the endpoint of a range to be within a processing instruction; PTC Arbortext products do not. If a DOM (node, offset) pair is located within a processing instruction, the corresponding (OID, pos) pair will indicate the point just before the start of the processing instruction (if the [node, offset] is the start of the range) or just after the end of the processing instruction (if the [node, offset] is the end of the range).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNon-ASCII characters are converted according to the currentwritenonasciicharset option.static final intForce XML inclusions to be replaced by their contents.static final intForce PTC Arbortext processing instructions to be included.static final intUse SGML syntax in the string returned even if theRangeis in an XML document.static final intUse XML syntax in the string returned even if theRangeis in an SGML document.static final intInclude the XML or SGML header associated with theRange.static final intSuppress PTC Arbortext processing instructions. -
Method Summary
Modifier and TypeMethodDescriptionshortcanInsertNode(Node node) This method indicates whether aNodecan be inserted at a position specified by the start of thisRangesuch that the result is compliant with VAL_SCHEMA validity type.shortcanInsertNodeWithFixup(Node node) This method indicates whether aNodecan be inserted at a position specified by the start of thisRangesuch that the result is compliant with VAL_SCHEMA validity type.Elements that can be inserted into the Document or DocumentFragment at the start of theRangesuch that the result will be compliant with VAL_SCHEMA validity type.Elements that can surround theRangesuch that the result will be compliant with VAL_SCHEMA validity type.This function returns aDOMStringdescribing the context of the start of thisRange.The end OID of theRange.The end position (in ACL) of theRange.The start OID of theRange.The start position (in ACL) of theRange.insertNodeWithFixup(Node node) This method inserts aNodeto the position specified by the start of thisRange.voidinsertParsedString(String text) Parsestextand inserts the resulting DOM objects into a document at the location indicated by the start of theRange.Returns the contents of aRangeas a string.Method overload which omits the last parameter.toMarkupStringEx(int flags) Returns the contents of aRangeas a string, with control over the markup.
-
Field Details
-
MARKUP_HEADER
static final int MARKUP_HEADERInclude the XML or SGML header associated with theRange. If theRangedoes not include the entire document, this will be a fragment header.- See Also:
-
MARKUP_FORCE_XML
static final int MARKUP_FORCE_XMLUse XML syntax in the string returned even if theRangeis in an SGML document.- See Also:
-
MARKUP_FORCE_SGML
static final int MARKUP_FORCE_SGMLUse SGML syntax in the string returned even if theRangeis in an XML document.- See Also:
-
MARKUP_NO_PI
static final int MARKUP_NO_PISuppress PTC Arbortext processing instructions. PTC Arbortext processing instructions can also be suppressed using thewritepiset option.- See Also:
-
MARKUP_FORCE_PI
static final int MARKUP_FORCE_PIForce PTC Arbortext processing instructions to be included. This option overrides theMARKUP_NO_PIoption and thewritepiset option.- See Also:
-
MARKUP_EXPAND_XINCLUDE
static final int MARKUP_EXPAND_XINCLUDEForce XML inclusions to be replaced by their contents.- See Also:
-
MARKUP_CHAR
static final int MARKUP_CHARNon-ASCII characters are converted according to the currentwritenonasciicharset option. If theentityoutputconvertset option is alsoon, then character entities will also be output according to thewritenonasciicharset option.- See Also:
-
-
Method Details
-
getStartOID
The start OID of theRange. Note that the OID indicated by thestartOIDis not necessarily the same as the starting OID for the node indicated by thestartNode.- Throws:
DOMException- INVALID_STATE_ERR: Raised if theRangehas already been detached.- Since:
- Epic 4.0
-
getStartPos
The start position (in ACL) of theRange. Note that the position indicated by thestartPosis not necessarily equal to the value ofstartOffset.- Throws:
DOMException- INVALID_STATE_ERR: Raised if theRangehas already been detached.- Since:
- Epic 4.0
-
getEndOID
The end OID of theRange. Note that the OID indicated by theendOIDis not necessarily the same as the ending OID for the node indicated by theendNode.- Throws:
DOMException- INVALID_STATE_ERR: Raised if theRangehas already been detached.- Since:
- Epic 4.0
-
getEndPos
The end position (in ACL) of theRange. Note that the position indicated by theendPosis not necessarily equal to the value ofendOffset.- Throws:
DOMException- INVALID_STATE_ERR: Raised if theRangehas already been detached.- Since:
- Epic 4.0
-
insertParsedString
Parsestextand inserts the resulting DOM objects into a document at the location indicated by the start of theRange.- Parameters:
text- The text to be inserted. Markup is interpreted as XML or SGML according to the target document. If an empty string, this method does nothing.- Throws:
AOMException- Raised if the method detects an error, for example, the insertion is not permitted due to context checking.- Since:
- Epic 4.3
-
toMarkupString
Returns the contents of aRangeas a string. This string contains the character data and markup representing the entire contents of the range.- Returns:
- The contents of the
Range. - Throws:
DOMException- INVALID_STATE_ERR: Raised if theRangehas already been detached.- Since:
- Epic 4.3
-
getAllowedInsertElements
NameList getAllowedInsertElements()Elements that can be inserted into the Document or DocumentFragment at the start of theRangesuch that the result will be compliant with VAL_SCHEMA validity type. If the start container is a Text node it will be assumed to be split into two text nodes and the list of elements valid between them will be returned.- Since:
- Epic 5.0
-
getAllowedSurroundElements
NameList getAllowedSurroundElements()Elements that can surround theRangesuch that the result will be compliant with VAL_SCHEMA validity type.- Since:
- Epic 5.0
-
getContextString
String getContextString()This function returns aDOMStringdescribing the context of the start of thisRange. This string consists of a list of element names and parentheses, such as:doc(body(chapter(title()para0(title()para(The left parenthesis following an element name represents a start tag, and the right parenthesis represents the end tag for the corresponding unmatched start tag. If thisRangeis before the opening start tag or if context checking is not relevant for the current document, a null string will be returned.- Since:
- Epic 5.0
-
insertNodeWithFixup
This method inserts aNodeto the position specified by the start of thisRange. It will try to add required ancestors or descendents to make context compliant with VAL_SCHEMA validity type. If the start container of the range is a text node it will be split and the node will be inserted between the two resulting text nodes.- Parameters:
node- TheNodeto be inserted.- Returns:
- The
Rangeinserted. - Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the start of the Range is read-only.
WRONG_DOCUMENT_ERR: Raised ifnewNodeand the container of the start of the Range were not created from the same document.
HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range is of a type that does not allow children of the type ofnewNodeor ifnewNodeis an ancestor of the container.
INVALID_STATE_ERR: Raised ifdetach()has already been invoked on this object.RangeException- INVALID_NODE_TYPE_ERR: Raised ifnewNodeis an Attr, Entity, Notation, or Document node.- Since:
- Epic 5.0
-
canInsertNode
This method indicates whether aNodecan be inserted at a position specified by the start of thisRangesuch that the result is compliant with VAL_SCHEMA validity type. If the container is a text node, it will be considered to have been split and the test will be made between the two resulting text nodes.- Parameters:
node- TheNodeto be inserted.- Returns:
- A validation state constant.
- Since:
- Epic 5.0
-
canInsertNodeWithFixup
This method indicates whether aNodecan be inserted at a position specified by the start of thisRangesuch that the result is compliant with VAL_SCHEMA validity type. This test considers adding required ancestors or descendents to make context valid.- Parameters:
node- TheNodeto be inserted.- Returns:
- A validation state constant.
- Since:
- Epic 5.0
-
toMarkupStringEx
Returns the contents of aRangeas a string, with control over the markup. This string contains the character data and markup representing the entire contents of the range.- Parameters:
flags- A bitmask that specifies markup options. Constructed by ORing the bits from theMarkupFlagsenumeration.- Returns:
- The contents of the
Range. - Throws:
DOMException- INVALID_STATE_ERR: Raised if theRangehas already been detached.- Since:
- Epic 5.2
-
toMarkupStringEx
Method overload which omits the last parameter.- Throws:
DOMException
-