|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfacets.util.Tracer
facets.util.datatree.XmlPolicy
public class XmlPolicy
Defines document and other policy for an XmlDocRoot
, in
particular XmlSpecifier
s for loading and saving content.
For background to segregate methods see XmlDocRoot
summary.
Field Summary | |
---|---|
static java.lang.String |
KEY_TITLE_ATTR_NAME_DEFAULT
Key for storing default value in newTitleAttributeNames(String, String[]) . |
static java.lang.String |
TYPE_SEGREGATED
|
Constructor Summary | |
---|---|
XmlPolicy()
|
Method Summary | |
---|---|
protected void |
cleanUpSegregated(DataNode tree)
After reading, clean up tree containing segregated text. |
protected boolean |
dataUsesAttributes()
When writing, does the data specify element attributes? |
XmlSpecifier[] |
fileSpecifiers()
|
protected ValueNode |
getTitleAttributeNames()
When reading or writing, maps attribute names to StatefulCore.title() s. |
protected boolean |
handleReadExceptions()
When reading, should read exceptions be thrown or handled? |
protected boolean |
isSegregated(DataNode node)
When writing, may identify segregated text. |
protected DataNode |
newSegregated(java.lang.String[] lines)
When reading, create a (possibly interim) node for segregated text. |
protected static ValueNode |
newTitleAttributeNames(java.lang.String defaultName,
java.lang.String[] mappings)
Creates mappings for return by getTitleAttributeNames() . |
protected java.lang.String |
prettifyRawXML(java.lang.String raw)
When writing, enhances readability of XML text. |
protected boolean |
segregateAll()
When reading, should text be segregated even where the containing element has no attributes? |
protected java.lang.String[] |
textToValueLines(java.lang.String text)
When reading, pre-process contents of XML text node. |
protected boolean |
titleAttributeKeyPairs()
When reading, should names be included with attributes exposed in StatefulCore.title() s? |
protected boolean |
treeAsXmlRoot()
After reading or before writing, is/should be tree rooted on the XML root node? |
protected static java.lang.String[] |
trimmedValueLines(java.lang.String text)
Utility method used by textToValueLines(String) . |
Methods inherited from class facets.util.Tracer |
---|
trace, trace, trace, trace, trace, traceDebug, traceDebug, traceObjectText, traceOutput, traceOutputWithClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TYPE_SEGREGATED
public static final java.lang.String KEY_TITLE_ATTR_NAME_DEFAULT
newTitleAttributeNames(String, String[])
.
Constructor Detail |
---|
public XmlPolicy()
Method Detail |
---|
public XmlSpecifier[] fileSpecifiers()
protected boolean treeAsXmlRoot()
Returning true
has the effect that
XmlDocRoot.readFromSource(Object)
and providing they have the same type,
the single child of tree
is replaced with its own contents.
XmlDocRoot.writeToSink(Object)
the XML root node is created from tree
false
by defaultprotected DataNode newSegregated(java.lang.String[] lines)
Default is invalid stub.
lines
- to be segregated, created by textToValueLines(String)
protected boolean segregateAll()
false
by defaultprotected void cleanUpSegregated(DataNode tree)
Default is invalid stub.
tree
- contains nodes created by newSegregated(String[])
protected boolean isSegregated(DataNode node)
false
unless node type is "_text"protected boolean dataUsesAttributes()
Return false
to avoid text segregation issues when writing.
true
by defaultprotected ValueNode getTitleAttributeNames()
StatefulCore.title()
s.
null
node created using
newTitleAttributeNames(String,String[])
; by default a minimal nodeprotected static ValueNode newTitleAttributeNames(java.lang.String defaultName, java.lang.String[] mappings)
getTitleAttributeNames()
.
defaultName
- attribute name to be mapped to StatefulCore.title()
in tags not specified by mappings
; may be emptymappings
- in format tagName=attName, where
TypedNode.type()
)
tagName
and will
be mapped to StatefulCore.title()
when reading or writing an element
protected boolean titleAttributeKeyPairs()
StatefulCore.title()
s?
false
by defaultprotected java.lang.String[] textToValueLines(java.lang.String text)
text
- from text node
TypedNode.values()
;
storing any non-empty array from an element with attributes will require
a valid implementation of newSegregated(String[])
.
Default returns trimmedValueLines(String)
.protected static java.lang.String[] trimmedValueLines(java.lang.String text)
textToValueLines(String)
.
protected java.lang.String prettifyRawXML(java.lang.String raw)
Called from XmlDocRoot.writeToSink(Object)
; default
breaks lines after tag ends and attribute pairs.
raw
- text returned by XmlDocRoot.newDocumentXml(Document)
protected boolean handleReadExceptions()
If handled, an ExceptionNode
is added to the tree.
true
by default
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |