add: 提交
This commit is contained in:
129
crontask/xml.go.org
Normal file
129
crontask/xml.go.org
Normal file
@@ -0,0 +1,129 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
const (
|
||||
// Header is a generic XML header suitable for use with the output of Marshal.
|
||||
// This is not automatically added to any output of this package,
|
||||
// it is provided as a convenience.
|
||||
Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
|
||||
)
|
||||
|
||||
type Attribute struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
Type string `xml:"type,attr"`
|
||||
Use string `xml:"use,attr"`
|
||||
}
|
||||
|
||||
type Schema struct {
|
||||
XMLName xml.Name `xml:"schema"`
|
||||
Text string `xml:",chardata"`
|
||||
Xs string `xml:"xs,attr"`
|
||||
Xsi string `xml:"xsi,attr"`
|
||||
ElementFormDefault string `xml:"elementFormDefault,attr"`
|
||||
AttributeFormDefault string `xml:"attributeFormDefault,attr"`
|
||||
Element struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
ComplexType struct {
|
||||
Text string `xml:",chardata"`
|
||||
Sequence struct {
|
||||
Text string `xml:",chardata"`
|
||||
Element []struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
MaxOccurs string `xml:"maxOccurs,attr"`
|
||||
ComplexType struct {
|
||||
Text string `xml:",chardata"`
|
||||
Sequence struct {
|
||||
Text string `xml:",chardata"`
|
||||
Element []struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
Type string `xml:"type,attr"`
|
||||
MinOccurs string `xml:"minOccurs,attr"`
|
||||
ComplexType struct {
|
||||
Text string `xml:",chardata"`
|
||||
Sequence struct {
|
||||
Text string `xml:",chardata"`
|
||||
MinOccurs string `xml:"minOccurs,attr"`
|
||||
MaxOccurs string `xml:"maxOccurs,attr"`
|
||||
Element struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
ComplexType struct {
|
||||
Text string `xml:",chardata"`
|
||||
SimpleContent struct {
|
||||
Text string `xml:",chardata"`
|
||||
Extension struct {
|
||||
Text string `xml:",chardata"`
|
||||
Base string `xml:"base,attr"`
|
||||
Attribute struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
Type string `xml:"type,attr"`
|
||||
Use string `xml:"use,attr"`
|
||||
} `xml:"attribute"`
|
||||
} `xml:"extension"`
|
||||
} `xml:"simpleContent"`
|
||||
Sequence struct {
|
||||
Text string `xml:",chardata"`
|
||||
MinOccurs string `xml:"minOccurs,attr"`
|
||||
MaxOccurs string `xml:"maxOccurs,attr"`
|
||||
Element struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
ComplexType struct {
|
||||
Text string `xml:",chardata"`
|
||||
SimpleContent struct {
|
||||
Text string `xml:",chardata"`
|
||||
Extension struct {
|
||||
Text string `xml:",chardata"`
|
||||
Base string `xml:"base,attr"`
|
||||
Attribute struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
Type string `xml:"type,attr"`
|
||||
Use string `xml:"use,attr"`
|
||||
} `xml:"attribute"`
|
||||
} `xml:"extension"`
|
||||
} `xml:"simpleContent"`
|
||||
} `xml:"complexType"`
|
||||
} `xml:"element"`
|
||||
} `xml:"sequence"`
|
||||
Attribute []struct {
|
||||
Text string `xml:",chardata"`
|
||||
Name string `xml:"name,attr"`
|
||||
Type string `xml:"type,attr"`
|
||||
Use string `xml:"use,attr"`
|
||||
} `xml:"attribute"`
|
||||
} `xml:"complexType"`
|
||||
} `xml:"element"`
|
||||
} `xml:"sequence"`
|
||||
} `xml:"complexType"`
|
||||
} `xml:"element"`
|
||||
} `xml:"sequence"`
|
||||
} `xml:"complexType"`
|
||||
} `xml:"element"`
|
||||
} `xml:"sequence"`
|
||||
} `xml:"complexType"`
|
||||
} `xml:"element"`
|
||||
}
|
||||
|
||||
func GenNRMXmlFile() {
|
||||
nrmFile := Schema{
|
||||
Xs: "http://www.w3.org/2001/XMLSchema",
|
||||
Xsi: "http://www.w3.org/2001/XMLSchema-instance",
|
||||
ElementFormDefault: "qualified",
|
||||
AttributeFormDefault: "unqualified",
|
||||
Element: struct{}{Name: "DataFile"},
|
||||
}
|
||||
|
||||
b, _ := xml.MarshalIndent(nrmFile, "", " ")
|
||||
b = append([]byte(xml.Header), b...)
|
||||
ioutil.WriteFile("D:/nrm-demo.xml", b, 0664)
|
||||
}
|
||||
Reference in New Issue
Block a user