go get -u github.com/jackal-xmpp/stravaganza
package main
import (
"fmt"
"os"
"github.com/jackal-xmpp/stravaganza"
)
func main() {
iq, err := stravaganza.NewBuilder("iq").
WithValidateJIDs(true).
WithAttribute("id", "zid615d9").
WithAttribute("from", "[email protected]/yard").
WithAttribute("to", "[email protected]/balcony").
WithAttribute("type", "get").
WithChild(
stravaganza.NewBuilder("ping").
WithAttribute("xmlns", "urn:xmpp:ping").
Build(),
).
BuildIQ()
if err != nil {
_, _ = fmt.Fprint(os.Stderr, err.Error())
return
}
_ = iq.ToXML(os.Stdout, true)
}
Expected output:
<iq id='zid615d9' from='[email protected]/yard' to='[email protected]/balcony' type='get'><ping xmlns='urn:xmpp:ping'/></iq>
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request