XML/DOM serialization: Difference between revisions

Go solution
(Go solution)
Line 272:
type cr
[THEN]</lang>
 
=={{header|Go}}==
{{libheader|bitbucket.org/rj/xmldom-go}}
A partial solution based on an incomplete library. The library is missing functions needed to create a DOM piece by piece like other other solutions here. It can however create a DOM by parsing XML. Also, it lacks a function to access the processing instruction, so not surprisingly this is missing from the serialized output.
<lang go>package main
 
import (
"fmt"
dom "bitbucket.org/rj/xmldom-go"
)
 
func main() {
d, err := dom.ParseStringXml(`
<?xml version="1.0" ?>
<root>
<element>
Some text here
</element>
</root>`)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(d.ToXml()))
}</lang>
{{out}}
<lang xml><root>
<element>
Some text here
</element>
</root></lang>
 
=={{header|Groovy}}==
1,707

edits