Skip to content

Commit

Permalink
use fmt.Fprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
egginabucket committed Mar 7, 2023
1 parent 3a3a048 commit 847b2f6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ func outputXML(b *strings.Builder, n *Node, preserveSpaces bool, config *outputC
if n.Prefix == "" {
b.WriteString("<" + n.Data)
} else {
b.WriteString("<" + n.Prefix + ":" + n.Data)
fmt.Fprintf(b, "<%s:%s", n.Prefix, n.Data)
}
}

for _, attr := range n.Attr {
if attr.Name.Space != "" {
b.WriteString(fmt.Sprintf(` %s:%s=`, attr.Name.Space, attr.Name.Local))
fmt.Fprintf(b, ` %s:%s=`, attr.Name.Space, attr.Name.Local)
} else {
b.WriteString(fmt.Sprintf(` %s=`, attr.Name.Local))
fmt.Fprintf(b, ` %s=`, attr.Name.Local)
}
b.WriteByte('"')
b.WriteString(html.EscapeString(attr.Value))
Expand All @@ -169,9 +169,9 @@ func outputXML(b *strings.Builder, n *Node, preserveSpaces bool, config *outputC
}
if n.Type != DeclarationNode {
if n.Prefix == "" {
b.WriteString(fmt.Sprintf("</%s>", n.Data))
fmt.Fprintf(b, "</%s>", n.Data)
} else {
b.WriteString(fmt.Sprintf("</%s:%s>", n.Prefix, n.Data))
fmt.Fprintf(b, "</%s:%s>", n.Prefix, n.Data)
}
}
}
Expand Down

0 comments on commit 847b2f6

Please sign in to comment.