
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
github.com/tranchida/xmldom-parser
forked from Rodion-Bozhenko/xmldom-parser
add AppendChildBefore
XML DOM processing for Golang, supports xpath query
$ go get github.com/tranchida/xmldom-parser
xml := `<testsuite tests="2" failures="0" time="0.009" name="github.com/tranchida/xmldom-parser">
<testcase classname="xmldom-parser" name="ExampleParseXML" time="0.004"></testcase>
<testcase classname="xmldom-parser" name="ExampleParse" time="0.005"></testcase>
</testsuite>`
doc := xmldom.Must(xmldom.ParseXML(xml))
root := doc.Root
name := root.GetAttributeValue("name")
time := root.GetAttributeValue("time")
fmt.Printf("testsuite: name=%v, time=%v\n", name, time)
for _, node := range root.GetChildren("testcase") {
name := node.GetAttributeValue("name")
time := node.GetAttributeValue("time")
fmt.Printf("testcase: name=%v, time=%v\n", name, time)
}
// find all children
fmt.Printf("children = %v\n", len(node.Query("//*")))
// find node matched tag name
nodeList := node.Query("//testcase")
for _, c := range nodeList {
fmt.Printf("%v: name = %v\n", c.Name, c.GetAttributeValue("name"))
}
// find node matched attr name
c := node.QueryOne("//testcase[@name='ExampleParseXML']")
fmt.Printf("%v: name = %v\n", c.Name, c.GetAttributeValue("name"))
doc := xmldom.NewDocument("testsuites")
suiteNode := doc.Root.CreateNode("testsuite").SetAttributeValue("name", "github.com/tranchida/xmldom-parser")
suiteNode.CreateNode("testcase").SetAttributeValue("name", "case 1")
suiteNode.CreateNode("testcase").SetAttributeValue("name", "case 2")
fmt.Println(doc.XML())
xmldom-parser
is released under the Apache 2.0 license. See LICENSE
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.