nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
readme: add information section
[nit.git]
/
lib
/
dom
/
xml_entities.nit
diff --git
a/lib/dom/xml_entities.nit
b/lib/dom/xml_entities.nit
index
67dc4ac
..
8aa4f6b
100644
(file)
--- a/
lib/dom/xml_entities.nit
+++ b/
lib/dom/xml_entities.nit
@@
-46,6
+46,7
@@
abstract class XMLEntity
# Sets the parent of `self` to `e`
fun parent=(e: XMLEntity) do
# Sets the parent of `self` to `e`
fun parent=(e: XMLEntity) do
+ var parent = self.parent
if parent != null then
parent.children.remove(self)
end
if parent != null then
parent.children.remove(self)
end
@@
-60,7
+61,7
@@
private class XMLEntities
# The owner, aka, the parent
var owner: XMLEntity
# The owner, aka, the parent
var owner: XMLEntity
- private var entities = new List[XMLEntity]
+ var entities = new List[XMLEntity]
redef fun length do return entities.length
redef fun length do return entities.length
@@
-68,8
+69,9
@@
private class XMLEntities
redef fun []=(index, el) do
var olde = self[index]
redef fun []=(index, el) do
var olde = self[index]
- if olde.parent != null then
- olde.parent.children.remove(el)
+ var olde_parent = olde.parent
+ if olde_parent != null then
+ olde_parent.children.remove(el)
end
entities[index] = el
el.set_parent owner
end
entities[index] = el
el.set_parent owner
@@
-198,6
+200,7
@@
class XMLStartTag
end
s += ">"
for i in children do s += i.to_s
end
s += ">"
for i in children do s += i.to_s
+ var matching = self.matching
if matching != null then s += matching.to_s
return s
end
if matching != null then s += matching.to_s
return s
end
@@
-214,6
+217,7
@@
end
class XMLProcessingInstructionTag
super XMLTag
class XMLProcessingInstructionTag
super XMLTag
+ # Raw content usable by the third-party application
var content: String
redef fun to_s do return "<?{tag_name} {content}?>"
var content: String
redef fun to_s do return "<?{tag_name} {content}?>"
@@
-240,6
+244,7
@@
end
class XMLDoctypeTag
super XMLTag
class XMLDoctypeTag
super XMLTag
+ # Raw content
var content: String
redef fun to_s do return "<!DOCTYPE {content}>"
var content: String
redef fun to_s do return "<!DOCTYPE {content}>"
@@
-294,5
+299,12
@@
class XMLError
# Error message reported by the parser
var message: String
# Error message reported by the parser
var message: String
- redef fun to_s do return "XML Error: {message} at {location.to_s}"
+ redef fun to_s do
+ var l = self.location
+ if l == null then
+ return "XML Error: {message}"
+ else
+ return "XML Error: {message} at {l}"
+ end
+ end
end
end