1 | <?php |
||
15 | class Parser |
||
16 | { |
||
17 | /** |
||
18 | * @const String NODE_NODENAME : a constant with the name of the XML node with data to store. |
||
19 | */ |
||
20 | const NODE_NODENAME = 'node'; |
||
21 | /** |
||
22 | * @var Array $nodeAvailableAttributes : list of available attributes in XML tag NODE_NODENAME. |
||
23 | */ |
||
24 | private static $nodeAvailableAttributes = [ |
||
25 | 'ID' => 'id', |
||
26 | 'COLOR' => 'color', |
||
27 | 'CREATED' => 'created', |
||
28 | 'MODIFIED' => 'modified', |
||
29 | 'POSITION' => 'position', |
||
30 | 'VSHIFT' => 'vshift', |
||
31 | 'FOLDED' => 'folded', |
||
32 | 'TEXT' => 'text', |
||
33 | ]; |
||
34 | /** |
||
35 | * @const String FONT_NODENAME : a constant with the name of the XML node with data to store for font matter. |
||
36 | */ |
||
37 | const FONT_NODENAME = 'font'; |
||
38 | /** |
||
39 | * @var Array $fontAvailableAttributes : list of available attributes in XML tag FONT_NODENAME. |
||
40 | */ |
||
41 | private static $fontAvailableAttributes = [ |
||
42 | 'NAME' => 'fontName', |
||
43 | 'SIZE' => 'fontSize', |
||
44 | 'BOLD' => 'bold', |
||
45 | 'ITALIC' => 'italic', |
||
46 | ]; |
||
47 | /** |
||
48 | * @const String ICON_NODENAME : a constant with the name of the XML node with data to store for icon matter. |
||
49 | */ |
||
50 | const ICON_NODENAME = 'icon'; |
||
51 | /** |
||
52 | * @var Array $iconAvailableAttributes : list of available attributes in XML tag ICON_NODENAME. |
||
53 | */ |
||
54 | private static $iconAvailableAttributes = [ |
||
55 | 'BUILTIN' => 'icon', |
||
56 | ]; |
||
57 | |||
58 | /** |
||
59 | * Build the document tree (all objects) out of the file given in parameter. |
||
60 | * |
||
61 | * @param String $filePath : The path to the openMind file. |
||
62 | * |
||
63 | * @return Document : The document instance with all its nodes instances. |
||
64 | */ |
||
65 | public function buildDocumentTreeFromFilePath($filePath) { |
||
78 | |||
79 | /** |
||
80 | * Create and fill the node instance with all the data stored in the XML file |
||
81 | * |
||
82 | * @param DOMElement $domNode : The current XML 'node' element to build the Node object. |
||
83 | * |
||
84 | * @return Node : The created Node (and all its children). |
||
85 | */ |
||
86 | private function fillNode(DOMElement $domNode) { |
||
116 | |||
117 | /** |
||
118 | * For each attribute whom the name is the keys of $availableAttributes, its value will be put in the matching attribute. |
||
119 | * |
||
120 | * @param DOMNamedNodeMap $nodeAtributes : The list of attributes of the current node to fill the Node object. |
||
121 | * @param array $availableAttributes : One of the static array of this class to describe the list of known attributes. |
||
122 | * @param Node $node : The Node object to fill in. |
||
123 | */ |
||
124 | private function fillNodeAttributes (DOMNamedNodeMap $nodeAtributes, array $availableAttributes, Node $node) { |
||
136 | } |