1package mxj 2 3import ( 4 "fmt" 5 "testing" 6) 7 8func TestNamespaceHeader(t *testing.T) { 9 fmt.Println("\n---------------- namespace_test.go ...") 10} 11 12func TestBeautifyXml(t *testing.T) { 13 fmt.Println("\n---------------- TestBeautifyXml ...") 14 const flatxml = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://example.com/ns"><soapenv:Header/><soapenv:Body><ns:request><ns:customer><ns:id>123</ns:id><ns:name type="NCHZ">John Brown</ns:name></ns:customer></ns:request></soapenv:Body></soapenv:Envelope>` 15 v, err := BeautifyXml([]byte(flatxml), "", " ") 16 if err != nil { 17 t.Fatal(err) 18 } 19 fmt.Println(flatxml) 20 fmt.Println(string(v)) 21} 22