1
|
<?php
|
2
|
$ignoreTypes = array(
|
3
|
"doc:description" => true,
|
4
|
"doc:example" => true,
|
5
|
"doc:moduleDescription" => true,
|
6
|
"doc:moduleDocs" => true,
|
7
|
"doc:moduleName" => true,
|
8
|
"doc:recommendedUsage" => true,
|
9
|
"doc:standAlone" => true,
|
10
|
"doc:summary" => true,
|
11
|
"doc:tooltip" => true,
|
12
|
"xsd:annotation" => true,
|
13
|
"xsd:appinfo" => true,
|
14
|
"xsd:documentation" => true,
|
15
|
"xsd:import" => true,
|
16
|
"xsd:include" => true,
|
17
|
"xsd:schema" => true,
|
18
|
"AdditionalAbbreviations" => true,
|
19
|
"BacteriaStatus" => true,
|
20
|
"BioCodeStatus" => true,
|
21
|
"BotanyStatus" => true,
|
22
|
"li" => true,
|
23
|
"p" => true,
|
24
|
"para" => true,
|
25
|
"PreferredAbbreviation" => true,
|
26
|
"section" => true,
|
27
|
"Specification" => true,
|
28
|
"SuffixAlgae" => true,
|
29
|
"SuffixAnimalia" => true,
|
30
|
"SuffixBacteriae" => true,
|
31
|
"SuffixFungi" => true,
|
32
|
"SuffixFungi" => true,
|
33
|
"SuffixPlantae" => true,
|
34
|
"title" => true,
|
35
|
"ul" => true,
|
36
|
"ZoologyStatus" => true);
|
37
|
|
38
|
function isIgnoreType($nodeName) {
|
39
|
global $ignoreTypes;
|
40
|
return $ignoreTypes[$nodeName];
|
41
|
}
|
42
|
|
43
|
$files = array(
|
44
|
'eml-access.xsd',
|
45
|
'eml-coverage.xsd',
|
46
|
'eml-documentation.xsd',
|
47
|
'eml-literature.xsd',
|
48
|
'eml-party.xsd',
|
49
|
'eml-project.xsd',
|
50
|
'eml-resource.xsd',
|
51
|
'eml-text.xsd',
|
52
|
'tcsv101.xsd',
|
53
|
'tdwg_basetypes.xsd',
|
54
|
'tdwg_dw_element.xsd',
|
55
|
'tdwg_dw_geospatial.xsd',
|
56
|
'veg-misc.xsd',
|
57
|
'veg-organismobservation.xsd',
|
58
|
'veg-plotobservation.xsd',
|
59
|
'veg-plot.xsd');
|
60
|
|
61
|
|
62
|
function hasImportantNodes($node) {
|
63
|
$nodes = $node->getElementsbyTagName("*");
|
64
|
foreach($nodes as $node) {
|
65
|
$nodeName = preg_replace("/xs:/","xsd:",$node->nodeName);
|
66
|
if(!isIgnoreType($nodeName)) {
|
67
|
return true;
|
68
|
}
|
69
|
}
|
70
|
return false;
|
71
|
}
|
72
|
|
73
|
foreach($files as $file) {
|
74
|
$xmlDoc = new DOMDocument();
|
75
|
$xmlDoc->load($file);
|
76
|
$nodes = $xmlDoc->getElementsByTagName("*");
|
77
|
foreach($nodes as $node) {
|
78
|
$nodeName = preg_replace("/xs:/","xsd:",$node->nodeName);
|
79
|
if(!isIgnoreType($nodeName)) {
|
80
|
if($nodeName == 'xsd:element') { # || $nodeName == 'xsd:complexType') {
|
81
|
$attrName = $node->getAttribute('name');
|
82
|
if($attrName != '' && $node->getAttribute('type') == '') {
|
83
|
if(hasImportantNodes($node)) {
|
84
|
$poNodes = $node->getElementsByTagName("*");
|
85
|
print "$file: <$nodeName $attrName:\n ";
|
86
|
foreach($poNodes as $poNode) { print " " . $poNode->nodeName . "\n"; }
|
87
|
}
|
88
|
}
|
89
|
}
|
90
|
}
|
91
|
}
|
92
|
}
|
93
|
?>
|
94
|
|