func xmlReadFile(filename string) (doc *xml.XmlDocument, err error) { data, err := ioutil.ReadFile(filename) if err != nil { return } doc, err = xml.Parse(data, xml.DefaultEncodingBytes, nil, xml.StrictParseOption, xml.DefaultEncodingBytes) return }
/* ParseXml parses an UTF-8 encoded byte array and returns an xml.XmlDocument. By default the parsing options ignore validation and suppress errors and warnings. This allows one to be liberal in accepting badly-formed documents, but is not standards-compliant. If the content is not UTF-8 encoded or you want to customize the parsing options, you should call the Parse or ReadFile functions found in the github.com/jbowtie/gokogiri/xml package. The xml.StrictParsingOption is conveniently provided for standards-compliant behaviour. */ func ParseXml(content []byte) (doc *xml.XmlDocument, err error) { return xml.Parse(content, xml.DefaultEncodingBytes, nil, xml.DefaultParseOption, xml.DefaultEncodingBytes) }