August 2019
Beginner to intermediate
798 pages
17h 2m
English
Go has support for XML, which is a markup language similar to HTML but much more advanced than HTML.
The developed utility, which is called rwXML.go, will read a JSON record from disk, make a change to it, convert it to XML, and print it on screen. Then it will convert the XML data into JSON. The related Go code will be presented in four parts.
The first part of rwXML.go is as follows:
package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"os"
)
type Record struct {
Name string
Surname string
Tel []Telephone
}
type Telephone struct {
Mobile bool
Number string
}
The second part of rwXML.go is shown in the following Go code:
func loadFromJSON(filename string, key interface{}) error { in, err := os.Open(filename) if err != ...Read now
Unlock full access