17 |
q<http://www.w3.org/1998/Math/MathML> => 'math', |
q<http://www.w3.org/1998/Math/MathML> => 'math', |
18 |
q<http://www.w3.org/1999/xlink> => 'xlink', |
q<http://www.w3.org/1999/xlink> => 'xlink', |
19 |
q<http://www.w3.org/XML/1998/namespace> => 'xml', |
q<http://www.w3.org/XML/1998/namespace> => 'xml', |
20 |
q<http://www.w3.org/2002/xmlns/> => 'xmlns', |
q<http://www.w3.org/2000/xmlns/> => 'xmlns', |
21 |
}; |
}; |
22 |
|
|
23 |
my @node = map { [$_, ''] } @{$node->child_nodes}; |
my @node = map { [$_, ''] } @{$node->child_nodes}; |
69 |
} |
} |
70 |
$r .= ">\x0A"; |
$r .= ">\x0A"; |
71 |
unshift @node, |
unshift @node, |
72 |
map { [$_, $child->[1] . ' '] } @{$child->[0]->child_nodes}; |
map { [$_, $child->[1] . ' '] } |
73 |
|
sort { $a->node_name cmp $b->node_name } |
74 |
|
values %{$child->[0]->element_types}; |
75 |
|
unshift @node, |
76 |
|
map { [$_, $child->[1] . ' '] } |
77 |
|
sort { $a->node_name cmp $b->node_name } |
78 |
|
values %{$child->[0]->entities}; |
79 |
|
unshift @node, |
80 |
|
map { [$_, $child->[1] . ' '] } |
81 |
|
sort { $a->node_name cmp $b->node_name } |
82 |
|
values %{$child->[0]->notations}; |
83 |
|
unshift @node, |
84 |
|
map { [$_, $child->[1] . ' '] } @{$child->[0]->child_nodes}; |
85 |
} elsif ($nt == $child->[0]->PROCESSING_INSTRUCTION_NODE) { |
} elsif ($nt == $child->[0]->PROCESSING_INSTRUCTION_NODE) { |
86 |
$r .= $child->[1] . '<?' . $child->[0]->target . ' '; |
$r .= $child->[1] . '<?' . $child->[0]->target . ' '; |
87 |
$r .= $child->[0]->data . "?>\x0A"; |
$r .= $child->[0]->data . "?>\x0A"; |
88 |
|
} elsif ($nt == $child->[0]->ENTITY_NODE) { |
89 |
|
$r .= $child->[1] . '<!ENTITY ' . $child->[0]->node_name . ' "'; |
90 |
|
$r .= $child->[0]->public_id if defined $child->[0]->public_id; |
91 |
|
$r .= '" "'; |
92 |
|
$r .= $child->[0]->system_id if defined $child->[0]->system_id; |
93 |
|
$r .= '" '; |
94 |
|
$r .= $child->[0]->notation_name if defined $child->[0]->notation_name; |
95 |
|
$r .= ">\x0A"; |
96 |
|
unshift @node, |
97 |
|
map { [$_, $child->[1] . ' '] } @{$child->[0]->child_nodes}; |
98 |
|
} elsif ($nt == $child->[0]->NOTATION_NODE) { |
99 |
|
$r .= $child->[1] . '<!NOTATION ' . $child->[0]->node_name . ' "'; |
100 |
|
$r .= $child->[0]->public_id if defined $child->[0]->public_id; |
101 |
|
$r .= '" "'; |
102 |
|
$r .= $child->[0]->system_id if defined $child->[0]->system_id; |
103 |
|
$r .= qq[">\x0A]; |
104 |
|
} elsif ($nt == $child->[0]->ELEMENT_TYPE_DEFINITION_NODE) { |
105 |
|
$r .= $child->[1] . '<!ELEMENT ' . $child->[0]->node_name . ' '; |
106 |
|
$r .= $child->[0]->content_model_text; |
107 |
|
$r .= ">\x0A"; |
108 |
|
unshift @node, |
109 |
|
map { [$_, $child->[1] . ' '] } |
110 |
|
sort { $a->node_name cmp $b->node_name } |
111 |
|
values %{$child->[0]->attribute_definitions}; |
112 |
|
} elsif ($nt == $child->[0]->ATTRIBUTE_DEFINITION_NODE) { |
113 |
|
$r .= $child->[1] . $child->[0]->node_name . ' '; |
114 |
|
$r .= [ |
115 |
|
0, 'CDATA', 'ID', 'IDREF', 'IDREFS', 'ENTITY', 'ENTITIES', |
116 |
|
'NMTOKEN', 'NMTOKENS', 'NOTATION', 'ENUMERATION', 11, |
117 |
|
]->[$child->[0]->declared_type] || $child->[0]->declared_type; |
118 |
|
if ($child->[0]->declared_type == 9 or |
119 |
|
$child->[0]->declared_type == 10) { |
120 |
|
$r .= '(' . join ('|', @{$child->[0]->allowed_tokens}) . ')'; |
121 |
|
} |
122 |
|
$r .= ' '; |
123 |
|
$r .= [ |
124 |
|
0, 'FIXED', 'REQUIRED', 'IMPLIED', 'EXPLICIT', |
125 |
|
]->[$child->[0]->default_type] || $child->[0]->default_type; |
126 |
|
if ($child->[0]->default_type == 1 or |
127 |
|
$child->[0]->default_type == 4) { |
128 |
|
$r .= ' "' . $child->[0]->text_content . '"'; |
129 |
|
} |
130 |
|
$r .= "\x0A"; |
131 |
} else { |
} else { |
132 |
$r .= $child->[1] . $child->[0]->node_type . "\x0A"; # error |
$r .= $child->[1] . $child->[0]->node_type . "\x0A"; # error |
133 |
} |
} |