zenith391/vwxml

Integrate with radare.toxml

Opened this issue · 2 comments

I think it will be interesting to join efforts and combine your deserializer with my serializer, so we can reuse tests and reuse common functions and such.

I also think that it will be good to have a stream support like sax.

Example: https://github.com/radare/v-toxml/blob/master/examples/fromvwxml.v

import toxml // serialize
import zenith391.vwxml.xml // deserialize

fn walk_into(toxml &toxml.Toxml, node &xml.Node) {
        for t in node.childrens {
		mut attrs := map[string]string{}
                for a in t.attributes {
			attrs[a.name] = a.value
                }
		toxml.open(t.name, attrs)
		toxml.body(t.text)
		walk_into(toxml, &t)
		toxml.close()
        }
}

fn main() {
        node := xml.parse('<thing abc="test"><test>Hello</test><test uid="123">World</test></thing>')
	out := toxml.new()
	walk_into(out, node)
	res := out.str()
	println('$res')
	
}

ping?