Generic XML Unmarshal

I am creating a system that must be able to parse any data and attempt to map it to a database.

The problem I am having is getting to read generic XML files.
With JSON, I am able to accomplish this with:

var obj interface{}
err := json.Unmarshal([]byte(text), &obj)

This returns a populated map with the data, but when I try something similar with XML, I get nil data returned in obj:

var obj interface{}
err := xml.Unmarshal([]byte(text), &obj)

How can I get a map of the data from an XML file without knowing the structure of the data?

Thanks Charles, I’ll are a look

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.