Пример #1
0
func main() {
	m, err := mxj.NewMapXml(data)
	if err != nil {
		fmt.Println("err:", err)
	}
	fmt.Println(m.StringIndentNoTypeInfo())

	doc, err := m.XmlIndent("", "  ")
	if err != nil {
		fmt.Println("err:", err)
	}
	fmt.Println(string(doc))

	val, err := m.ValuesForKey("child1")
	if err != nil {
		fmt.Println("err:", err)
	}
	fmt.Println("val:", val)

	mxj.XmlGoEmptyElemSyntax()
	doc, err = mxj.AnyXmlIndent(val, "", "  ", "child1")
	if err != nil {
		fmt.Println("err:", err)
	}
	fmt.Println(string(doc))
}
Пример #2
0
func confAmq(
	amqConfPath string,
	confPolicyEntry string,
	confLevelDB string) string {

	xmlStr := gd.StrFromFilePath(amqConfPath)
	xmlMap, _ := mxj.NewMapXml([]byte(xmlStr))

	step := Step{&xmlMap}

	// flow
	(&step).
		SetJvmHeap("80").
		RemoveLogQuery().
		InsertPolicyEntry(confPolicyEntry).
		RemoveKahadb().
		AddLevelDB(confLevelDB).
		FixAmpersand().
		FixColonKey()
	// dd(xmlMap)

	resultBytes, _ := mxj.AnyXmlIndent(
		xmlMap["beans"], "", "  ", "beans")
	r := gd.BytesToString(resultBytes)

	return r
}
Пример #3
0
func confJetty(jettyConfPath string, portValue string) string {
	xmlStr := gd.StrFromFilePath(jettyConfPath)
	// pln(xmlStr)
	xmlMap, _ := mxj.NewMapXml([]byte(xmlStr))
	// dd(xmlMap)
	// pln(typeof(xmlMap))

	step := Step{&xmlMap}
	(&step).
		SetJettyPort(portValue).
		FixColonKey()
	// dd(xmlMap)

	resultBytes, _ := mxj.AnyXmlIndent(xmlMap["beans"], "", "  ", "beans")
	r := gd.BytesToString(resultBytes)
	return r
}