Created
October 19, 2022 20:45
-
-
Save jessepeterson/b5fe3fb77c77266a647c889c84a103d8 to your computer and use it in GitHub Desktop.
Invalid XML for plist ... successful?
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 ( | |
"fmt" | |
"log" | |
"github.com/groob/plist" | |
) | |
const cmdPlist = `C "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Command</key> | |
<dict> | |
<key>RequestType</key> | |
<string>DeviceInformation</string> | |
</dict> | |
<key>CommandUUID</key> | |
<string>a84bb3f9-c3a0-47e2-af01-7c053abedba6</string> | |
</dict> | |
</plist>` | |
type Cmd struct { | |
Command struct { | |
RequestType string | |
} | |
CommandUUID string | |
} | |
func main() { | |
c := new(Cmd) | |
if err := plist.Unmarshal([]byte(cmdPlist), c); err == nil { | |
fmt.Println(c.CommandUUID, c.Command.RequestType) | |
} else { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output of running this:
I.e. successfully parses it.