DIC file structure
Node level
Dictionary file store hierarchy data (like xml). We use tab character (ASCII #9) to determine node level.
For example, xml data:
<root>
<node>
<childNode value="ABC" />
</node>
</root>
Can be transformed to dictionary data as following:
root
node
childNode==ABC
Node declaration
Each node in dictionary file can contain name and value and children nodes. Node can be decalred in following forms:
- Short form: recommended to store value with length < 128 character
- Syntax:
NodeName==NodeValue
- Example:
MESSAGE==Happy new year.\nBest wish for you.
- Notice:
- Node name may contain any character except following
- Equals symbol ('=')
- CR, LF character (ASCII #13 & ASCII #10)
- TAB symbol (ASCII #9)
- Node value may be escaped using slash symbol ('\'). The escape rule is followed java escape rule. For example tab symbol can be escaped as \t, LF can be escaped by \n, unicode character can be escaped as \uXXXX… It may contain any character, but following characters must be escaped
- CR, LF character (ASCII #13 & ASCII #10)
- TAB symbol (ASCII #9)
- Node name may contain any character except following
- Long form: recommended to store value with length >= 128 character
- Syntax:
NodeName=:
:{
NodeValue
:}
- Example:
MESSAGE=:
:{
Happy new year.
Best wish for you.
:}
- Notice:
- Node name may contain any character except following
- Equals symbol ('=')
- CR, LF character (ASCII #13 & ASCII #10)
- TAB symbol (ASCII #9)
- Node value may contain any character, no need to escape.
- Node name may contain any character except following
- Reference form: recommended when a node occurred multiple times in file
- Syntax:
OriginNode
OriginChildNode
OriginGrandChildNode
Ref1=>OriginNode
Ref2=>OriginNode.OriginChildNode
Scripting
In WAK application, if node value start with '!' symbol, it will be treated as javascript code and executed on the fly.
For example, the xml data
<root>
<node>
<childNode value="ABC" />
</node>
</root>
Can be rewrited as using script as following
root
node
childNode==!return "ABC"