Hello Gophers,
I am trying to convert a java application to Go. The basic workflow is as:
1. Read an XML file in DOM document
2. Modify nodes / attributes by finding them with Xpath
3. Convert back DOM document in XML stream / string
4. Send XML over the http.
So I checked following approaches:
I checked 'encoding/xml' package It seems to me that I need to fully define structs for XML document to unmarshal and modify a particular node or attribute.
OR
First approach would work fine but there are like ~20 types of atrociously designed XML files. So it will take long time to write structs for all to unmarshal
In second approach I could not find way to convert *xmlpath.Node back XML stream / string.
Any insight on how to solve this problem in Go is appreciated.
Thanks