Created
February 17, 2016 05:08
-
-
Save pallat/7f1f3a9eb1f9d9a43888 to your computer and use it in GitHub Desktop.
xml tag attr chardata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/xml" | |
"fmt" | |
"log" | |
) | |
type Password struct { | |
Type string `xml:"Type,attr"` | |
Data string `xml:",chardata"` | |
} | |
func main() { | |
password := Password{ | |
Type: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText", | |
Data: "1234IloveU", | |
} | |
b, err := xml.Marshal(&password) | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Println(string(b)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment