Path to model

1. Path to the model

    The path of the model is the identification of the model, and a path corresponds to a model.

2. Representation of paths

2.1. The path to the model in the directory

    The path to the model is similar to the rules for Java packages. For example, in a Java project, the model is stored in the project's src/main/resources/ directory.

Model file: src/main/resources/HelloWorld.dml
The path is: HelloWorld

Model file: src/main/resources/org/xworker/HelloWorld.dml
The path is: org.xworker.HelloWorld

    Note: .dml is the suffix of the model file.

2.2.Model path of child nodes

    A model is a tree-structured data, a model can contain child nodes, and the child nodes of the model are also regarded as an independent model, and its path rules are the path of the parent model plus the model's own composed of IDs.

    For example the following model.

<HelloWorld>
    <ChildNode name="node1"/>
    <ChildNode/>
    <ChildNode name="node1" _xmeta_id_="node3"/>
</HelloWorld>

    Assuming that the HelloWorld model path is org.xworker.HelloWorld, the paths of its three child nodes are as follows.

The ID of the child node takes the name attribute by default, so the ID of the first child node is node1, and the path is as follows
org.xworker.HelloWorld/@node1

Since the second child node does not have a name attribute, the ID defaults to the name of the node, so the ID is ChildNode, and the path is as follows
org.xworker.HelloWorld/@ChildNode

The IDs of child nodes under a parent node cannot have the same ID. In this case, the _xmeta_id_ attribute can be used to define the ID, so the ID of the third node is node3, and the path is as follows
org.xworker.HelloWorld/@node3

2.3. Path rules for multi-level child nodes

    The path rule of the same child node is formed by adding its own ID to the path of the parent model.

    The following is a valid model path.

org.xworker.HelloWorld/@node1/@node2/@node3

 

Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号