modified: src/document.go

This commit is contained in:
jim teeuwen 2009-11-23 17:50:29 +01:00
parent aa1df539c3
commit e0fdc48cf7
1 changed files with 4 additions and 1 deletions

View File

@ -55,6 +55,7 @@ type Document struct {
StandAlone string; StandAlone string;
SaveDocType bool; SaveDocType bool;
Root *Node; Root *Node;
Entity map[string]string;
} }
func New() *Document { func New() *Document {
@ -63,6 +64,7 @@ func New() *Document {
Encoding: "utf-8", Encoding: "utf-8",
StandAlone: "yes", StandAlone: "yes",
SaveDocType: true, SaveDocType: true,
Entity: make(map[string]string)
} }
} }
@ -71,7 +73,6 @@ func (this *Document) String() string {
return s; return s;
} }
func (this *Document) SelectNode(namespace, name string) *Node { func (this *Document) SelectNode(namespace, name string) *Node {
return this.Root.SelectNode(namespace, name); return this.Root.SelectNode(namespace, name);
} }
@ -85,6 +86,8 @@ func (this *Document) SelectNodes(namespace, name string) []*Node {
// ***************************************************************************** // *****************************************************************************
func (this *Document) LoadString(s string) (err os.Error) { func (this *Document) LoadString(s string) (err os.Error) {
xp := xml.NewParser(strings.NewReader(s)); xp := xml.NewParser(strings.NewReader(s));
xp.Entity = this.Entity;
this.Root = NewNode(NT_ROOT); this.Root = NewNode(NT_ROOT);
ct := this.Root; ct := this.Root;