public class XmlCfg
extends java.lang.Object
XmlJzReader.readCfg(java.io.File)
from a given xml file.
<tag attr="!storepath" xmlinput:data="!getOrCreateCurrentOutputPath()">!contentStorePath(text) ... <subelements ....
DataAccess.DataPathElement
with invocation of DataAccess.storeValue(org.vishia.util.DataAccess.DatapathElement, Object, Object, boolean)
or DataAccess.invokeMethod(org.vishia.util.DataAccess.DatapathElement, Class, Object, boolean, boolean, Object[])
.
xmlinput:data
contains the path to get or create the output instance for this element
based on the current output instance.
<?xml version="1.0" encoding="utf-8"?> <xmlinput:root xmlns:xmlinput="www.vishia.org/XmlReader-xmlinput"> <xmlinput:subtree xmlinput:name="NAMESUBTREE"> ..... <xmlinput:cfg> ......
<xmlinput:subtree ...
contains some templates of sub trees which should be parsed in the user.xml.
Typically they are recursively sub trees.
<xmlinput:cfg ...
contains the configuration from the root node of the user.xml.
<tag attr="!@attr" .... xmlinput:data="!newInstance(attr)" >!storeText(text, attr)If the store path starts with
!@
then the attribute value of a given attr
is locally stored with a name (key) following after "!@...". It may be usual the same as the attribute name.
That stored attribute value can be used for the datapath-routine as argument to create the instance to store the data,
or to invoke the store routine for the text of the element.
If attribute values should be used as arguments for the xmlinput:data
routine, then no attribute values should be stored
with a storePath (attr="!storePath
). Both approaches are exclusively.
<tag attr="!CHECK"/> <tag attr="key1">!invoke1() <tag attr="key2">!invoke2()The first
<tag ...ATTR="!CHECK" ...>
designates this attribute to check it, use its value as key.
Any following <tag ...ATTR="..." ...>
builds a key with the tag, the attribute and the value
to search the proper config node with given data in user.xml. So they are different entries for the same tag but with different attribute values.
The key for this element is internally build with tag@attr="key1"@anotherAttr="itsKey"
<subtreeTag xmlinput:subtree="subtreeTag" xmlinput:data="!addmodule()"/>If a node
<subtreeTag ...
was found in the user.xml, then via xmlinput:subtree="subtreeTag"
the named
<xmlinput:subtree ....
is searched in the config file. That is used for sub nodes from this position.
Typically this is proper to use for recursively content in the user.xml. Then the sub tree contains a link to the same sub tree itself.
The config node above itself can contain more attributes but no content.
Modifier and Type | Class and Description |
---|---|
static class |
XmlCfg.AttribDstCheck
An instance of this class describes for any attribute how to proceed-
|
static class |
XmlCfg.XmlCfgNode
This class describes one node as pattern how the content of a parsed xml file should be stored.
|
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Map<java.lang.String,DataAccess.IntegerIx> |
attribNameVale |
(package private) XmlCfg.XmlCfgNode |
rootNode |
(package private) java.util.Map<java.lang.String,java.util.List<XmlCfg.XmlCfgNode>> |
subtreeForward
entries of usage of subtree instances which are defined later in the text.
|
(package private) java.util.Map<java.lang.String,XmlCfg.XmlCfgNode> |
subtrees
Configuration for subtrees which can occur anywhere in the XML file.
|
static java.lang.String |
version
Version, License and History: See
XmlJzReader . |
(package private) java.util.Map<java.lang.String,java.lang.String> |
xmlnsAssign
Assignment between nameSpace-value and nameSpace-alias gotten from the xmlns:ns="value" declaration in the read cfg.XML file.
|
Constructor and Description |
---|
XmlCfg() |
Modifier and Type | Method and Description |
---|---|
(package private) XmlCfg.XmlCfgNode |
addSubTree(java.lang.CharSequence name)
Invoked from
XmlCfg.XmlCfgNode.addSubTree(CharSequence) to execute for the whole configuration. |
(package private) void |
finishReadCfg(java.util.Map<java.lang.String,java.lang.String> namespaces) |
(package private) static XmlCfg |
newCfgCfg()
Creates the configuration to read a config.xml file.
|
void |
setCfgFromZml(java.io.File fin) |
(package private) void |
transferNamespaceAssignment(java.util.Map<java.lang.String,java.lang.String> src) |
public static final java.lang.String version
XmlJzReader
.
newCfgCfg()
also setContentStorePath(...) for the xmlinput:subtree node itself.
it is a special case, hence first not regarded, but possible and necessary.
Some sorting and comments there.
XmlCfg.XmlCfgNode.nameSpaceDef
to store namespace definitions in user data.
XmlCfg.XmlCfgNode.allArgNames
gets initial name, value, tag and text as unified for ReadCfgCfg and the used cfg
DataAccess
usage of variables.
XmlCfgNode#addFromSubtree(XmlCfgNode)
copies only not defined attributes from the subtree block definition.
hence the definition of an attribute in the call subtree line is prior to the attribute defined in the subtree.
subtreeForward
. It is possible that a definition in a subtree uses another subtree which is declared below.
The information from the subtree will be copied on end of reading config. finishReadCfg(Map)
(moved from XmlJzReader) does it.
XmlCfg.XmlCfgNode.subnodes
.
newCfgCfg()
more simple. Don't use the root node as config for root node.
#newCfgReadStruct()
accepts all XML structures, stores the structure of the nodes and attributes.
java.util.Map<java.lang.String,java.lang.String> xmlnsAssign
java.util.Map<java.lang.String,XmlCfg.XmlCfgNode> subtrees
java.util.Map<java.lang.String,java.util.List<XmlCfg.XmlCfgNode>> subtreeForward
finishReadCfg(Map)
.XmlCfg.XmlCfgNode rootNode
java.util.Map<java.lang.String,DataAccess.IntegerIx> attribNameVale
static XmlCfg newCfgCfg()
XmlCfg.XmlCfgNode addSubTree(java.lang.CharSequence name)
XmlCfg.XmlCfgNode.addSubTree(CharSequence)
to execute for the whole configuration.name
- void transferNamespaceAssignment(java.util.Map<java.lang.String,java.lang.String> src)
public void setCfgFromZml(java.io.File fin)
void finishReadCfg(java.util.Map<java.lang.String,java.lang.String> namespaces)