|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.virtualweaver.xotics.datamodel.XoUtilities
contains some generic utility methods
Method Summary | |
static XoObject |
addChild(XoRegistry reg,
XoObject child,
XoContainer parent)
|
static XoObject |
addChild(XoRegistry reg,
XoObject child,
XoContainer parent,
int index)
Use this method to add a child to a parent container not belonging to
any DM instance. |
static java.lang.String |
collapseWhiteSpace(java.lang.String lexicalStr)
Returns a new string where all occurrences of \\n, \\r and \\t are replaced by whitespace, and where following whitespace chars are replaced by a single one. |
static XoContentModel |
createContentModelNode(byte cmtype)
Creates a Content-Model description node. |
static XoContentModel |
createContentModelNode(byte cmtype,
int min,
int max)
Creates a Content-Model description node. |
static XoContentModel |
createContentModelNode(java.lang.String nsref,
int min,
int max)
Creates a Content-Model description node representing an ANY filter. |
static XoContentModel |
createContentModelNode(java.lang.String nsref,
java.lang.String elementRef,
java.lang.String elementType,
int min,
int max)
Creates a Content-Model description node representing an element reference (ELEMENT_REF). |
static XoContentModel |
getContentModel(XoRegistry reg,
XoContainer c)
Returns the Content-Model for container c, as a tree of XoContentModel nodes.
|
static int |
getIndexOfChild(XoObject child)
Gets index of child object in its parent children list. |
static XoObject |
getPolymorphObject(XoRegistry registry,
XoPolymorphWrapper child,
XoContainer parent)
Returns the appropriate XO object implementation held by polymorph wrapper child
when added to parent . |
static java.lang.String |
normalizeWhiteSpace(java.lang.String lexicalStr,
byte ws)
Normalizes string param lexicalStr depending on ws normalization
directive :
for XoConstants.WS_COLLAPSE calls collapseWhiteSpace(String) ,
for XoConstants.WS_REPLACE calls replaceWhiteSpace(String) ,
otherwise returns unchanged lexicalStr . |
static java.lang.String |
replaceWhiteSpace(java.lang.String lexicalStr)
Returns a new string where all occurrences of \\n, \\r and \\t are replaced by whitespace |
static java.lang.String |
toString(XoObject xo)
returns a standard XML string representation of param xo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static XoObject addChild(XoRegistry reg, XoObject child, XoContainer parent, int index) throws XoException
child
to a parent
container not belonging to
any DM instance. It is not a mandatory method, but a useful method, as it notably handles
specific constraints relative to multi-implemented elements (XoPolymorphWrapper
).
reg
- the current Registrychild
- object to add as childparent
- parent of newly added childindex
- insertion index
XoException
- if some error occur during adding processpublic static XoObject addChild(XoRegistry reg, XoObject child, XoContainer parent) throws XoException
XoException
with index at -1 (append).
public static XoObject getPolymorphObject(XoRegistry registry, XoPolymorphWrapper child, XoContainer parent) throws XoException
child
when added to parent
. Please use it only if parent
doesn't belong to
any DM instance.
registry
- the current Registrychild
- polymorph wrapper planned to be added as childparent
- target parent
XoException
- if no implementation is suitable or some error occur during processpublic static int getIndexOfChild(XoObject child)
child
object in its parent children list.
child
- XO object whose index is wanted
public static java.lang.String toString(XoObject xo)
xo
xo
- object to convert as string
public static java.lang.String normalizeWhiteSpace(java.lang.String lexicalStr, byte ws)
lexicalStr
depending on ws
normalization
directive :
XoConstants.WS_COLLAPSE
calls collapseWhiteSpace(String)
,XoConstants.WS_REPLACE
calls replaceWhiteSpace(String)
,lexicalStr
.
lexicalStr
- the string to normalizews
- the normalization directive
public static java.lang.String replaceWhiteSpace(java.lang.String lexicalStr)
lexicalStr
- the string to transform
public static java.lang.String collapseWhiteSpace(java.lang.String lexicalStr)
lexicalStr
- the string to transform
public static XoContentModel getContentModel(XoRegistry reg, XoContainer c)
XoContentModel
nodes.
Content-Model returned is either a dynamic CM resulting from a call to XoContainer.getXoContentModel()
or a static CM coming from DMDL description of container's dialect implementation.
reg
- the registry, needed to perform searchingc
- the container whose Content-Model is wanted
public static XoContentModel createContentModelNode(byte cmtype, int min, int max)
cmtype
- Content-Model typemin
- minimum occurrencemax
- maximum occurrence
public static XoContentModel createContentModelNode(byte cmtype)
cmtype
- Content-Model type
public static XoContentModel createContentModelNode(java.lang.String nsref, java.lang.String elementRef, java.lang.String elementType, int min, int max)
nsref
- namespace of element referencedelementRef
- local name of element referencedelementType
- type identifying specific implementation of element (can be null)min
- minimum occurrencemax
- maximum occurrence
public static XoContentModel createContentModelNode(java.lang.String nsref, int min, int max)
nsref
can be specified to represent "ns:*" (any element from a particular namespace).
A null nsref
means "*:*" (any element from any namespace).
nsref
- a particular namespacemin
- minimum occurrencemax
- maximum occurrence
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |