This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
TODO
92 lines (75 loc) · 3.2 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
* Support for verifying that the removal of a node would yield a valid
structure.
* Support for verifying that the addition of a node would yield a
valid structure.
* Support for context-invariant validations, which should reduce
memory usage, help editors be more user friendly and possibly be
faster generally.
Context Independence
==================
An element is context-independent if the schema does not allow its
structure to vary depending on where it appears in the document being
validated.
An element E is context-independent relative to another element C which
is its parent or preceding sibling if, given that E is a child of C or
a sibling of C makes it so that E can only have one structure.
Shallow validation: A shallow validation of element E is one which
walks the children nodes of E to ascertain that the structure of E is
correct but assumes that the children of E are internally valid.
A document which contains only context-independent elements can be
validated by shallowly validating all its elements in any order.
A document which contains a mixture of context-independent elements can
be validated as follows:
While there are elements not validated:
For each not-validated element E:
If E is context-independent OR E has a definition associated with it:
For each child node C:
Check that C fits E's structure but do not descend into C. (Shallow validation of E.)
If C is not context-independent:
If C is relatively context-independent:
Associate C with the definition required by context.
Else:
# Is this possible??? It seems to me that E would
# also have to be variant or have no definition associated with it
# for this to happen.
Remove E from the set of non-validated elements
# Else we skip it
The algorithm above, if correct should empty the set of non-validated
elements. If not, there's an error in the algorithm.
Fake Dependence
===============
<choice>
<element name="person">
<attribute name="first-name"/>
<attribute name="last-name"/>
</element>
<element name="person">
<element name="first-name"><text/></element>
<element name="last-name"><text/></element>
</element>
</choice>
I call the pattern above fake variance because it is equivalent to:
<element name="person">
<choice>
<group>
<attribute name="first-name"/>
<attribute name="last-name"/>
</group>
<group>
<element name="first-name"><text/></element>
<element name="last-name"><text/></element>
</group>
</choice>
</element>
The choice is not really between two differently structured "person"
elements but between two contents for "person".
* Dump xml_path as variable.
* Add a Start class to validate deriving from Pattern which will
hold the start pattern. (Instead of the current system in which
there is no Pattern corresponding to <start>.
* Make xml_path be computed dynamically by joining the path
information of a given element with the path information of its
parent. (Cache it for performance.)
* Since this is a variable used for debugging, then the cost of
computing these will be born during debugging but not otherwise.
* Handle the util.inspect replacement better.