@API(type=INTERNAL,
src=PUBLIC)
public class CommonsOperationsUtil
extends java.lang.Object
Constructor and Description |
---|
CommonsOperationsUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
buildFreshPrefix(NamespaceContext namespaceContext)
Generates a prefix that is not yet bound to a namespace.
|
static java.net.URL |
locateResourceInClasspath(AuthorAccess authorAccess,
java.lang.String resourceFileName)
Locate a certain resource in the classpath using its file name.
|
static java.lang.String |
setAttributeValue(AuthorDocumentController ctrl,
AuthorElement targetElement,
javax.xml.namespace.QName attributeQName,
java.lang.String value,
boolean removeIfEmpty)
Sets an attribute value.
|
static java.lang.String |
setAttributeValue(AuthorDocumentController ctrl,
AuthorElement targetElement,
javax.xml.namespace.QName attributeQName,
java.lang.String value,
java.lang.String normalizedValue,
boolean removeIfEmpty)
Sets an attribute value.
|
static void |
surroundWithFragment(AuthorAccess authorAccess,
boolean schemaAware,
java.lang.String xmlFragment)
Surround selection with fragment.
|
static int |
surroundWithFragment(AuthorAccess authorAccess,
java.lang.String xmlFragment,
int start,
int end)
Surround the content between start and end offset with the given fragment.
|
static void |
unwrapTags(AuthorAccess authorAccess,
AuthorNode nodeToUnwrap)
Unwrap node tags.
|
public static void unwrapTags(AuthorAccess authorAccess, AuthorNode nodeToUnwrap) throws javax.swing.text.BadLocationException
authorAccess
- The Author access.nodeToUnwrap
- The node to unwrap.javax.swing.text.BadLocationException
public static void surroundWithFragment(AuthorAccess authorAccess, boolean schemaAware, java.lang.String xmlFragment) throws AuthorOperationException
authorAccess
- Author access.schemaAware
- true
for schema aware operationxmlFragment
- The xml fragmentAuthorOperationException
public static int surroundWithFragment(AuthorAccess authorAccess, java.lang.String xmlFragment, int start, int end) throws AuthorOperationException
authorAccess
- Author access.xmlFragment
- The xml fragmentstart
- The start offset. Inclusive.end
- The end offset. Inclusive.AuthorOperationException
public static java.lang.String setAttributeValue(AuthorDocumentController ctrl, AuthorElement targetElement, javax.xml.namespace.QName attributeQName, java.lang.String value, boolean removeIfEmpty)
null
the attribute will
be removed from the element. If the value is the empty string and removeIfEmpty
is true
the attribute will also be removed.ctrl
- Attribute controller.targetElement
- The target element.attributeQName
- Attribute to edit.value
- Current value. Illegal characters in the value WILL NOT be escaped.removeIfEmpty
- true
to remove the attribute when an empty
value is set.public static java.lang.String setAttributeValue(AuthorDocumentController ctrl, AuthorElement targetElement, javax.xml.namespace.QName attributeQName, java.lang.String value, java.lang.String normalizedValue, boolean removeIfEmpty)
null
the attribute will
be removed from the element. If the value is the empty string and removeIfEmpty
is true
the attribute will also be removed.ctrl
- Attribute controller.targetElement
- The target element.attributeQName
- Attribute to edit.value
- Current value. Illegal characters in the value WILL NOT be escaped. All entities
must be already escaped in this value. For example: ab"c&$
normalizedValue
- The value with normalized whitespaces and expanded entities. For example: ab"c&$
removeIfEmpty
- true
to remove the attribute when an empty
value is set.public static java.lang.String buildFreshPrefix(NamespaceContext namespaceContext)
namespaceContext
- Namespace context.public static java.net.URL locateResourceInClasspath(AuthorAccess authorAccess, java.lang.String resourceFileName)
authorAccess
- Author access.resourceFileName
- The resource file name.null
.© Copyright SyncRO Soft SRL 2002 - 2015. All rights reserved.