few more hints for the future on how to use etree
This commit is contained in:
parent
b668476c47
commit
71c0046807
10
cmd/build.go
10
cmd/build.go
|
@ -61,12 +61,16 @@ should be enough for the next successful build).`,
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
root := doc.SelectElement("rdf:RDF")
|
root := doc.SelectElement("rdf:RDF")
|
||||||
for _, z := range root.FindElements("[link:type]") {
|
for _, z := range root.FindElements("[name()='link:type']") {
|
||||||
doc := etree.NewDocument()
|
doc := etree.NewDocument()
|
||||||
doc.SetRoot(z.Copy())
|
doc.SetRoot(z.Parent().Copy())
|
||||||
|
if z.Text() != "application/pdf" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fmt.Println(z.Text())
|
||||||
fmt.Println("~ ~ ~ ~")
|
fmt.Println("~ ~ ~ ~")
|
||||||
fmt.Println(doc.WriteTo(os.Stdout))
|
fmt.Println(doc.WriteTo(os.Stdout))
|
||||||
elm := root.FindElement(fmt.Sprintf("[@rdf:resource='%s']", z.SelectAttr("rdf:about").Value))
|
elm := root.FindElement(fmt.Sprintf("[@rdf:resource='%s']", z.Parent().SelectAttr("rdf:about").Value))
|
||||||
doc.SetRoot(elm.Parent().Copy())
|
doc.SetRoot(elm.Parent().Copy())
|
||||||
fmt.Println("+++++")
|
fmt.Println("+++++")
|
||||||
fmt.Println(doc.WriteTo(os.Stdout))
|
fmt.Println(doc.WriteTo(os.Stdout))
|
||||||
|
|
Loading…
Reference in New Issue