Copy disabled (too large)
Download .txt
Showing preview only (37,777K chars total). Download the full file to get everything.
Repository: metaleap/go-xsd
Branch: master
Commit: 61f7638f502f
Files: 53
Total size: 71.3 MB
Directory structure:
gitextract__7bfnx83/
├── LICENSE.md
├── README.md
├── elem.go
├── elemmakepkg.go
├── elemparents.go
├── hasattr.go
├── haselem.go
├── hasmakepkg.go
├── hasparents.go
├── makepkg.go
├── types/
│ ├── README.md
│ ├── doc.go
│ └── xsdtypes.go
├── xsd-makepkg/
│ ├── main.go
│ └── tests/
│ ├── README.md
│ ├── doc.go
│ ├── tests.go
│ ├── xsd-test-atom/
│ │ ├── feed/
│ │ │ ├── infiles/
│ │ │ │ └── samplefeed.xml
│ │ │ └── outfiles/
│ │ │ └── samplefeed.xml
│ │ └── main.go
│ ├── xsd-test-collada/
│ │ ├── 1.4.1/
│ │ │ ├── infiles/
│ │ │ │ ├── berlin.dae
│ │ │ │ ├── cube.dae
│ │ │ │ ├── cube_triangulate.dae
│ │ │ │ ├── duck.dae
│ │ │ │ ├── duck_triangulate.dae
│ │ │ │ └── mgmidget.dae
│ │ │ └── outfiles/
│ │ │ ├── berlin.dae
│ │ │ ├── cube.dae
│ │ │ ├── cube_triangulate.dae
│ │ │ ├── duck.dae
│ │ │ ├── duck_triangulate.dae
│ │ │ └── mgmidget.dae
│ │ ├── 1.5/
│ │ │ ├── infiles/
│ │ │ │ ├── berlin.dae
│ │ │ │ ├── cube.dae
│ │ │ │ ├── cube_triangulate.dae
│ │ │ │ ├── duck.dae
│ │ │ │ ├── duck_triangulate.dae
│ │ │ │ └── mgmidget.dae
│ │ │ └── outfiles/
│ │ │ ├── berlin.dae
│ │ │ ├── cube.dae
│ │ │ ├── cube_triangulate.dae
│ │ │ ├── duck.dae
│ │ │ ├── duck_triangulate.dae
│ │ │ └── mgmidget.dae
│ │ └── main.go
│ ├── xsd-test-kml/
│ │ ├── infiles/
│ │ │ └── doc.kml
│ │ ├── main.go
│ │ └── outfiles/
│ │ └── doc.kml
│ ├── xsd-test-rss/
│ │ ├── infiles/
│ │ │ └── go-ngine-blog.rss
│ │ ├── main.go
│ │ └── outfiles/
│ │ └── go-ngine-blog.rss
│ └── xsd-test-svg/
│ └── main.go
└── xsd-schema.go
================================================
FILE CONTENTS
================================================
================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)
Copyright (c) 2014 Phil Schumann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: README.md
================================================
go-xsd
======
A Go package for loading ( **xml.Unmarshal()**-ing ) an XML Schema Definition (XSD) document into an **xsd.Schema** structure.
With this, you could probably write an XML validator, or otherwise utilize or further process the loaded XSD --- but the main use-case here was:
go-xsd/xsd-makepkg
==================
A command-line tool to generate Go "XML wrapper" package sources for specified XSD schema URIs.
If no arguments are specified, this tool proceeds to (re)generate all Go packages for various common XML formats in your local $GOPATH-relative directory corresponding to the **http://github.com/metaleap/go-xsd-pkg** repository. For more details on command-line arguments for *xsd-makepkg*: scroll down to the bottom of this readme.
Each generated wrapper package contains the type structures required to easily **xml.Unmarshal()** an XML document based on that XSD.
**XSD simple-types** are represented by the corresponding native Go scalar data type, augmented by utility methods where applicable:
- enumerated simple-types (eg. "value can be 'sunny', 'cloudy', 'rainy'") get handy corresponding **IsXyz() bool** methods (eg. "IsSunny()", "IsCloudy()", "IsRainy()")
- simple-types that define a whitespace-separated list of scalar values get a corresponding, properly typed **Values()** method
- for attributes or elements that define a fixed or default value, their corresponding generated Go simple-type will have a properly typed *ElemnameDefault()* / *ElemnameFixed()* / *AttnameDefault()* / *AttnameFixed()* method (eg. if the *langpref* attribute is defined to default to "Go", then its simple-type will have a *LangprefDefault()* method returning "Go")
**XSD complex-types**, attribute-groups, element-groups, elements etc. are ultimately represented by corresponding generated Go struct types.
**XSD includes** are all loaded and processed together into a single output .go source file.
**XSD imports** are rewritten as Go imports but not otherwise auto-magically processed. If you see the generated .go package importing another "some-xsd-xml-whatever-name-_go" package that will cause a "package not found" compiler error, then to make that import work, you'll first need to also auto-generate that package with *xsd-makepkg* yourself as well.
**XSD documentation annotation** is rewritten as Go // code comments. Yeah, that's rather neat.
Regarding the auto-generated code:
- it's **by necessity not idiomatic** and most likely not as terse/slim as manually-written structs would be. For very simplistic XML formats, writing your own 3 or 4 custom structs might be a tiny bit more efficient. **For highly intricate, unwieldy XML formats, the auto-generated packages beat hand-writing 100s of custom structs, however.** Auto-generated code will never win a code-beauty contest, you're expected to simply import the compiled package rather than having to work inside its generated source files.
- most (XSD-declared) types are prefixed with T -- thanks to the SVG schema which taught me that in XSD, "scriptType" and "ScriptType" are two valid and uniquely different type names. To have all types exported from the generated Go package, then, some kind of prefix is indeed needed.
- most XSDs are chock-full of anonymous types, as well as implicit ones (unions, restrictions, extensions...) Go does support "anonymous types" per se, but I decided against using them. Every type is declared and exported, no anonymous magic. This makes most auto-generated packages "look" even more confusing than their XSD counterparts at first glance. Indeed they may appear quite bloated, and when coding with the imported generated package you'll probably be better off working with the particular XML format's specification document rather than the **godoc** for the generated package... this is not a perfect situation but at least for now I can work with this for the few XML formats I occasionally need to "parse, convert and forget" -- ultimately, most XML formats at my end are mere interchange or legacy formats, and never really the "main topic" at hand.
go-xsd/types
============
A tiny package automatically imported by all **go-xsd** auto-generated packages.
Maps all XSD built-in simple-types to Go types, which affords us easy mapping of any XSD type references in the schema to Go imports: every *xs:string* and *xs:boolean* automatically becomes *xsdt.String* and *xsdt.Boolean* etc.
Types are mapped to Go types depending on how **encoding/xml.Unmarshal()** can handle them: ie. it parses bools and numbers, but dates/durations have too many format mismatches and thus are just declared string types.
Same for base64- and hex-encoded binary data: since **Unmarshal()** won't decode them, we leave them as strings. If you need their binary data, your code needs to import Go's base64/hex codec packages and use them as necessary.
How to use auto-generated packages:
===================================
Take a look at the "test progs" under **xsd-makepkg/tests**, they're basically simple usage examples. For unmarshal you need to define just one small custom struct like this --- using the rss package as a simple example, as demonstrated in **xsd-makepkg/tests/xsd-test-rss/main.go**:
type MyRssDoc struct {
XMLName xml.Name `xml:"rss"`
rss.TxsdRss
}
So your custom struct specifies two things:
- the XML name of the root element in your XML file, as is typical when working with **encoding/xml.Unmarshal()**.
- the Go struct type from the auto-generated package to **embed right inside** your custom struct.
The second part is the only tricky part. XML Schema Definition has no real concept of "root element", partly because they're designed to support use-cases where you embed a full document defined in one XSD deep inside a full document defined in another XSD. So a Collada document may contain a full or partial MathML document somewhere inside it. Some well-designed XSDs define a single top-level element, so we could infer "this is the root element" and generate a "XyzDoc" struct (like the *MyRssDoc* above) for you. But many don't. Some formats may legally have one of two or more possible "root" elements, ie. Atom allegedly may have either a "feed" root element or an "entry" root element. So **go-xsd** does not magically infer which of the XSD's top-level elements might be the root element, you define this by writing a small struct as shown above. The naming of the root element Go type to be embedded is not consistent across different packages, because their naming is directly based on the XSD that was used to generate the package. So for example...
- for rss we have *rss.TxsdRss*
- for atom: *atom.TentryType* and *atom.TfeedType*
- for svg: *svg.TsvgType*
- for Collada: *collada.TxsdCollada*
Seems like Collada and RSS share a certain naming pattern, and yet Atom/SVG share another one? Mere coincidence, the naming is completely arbitrary and up to the XSD author. Ultimately, to find out the proper Go type name to embed, you'll have to dig a bit inside the generated package. That's actually pretty straightforward, here's how you do it:
A) Suppose you have an XML format where the root element (and only that one) is known to be named:
<gopher>
B) Open the generated Go package source files under **$GOPATH/src/github.com/metaleap/go-xsd-pkg/yourdomain.org/xsd/gopher.xsd_go/*.go** (unless you used custom paths when you ran the **go-xsd/xsd-makepkg** tool)
C) Search for an occurence of either:
"gopher"`
( quote, gopher, quote, backtick ), or:
gopher"`
( *whitespace*, gopher, quote, backtick )
D) The found occurence is likely the tag for a field in a type named something like **XsdGoPkgHasElem_Gopher** or **XsdGoPkgHasElems_Gopher**. Ignore that type, instead focus on the type of the field itself. That's the one you're looking for, the one to embed in your tiny custom doc struct.
Command-line flags for *go-xsd/xsd-makepkg* tool:
=================================================
- **-basepath=""**: Defaults to github.com/metaleap/go-xsd-pkg. A $GOPATH/src/-relative path (always a slash-style path, even on Windows) where XSD files are downloaded to / loaded from and generated Go wrapper packages are created. Any XSD imports are also rewritten as Go imports from that path (but are not otherwise auto-magically processed in any way).
- **-local=true**: Local copy -- only downloads if file does not exist locally
- **-parse=false**: Not necessary, unless the generated Go wrapper package fails to compile with either the error "*cannot convert {value} to type {type}*" or "*cannot use {value} (type {type}) as type {type} in return argument*" -- ultimately down to a slightly faulty XSD file, but while rare, those exist (hello, KML using 0 and 1 for *xs:boolean*s that are clearly spec'd to be only ever either *true* or *false*...)
- **-uri=""**: The XML Schema Definition file URIs to generate a Go wrapper packages from, whitespace-separated. (For each, the protocol prefix can be omitted, it then defaults to *http://*. Only protocols understood by the *net/http* package are supported.)
- **-gofmt=true**: Run 'gofmt' against the generated Go wrapper package?
- **-goinst=true**: Run 'go-buildrun' ( http://github.com/metaleap/go-buildrun ) against the generated Go wrapper package?
================================================
FILE: elem.go
================================================
package xsd
import (
xsdt "github.com/metaleap/go-xsd/types"
)
type element interface {
base() *elemBase
init(parent, self element, xsdName xsdt.NCName, atts ...beforeAfterMake)
Parent() element
}
type elemBase struct {
atts []beforeAfterMake
parent, self element // self is the struct that embeds elemBase, rather than the elemBase pseudo-field
xsdName xsdt.NCName
hasNameAttr bool
}
func (me *elemBase) afterMakePkg(bag *PkgBag) {
if !me.hasNameAttr {
bag.Stacks.Name.Pop()
}
for _, a := range me.atts {
a.afterMakePkg(bag)
}
}
func (me *elemBase) beforeMakePkg(bag *PkgBag) {
if !me.hasNameAttr {
bag.Stacks.Name.Push(me.xsdName)
}
for _, a := range me.atts {
a.beforeMakePkg(bag)
}
}
func (me *elemBase) base() *elemBase { return me }
func (me *elemBase) init(parent, self element, xsdName xsdt.NCName, atts ...beforeAfterMake) {
me.parent, me.self, me.xsdName, me.atts = parent, self, xsdName, atts
for _, a := range atts {
if _, me.hasNameAttr = a.(*hasAttrName); me.hasNameAttr {
break
}
}
}
func (me *elemBase) longSafeName(bag *PkgBag) (ln string) {
var els = []element{}
for el := me.self; (el != nil) && (el != bag.Schema); el = el.Parent() {
els = append(els, el)
}
for i := len(els) - 1; i >= 0; i-- {
ln += bag.safeName(els[i].base().selfName().String())
}
return
}
func (me *elemBase) selfName() xsdt.NCName {
if me.hasNameAttr {
for _, at := range me.atts {
if an, ok := at.(*hasAttrName); ok {
return an.Name
}
}
}
return me.xsdName
}
func (me *elemBase) Parent() element { return me.parent }
type All struct {
elemBase
// XMLName xml.Name `xml:"all"`
hasAttrId
hasAttrMaxOccurs
hasAttrMinOccurs
hasElemAnnotation
hasElemsElement
}
type Annotation struct {
elemBase
// XMLName xml.Name `xml:"annotation"`
hasElemsAppInfo
hasElemsDocumentation
}
type Any struct {
elemBase
// XMLName xml.Name `xml:"any"`
hasAttrId
hasAttrMaxOccurs
hasAttrMinOccurs
hasAttrNamespace
hasAttrProcessContents
hasElemAnnotation
}
type AnyAttribute struct {
elemBase
// XMLName xml.Name `xml:"anyAttribute"`
hasAttrId
hasAttrNamespace
hasAttrProcessContents
hasElemAnnotation
}
type AppInfo struct {
elemBase
// XMLName xml.Name `xml:"appinfo"`
hasAttrSource
hasCdata
}
type Attribute struct {
elemBase
// XMLName xml.Name `xml:"attribute"`
hasAttrDefault
hasAttrFixed
hasAttrForm
hasAttrId
hasAttrName
hasAttrRef
hasAttrType
hasAttrUse
hasElemAnnotation
hasElemsSimpleType
}
type AttributeGroup struct {
elemBase
// XMLName xml.Name `xml:"attributeGroup"`
hasAttrId
hasAttrName
hasAttrRef
hasElemAnnotation
hasElemsAnyAttribute
hasElemsAttribute
hasElemsAttributeGroup
}
type Choice struct {
elemBase
// XMLName xml.Name `xml:"choice"`
hasAttrId
hasAttrMaxOccurs
hasAttrMinOccurs
hasElemAnnotation
hasElemsAny
hasElemsChoice
hasElemsElement
hasElemsGroup
hasElemsSequence
}
type ComplexContent struct {
elemBase
// XMLName xml.Name `xml:"complexContent"`
hasAttrId
hasAttrMixed
hasElemAnnotation
hasElemExtensionComplexContent
hasElemRestrictionComplexContent
}
type ComplexType struct {
elemBase
// XMLName xml.Name `xml:"complexType"`
hasAttrAbstract
hasAttrBlock
hasAttrFinal
hasAttrId
hasAttrMixed
hasAttrName
hasElemAll
hasElemAnnotation
hasElemsAnyAttribute
hasElemsAttribute
hasElemsAttributeGroup
hasElemChoice
hasElemComplexContent
hasElemGroup
hasElemSequence
hasElemSimpleContent
}
type Documentation struct {
elemBase
// XMLName xml.Name `xml:"documentation"`
hasAttrLang
hasAttrSource
hasCdata
}
type Element struct {
elemBase
// XMLName xml.Name `xml:"element"`
hasAttrAbstract
hasAttrBlock
hasAttrDefault
hasAttrFinal
hasAttrFixed
hasAttrForm
hasAttrId
hasAttrMaxOccurs
hasAttrMinOccurs
hasAttrName
hasAttrNillable
hasAttrRef
hasAttrSubstitutionGroup
hasAttrType
hasElemAnnotation
hasElemComplexType
hasElemsKey
hasElemKeyRef
hasElemsSimpleType
hasElemUnique
}
type ExtensionComplexContent struct {
elemBase
// XMLName xml.Name `xml:"extension"`
hasAttrBase
hasAttrId
hasElemAll
hasElemAnnotation
hasElemsAnyAttribute
hasElemsAttribute
hasElemsAttributeGroup
hasElemsChoice
hasElemsGroup
hasElemsSequence
}
type ExtensionSimpleContent struct {
elemBase
// XMLName xml.Name `xml:"extension"`
hasAttrBase
hasAttrId
hasElemAnnotation
hasElemsAnyAttribute
hasElemsAttribute
hasElemsAttributeGroup
}
type Field struct {
elemBase
// XMLName xml.Name `xml:"field"`
hasAttrId
hasAttrXpath
hasElemAnnotation
}
type Group struct {
elemBase
// XMLName xml.Name `xml:"group"`
hasAttrId
hasAttrMaxOccurs
hasAttrMinOccurs
hasAttrName
hasAttrRef
hasElemAll
hasElemAnnotation
hasElemChoice
hasElemSequence
}
type Include struct {
elemBase
// XMLName xml.Name `xml:"include"`
hasAttrId
hasAttrSchemaLocation
hasElemAnnotation
}
type Import struct {
elemBase
// XMLName xml.Name `xml:"import"`
hasAttrId
hasAttrNamespace
hasAttrSchemaLocation
hasElemAnnotation
}
type Key struct {
elemBase
// XMLName xml.Name `xml:"key"`
hasAttrId
hasAttrName
hasElemAnnotation
hasElemField
hasElemSelector
}
type KeyRef struct {
elemBase
// XMLName xml.Name `xml:"keyref"`
hasAttrId
hasAttrName
hasAttrRefer
hasElemAnnotation
hasElemField
hasElemSelector
}
type List struct {
elemBase
// XMLName xml.Name `xml:"list"`
hasAttrId
hasAttrItemType
hasElemAnnotation
hasElemsSimpleType
}
type Notation struct {
elemBase
// XMLName xml.Name `xml:"notation"`
hasAttrId
hasAttrName
hasAttrPublic
hasAttrSystem
hasElemAnnotation
}
type Redefine struct {
elemBase
// XMLName xml.Name `xml:"redefine"`
hasAttrId
hasAttrSchemaLocation
hasElemAnnotation
hasElemsAttributeGroup
hasElemsComplexType
hasElemsGroup
hasElemsSimpleType
}
type RestrictionComplexContent struct {
elemBase
// XMLName xml.Name `xml:"restriction"`
hasAttrBase
hasAttrId
hasElemAll
hasElemAnnotation
hasElemsAnyAttribute
hasElemsAttribute
hasElemsAttributeGroup
hasElemsChoice
hasElemsSequence
}
type RestrictionSimpleContent struct {
elemBase
// XMLName xml.Name `xml:"restriction"`
hasAttrBase
hasAttrId
hasElemAnnotation
hasElemsAnyAttribute
hasElemsAttribute
hasElemsAttributeGroup
hasElemsEnumeration
hasElemFractionDigits
hasElemLength
hasElemMaxExclusive
hasElemMaxInclusive
hasElemMaxLength
hasElemMinExclusive
hasElemMinInclusive
hasElemMinLength
hasElemPattern
hasElemsSimpleType
hasElemTotalDigits
hasElemWhiteSpace
}
type RestrictionSimpleEnumeration struct {
elemBase
// XMLName xml.Name `xml:"enumeration"`
hasAttrValue
}
type RestrictionSimpleFractionDigits struct {
elemBase
// XMLName xml.Name `xml:"fractionDigits"`
hasAttrValue
}
type RestrictionSimpleLength struct {
elemBase
// XMLName xml.Name `xml:"length"`
hasAttrValue
}
type RestrictionSimpleMaxExclusive struct {
elemBase
// XMLName xml.Name `xml:"maxExclusive"`
hasAttrValue
}
type RestrictionSimpleMaxInclusive struct {
elemBase
// XMLName xml.Name `xml:"maxInclusive"`
hasAttrValue
}
type RestrictionSimpleMaxLength struct {
elemBase
// XMLName xml.Name `xml:"maxLength"`
hasAttrValue
}
type RestrictionSimpleMinExclusive struct {
elemBase
// XMLName xml.Name `xml:"minExclusive"`
hasAttrValue
}
type RestrictionSimpleMinInclusive struct {
elemBase
// XMLName xml.Name `xml:"minInclusive"`
hasAttrValue
}
type RestrictionSimpleMinLength struct {
elemBase
// XMLName xml.Name `xml:"minLength"`
hasAttrValue
}
type RestrictionSimplePattern struct {
elemBase
// XMLName xml.Name `xml:"pattern"`
hasAttrValue
}
type RestrictionSimpleTotalDigits struct {
elemBase
// XMLName xml.Name `xml:"totalDigits"`
hasAttrValue
}
type RestrictionSimpleType struct {
elemBase
// XMLName xml.Name `xml:"restriction"`
hasAttrBase
hasAttrId
hasElemAnnotation
hasElemsEnumeration
hasElemFractionDigits
hasElemLength
hasElemMaxExclusive
hasElemMaxInclusive
hasElemMaxLength
hasElemMinExclusive
hasElemMinInclusive
hasElemMinLength
hasElemPattern
hasElemsSimpleType
hasElemTotalDigits
hasElemWhiteSpace
}
type RestrictionSimpleWhiteSpace struct {
elemBase
// XMLName xml.Name `xml:"whiteSpace"`
hasAttrValue
}
type Selector struct {
elemBase
// XMLName xml.Name `xml:"selector"`
hasAttrId
hasAttrXpath
hasElemAnnotation
}
type Sequence struct {
elemBase
// XMLName xml.Name `xml:"sequence"`
hasAttrId
hasAttrMaxOccurs
hasAttrMinOccurs
hasElemAnnotation
hasElemsAny
hasElemsChoice
hasElemsElement
hasElemsGroup
hasElemsSequence
}
type SimpleContent struct {
elemBase
// XMLName xml.Name `xml:"simpleContent"`
hasAttrId
hasElemAnnotation
hasElemExtensionSimpleContent
hasElemRestrictionSimpleContent
}
type SimpleType struct {
elemBase
// XMLName xml.Name `xml:"simpleType"`
hasAttrFinal
hasAttrId
hasAttrName
hasElemAnnotation
hasElemList
hasElemRestrictionSimpleType
hasElemUnion
}
type Union struct {
elemBase
// XMLName xml.Name `xml:"union"`
hasAttrId
hasAttrMemberTypes
hasElemAnnotation
hasElemsSimpleType
}
type Unique struct {
elemBase
// XMLName xml.Name `xml:"unique"`
hasAttrId
hasAttrName
hasElemAnnotation
hasElemField
hasElemSelector
}
func Flattened(choices []*Choice, seqs []*Sequence) (allChoices []*Choice, allSeqs []*Sequence) {
var tmpChoices []*Choice
var tmpSeqs []*Sequence
for _, ch := range choices {
if ch != nil {
allChoices = append(allChoices, ch)
tmpChoices, tmpSeqs = Flattened(ch.Choices, ch.Sequences)
allChoices = append(allChoices, tmpChoices...)
allSeqs = append(allSeqs, tmpSeqs...)
}
}
for _, seq := range seqs {
if seq != nil {
allSeqs = append(allSeqs, seq)
tmpChoices, tmpSeqs = Flattened(seq.Choices, seq.Sequences)
allChoices = append(allChoices, tmpChoices...)
allSeqs = append(allSeqs, tmpSeqs...)
}
}
return
}
================================================
FILE: elemmakepkg.go
================================================
package xsd
import (
"fmt"
"path"
"strings"
"unicode"
"github.com/metaleap/go-util/str"
xsdt "github.com/metaleap/go-xsd/types"
)
const (
idPrefix = "XsdGoPkg"
)
func (me *All) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsElement.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Annotation) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsAppInfo.makePkg(bag)
me.hasElemsDocumentation.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Any) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *AnyAttribute) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *AppInfo) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Attribute) makePkg(bag *PkgBag) {
var safeName, typeName, tmp, key, defVal, impName string
var defName = "Default"
me.elemBase.beforeMakePkg(bag)
if len(me.Form) == 0 {
me.Form = bag.Schema.AttributeFormDefault
}
me.hasElemsSimpleType.makePkg(bag)
if len(me.Ref) > 0 {
key = bag.resolveQnameRef(me.Ref.String(), "", &impName)
tmp = ustr.PrefixWithSep(impName, ".", idPrefix+"HasAttr_"+bag.safeName(me.Ref.String()[(strings.Index(me.Ref.String(), ":")+1):]))
if bag.attRefImps[me], bag.attsKeys[me] = impName, key; len(bag.attsCache[key]) == 0 {
bag.attsCache[key] = tmp
}
} else {
safeName = bag.safeName(me.Name.String())
if typeName = me.Type.String(); (len(typeName) == 0) && (len(me.SimpleTypes) > 0) {
typeName = me.SimpleTypes[0].Name.String()
} else {
if len(typeName) == 0 {
typeName = bag.xsdStringTypeRef()
}
typeName = bag.resolveQnameRef(typeName, "T", &impName)
}
if defVal = me.Default; len(defVal) == 0 {
defName, defVal = "Fixed", me.Fixed
}
if me.Parent() == bag.Schema {
key = safeName
} else {
key = safeName + "_" + bag.safeName(typeName) + "_" + bag.safeName(defVal)
}
if len(bag.attsCache[key]) == 0 {
tmp = idPrefix + "HasAttr_" + key
bag.attsKeys[me] = key
bag.attsCache[key] = tmp
var td = bag.addType(me, tmp, "", me.Annotation)
td.addField(me, safeName, typeName, ustr.Ifs(len(bag.Schema.TargetNamespace) > 0, bag.Schema.TargetNamespace.String()+" ", "")+me.Name.String()+",attr", me.Annotation)
if isPt := bag.isParseType(typeName); len(defVal) > 0 {
doc := sfmt("Returns the %v value for %v -- "+ustr.Ifs(isPt, "%v", "%#v"), strings.ToLower(defName), safeName, defVal)
if isPt {
if PkgGen.ForceParseForDefaults {
td.addMethod(nil, tmp, safeName+defName, typeName, sfmt("var x = new(%v); x.Set(%#v); return *x", typeName, defVal), doc)
} else {
td.addMethod(nil, tmp, safeName+defName, typeName, sfmt("return %v(%v)", typeName, defVal), doc)
}
} else {
td.addMethod(nil, tmp, safeName+defName, typeName, sfmt("return %v(%#v)", typeName, defVal), doc)
}
}
} else {
bag.attsKeys[me] = key
}
}
me.elemBase.afterMakePkg(bag)
}
func (me *AttributeGroup) makePkg(bag *PkgBag) {
var refName, refImp string
me.elemBase.beforeMakePkg(bag)
me.hasElemsAttribute.makePkg(bag)
me.hasElemsAnyAttribute.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
if len(me.Ref) > 0 {
if len(bag.attGroups[me]) == 0 {
refName = bag.resolveQnameRef(me.Ref.String(), "", &refImp)
bag.attGroups[me] = idPrefix + "HasAtts_" + refName
bag.attGroupRefImps[me] = refImp
}
} else {
safeName := bag.safeName(me.Name.String())
tmp := idPrefix + "HasAtts_" + safeName
var td = bag.addType(me, tmp, "", me.Annotation)
bag.attGroups[me] = tmp
for _, ag := range me.AttributeGroups {
if len(ag.Ref) == 0 {
ag.Ref.Set(ag.Name.String())
}
if refName = bag.resolveQnameRef(ag.Ref.String(), "", &refImp); len(refImp) > 0 {
td.addEmbed(ag, refImp+"."+idPrefix+"HasAtts_"+refName[(len(refImp)+1):], ag.Annotation)
} else {
td.addEmbed(ag, idPrefix+"HasAtts_"+refName, ag.Annotation)
}
}
for _, att := range me.Attributes {
if key := bag.attsKeys[att]; len(key) > 0 {
td.addEmbed(att, bag.attsCache[key], att.Annotation)
}
}
}
me.elemBase.afterMakePkg(bag)
}
func (me *Choice) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsAny.makePkg(bag)
me.hasElemsChoice.makePkg(bag)
me.hasElemsGroup.makePkg(bag)
me.hasElemsSequence.makePkg(bag)
me.hasElemsElement.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *ComplexContent) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemExtensionComplexContent.makePkg(bag)
me.hasElemRestrictionComplexContent.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *ComplexType) makePkg(bag *PkgBag) {
var att *Attribute
var attGroup *AttributeGroup
var ctBaseType, ctValueType, typeSafeName string
var allAtts = map[*Attribute]bool{}
var allAttGroups = map[*AttributeGroup]bool{}
var allElems = map[*Element]bool{}
var allElemGroups = map[*Group]bool{}
var elsDone, grsDone = map[string]bool{}, map[string]bool{}
var allChoices, tmpChoices = []*Choice{}, []*Choice{me.Choice}
var allSeqs, tmpSeqs = []*Sequence{}, []*Sequence{me.Sequence}
var el *Element
var elGr *Group
var mixed = false
me.elemBase.beforeMakePkg(bag)
me.hasElemsAttribute.makePkg(bag)
me.hasElemsAnyAttribute.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
me.hasElemAll.makePkg(bag)
me.hasElemChoice.makePkg(bag)
me.hasElemGroup.makePkg(bag)
me.hasElemSequence.makePkg(bag)
me.hasElemComplexContent.makePkg(bag)
me.hasElemSimpleContent.makePkg(bag)
if len(me.Name) == 0 {
me.Name = bag.AnonName(me.longSafeName(bag))
}
typeSafeName = bag.safeName(ustr.PrependIf(me.Name.String(), "T"))
var td = bag.addType(me, typeSafeName, "", me.Annotation)
for _, att = range me.Attributes {
allAtts[att] = true
}
for _, attGroup = range me.AttributeGroups {
allAttGroups[attGroup] = true
}
allChoices, allSeqs = Flattened(tmpChoices, tmpSeqs)
if me.All != nil {
for _, el = range me.All.Elements {
allElems[el] = true
}
}
if me.Group != nil {
allElemGroups[me.Group] = true
}
if mixed = me.Mixed; me.ComplexContent != nil {
mixed = mixed || me.ComplexContent.Mixed
td.addAnnotations(me.ComplexContent.Annotation)
if me.ComplexContent.ExtensionComplexContent != nil {
td.addAnnotations(me.ComplexContent.ExtensionComplexContent.Annotation)
if me.ComplexContent.ExtensionComplexContent.All != nil {
for _, el = range me.ComplexContent.ExtensionComplexContent.All.Elements {
allElems[el] = true
}
}
for _, elGr = range me.ComplexContent.ExtensionComplexContent.Groups {
allElemGroups[elGr] = true
}
tmpChoices, tmpSeqs = Flattened(me.ComplexContent.ExtensionComplexContent.Choices, me.ComplexContent.ExtensionComplexContent.Sequences)
allChoices, allSeqs = append(allChoices, tmpChoices...), append(allSeqs, tmpSeqs...)
for _, att = range me.ComplexContent.ExtensionComplexContent.Attributes {
allAtts[att] = true
}
for _, attGroup = range me.ComplexContent.ExtensionComplexContent.AttributeGroups {
allAttGroups[attGroup] = true
}
if len(me.ComplexContent.ExtensionComplexContent.Base) > 0 {
ctBaseType = me.ComplexContent.ExtensionComplexContent.Base.String()
}
}
if me.ComplexContent.RestrictionComplexContent != nil {
td.addAnnotations(me.ComplexContent.RestrictionComplexContent.Annotation)
if me.ComplexContent.RestrictionComplexContent.All != nil {
for _, el = range me.ComplexContent.RestrictionComplexContent.All.Elements {
allElems[el] = true
}
}
tmpChoices, tmpSeqs = Flattened(me.ComplexContent.RestrictionComplexContent.Choices, me.ComplexContent.RestrictionComplexContent.Sequences)
allChoices, allSeqs = append(allChoices, tmpChoices...), append(allSeqs, tmpSeqs...)
for _, att = range me.ComplexContent.RestrictionComplexContent.Attributes {
allAtts[att] = true
}
for _, attGroup = range me.ComplexContent.RestrictionComplexContent.AttributeGroups {
allAttGroups[attGroup] = true
}
if len(me.ComplexContent.RestrictionComplexContent.Base) > 0 {
ctBaseType = me.ComplexContent.RestrictionComplexContent.Base.String()
}
}
}
if me.SimpleContent != nil {
td.addAnnotations(me.SimpleContent.Annotation)
if me.SimpleContent.ExtensionSimpleContent != nil {
if len(me.SimpleContent.ExtensionSimpleContent.Base) > 0 {
ctBaseType = me.SimpleContent.ExtensionSimpleContent.Base.String()
}
td.addAnnotations(me.SimpleContent.ExtensionSimpleContent.Annotation)
for _, att = range me.SimpleContent.ExtensionSimpleContent.Attributes {
allAtts[att] = true
}
for _, attGroup = range me.SimpleContent.ExtensionSimpleContent.AttributeGroups {
allAttGroups[attGroup] = true
}
if (len(ctValueType) == 0) && (len(me.SimpleContent.ExtensionSimpleContent.Base) > 0) {
ctValueType = me.SimpleContent.ExtensionSimpleContent.Base.String()
}
}
if me.SimpleContent.RestrictionSimpleContent != nil {
if len(me.SimpleContent.RestrictionSimpleContent.Base) > 0 {
ctBaseType = me.SimpleContent.RestrictionSimpleContent.Base.String()
}
td.addAnnotations(me.SimpleContent.RestrictionSimpleContent.Annotation)
for _, att = range me.SimpleContent.RestrictionSimpleContent.Attributes {
allAtts[att] = true
}
for _, attGroup = range me.SimpleContent.RestrictionSimpleContent.AttributeGroups {
allAttGroups[attGroup] = true
}
if (len(ctValueType) == 0) && (len(me.SimpleContent.RestrictionSimpleContent.Base) > 0) {
ctValueType = me.SimpleContent.RestrictionSimpleContent.Base.String()
}
if (len(ctValueType) == 0) && (len(me.SimpleContent.RestrictionSimpleContent.SimpleTypes) > 0) {
ctValueType = me.SimpleContent.RestrictionSimpleContent.SimpleTypes[0].Name.String()
}
for _, enum := range me.SimpleContent.RestrictionSimpleContent.Enumerations {
println("ENUMTODO!?! Whoever sees this message, please post an issue at github.com/metaleap/go-xsd with a link to the XSD..." + enum.selfName().String())
}
}
}
if ctBaseType = bag.resolveQnameRef(ctBaseType, "T", nil); len(ctBaseType) > 0 {
if strings.HasPrefix(ctBaseType, "xsdt.") {
td.addEmbed(nil, idPrefix+"HasCdata")
} else {
td.addEmbed(nil, bag.safeName(ctBaseType))
}
} else if ctValueType = bag.resolveQnameRef(ctValueType, "T", nil); len(ctValueType) > 0 {
bag.simpleContentValueTypes[typeSafeName] = ctValueType
td.addField(nil, idPrefix+"Value", ctValueType, ",chardata")
chain := sfmt("me.%vValue", idPrefix)
td.addMethod(nil, "*"+typeSafeName, sfmt("To%v", bag.safeName(ctValueType)), ctValueType, sfmt("return %v", chain), sfmt("Simply returns the value of its %vValue field.", idPrefix))
var ttn string
for ttd := bag.declTypes[ctValueType]; ttd != nil; ttd = bag.declTypes[ttn] {
if ttd != nil {
bag.declConvs[ttd.Name] = true
}
if ttn = ttd.Type; len(ttn) > 0 {
chain += sfmt(".To%v()", bag.safeName(ttn))
td.addMethod(nil, "*"+typeSafeName, sfmt("To%v", bag.safeName(ttn)), ttn, sfmt("return %v", chain), sfmt("Returns the value of its %vValue field as a %v (which %v is just aliasing).", idPrefix, ttn, ctValueType))
} else {
break
}
}
if (!strings.HasPrefix(ctValueType, "xsdt.")) && (bag.declTypes[ctValueType] == nil) {
println("NOTFOUND: " + ctValueType)
}
} else if mixed {
td.addEmbed(nil, idPrefix+"HasCdata")
}
for elGr = range allElemGroups {
subMakeElemGroup(bag, td, elGr, grsDone, anns(nil, me.ComplexContent)...)
}
for el = range allElems {
subMakeElem(bag, td, el, elsDone, 1, anns(me.All, nil)...)
}
for _, ch := range allChoices {
for _, el = range ch.Elements {
subMakeElem(bag, td, el, elsDone, ch.hasAttrMaxOccurs.Value(), ch.Annotation)
}
for _, elGr = range ch.Groups {
subMakeElemGroup(bag, td, elGr, grsDone, ch.Annotation)
}
}
for _, seq := range allSeqs {
for _, el = range seq.Elements {
subMakeElem(bag, td, el, elsDone, seq.hasAttrMaxOccurs.Value(), seq.Annotation)
}
for _, elGr = range seq.Groups {
subMakeElemGroup(bag, td, elGr, grsDone, seq.Annotation)
}
}
for attGroup = range allAttGroups {
td.addEmbed(attGroup, ustr.PrefixWithSep(bag.attGroupRefImps[attGroup], ".", bag.attGroups[attGroup][(strings.Index(bag.attGroups[attGroup], ".")+1):]), attGroup.Annotation)
}
for att = range allAtts {
if key := bag.attsKeys[att]; len(key) > 0 {
td.addEmbed(att, ustr.PrefixWithSep(bag.attRefImps[att], ".", bag.attsCache[key][(strings.Index(bag.attsCache[key], ".")+1):]), att.Annotation)
}
}
me.elemBase.afterMakePkg(bag)
}
func (me *Documentation) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
if len(me.CDATA) > 0 {
var s, ln string
for _, ln = range ustr.Split(me.CDATA, "\n") {
if s = strings.Trim(ln, " \t\r\n"); len(s) > 0 {
bag.appendFmt(false, "//\t%s", s)
}
}
}
me.elemBase.afterMakePkg(bag)
}
func (me *Element) makePkg(bag *PkgBag) {
var (
safeName, typeName, valueType, tmp, key, defVal, impName string
subEl *Element
)
asterisk, defName, doc := "", "Default", ""
me.elemBase.beforeMakePkg(bag)
if len(me.Form) == 0 {
me.Form = bag.Schema.ElementFormDefault
}
me.hasElemsSimpleType.makePkg(bag)
me.hasElemComplexType.makePkg(bag)
if len(me.Ref) > 0 {
key = bag.resolveQnameRef(me.Ref.String(), "", &impName)
for pref, cache := range map[string]map[string]string{"HasElem_": bag.elemsCacheOnce, "HasElems_": bag.elemsCacheMult} {
tmp = ustr.PrefixWithSep(impName, ".", idPrefix+pref+bag.safeName(me.Ref.String()[(strings.Index(me.Ref.String(), ":")+1):]))
if bag.elemRefImps[me], bag.elemKeys[me] = impName, key; len(cache[key]) == 0 {
cache[key] = tmp
}
}
} else {
safeName = bag.safeName(me.Name.String())
if typeName = me.Type.String(); (len(typeName) == 0) && ((me.ComplexType != nil) || (len(me.SimpleTypes) > 0)) {
if me.ComplexType != nil {
asterisk, typeName = "*", me.ComplexType.Name.String()
} else {
typeName = me.SimpleTypes[0].Name.String()
}
} else {
if len(typeName) == 0 {
typeName = bag.xsdStringTypeRef()
}
loadedSchemas := make(map[string]bool)
if typeName = bag.resolveQnameRef(typeName, "T", &impName); bag.Schema.RootSchema([]string{bag.Schema.loadUri}).globalComplexType(bag, typeName, loadedSchemas) != nil {
asterisk = "*"
}
}
if defVal = me.Default; len(defVal) == 0 {
defName, defVal = "Fixed", me.Fixed
}
if me.Parent() == bag.Schema {
key = safeName
} else {
key = bag.safeName(bag.Stacks.FullName()) + "_" + safeName + "_" + bag.safeName(typeName) + "_" + bag.safeName(defVal)
}
if valueType = bag.simpleContentValueTypes[typeName]; len(valueType) == 0 {
valueType = typeName
}
isPt := bag.isParseType(valueType)
if _, isChoice := me.Parent().(*Choice); isChoice && isPt {
asterisk = "*"
}
for pref, cache := range map[string]map[string]string{"HasElem_": bag.elemsCacheOnce, "HasElems_": bag.elemsCacheMult} {
if tmp = idPrefix + pref + key; !bag.elemsWritten[tmp] {
bag.elemsWritten[tmp], bag.elemKeys[me] = true, key
cache[key] = tmp
var td = bag.addType(me, tmp, "", me.Annotation)
td.addField(me, ustr.Ifs(pref == "HasElems_", pluralize(safeName), safeName), ustr.Ifs(pref == "HasElems_", "[]"+asterisk+typeName, asterisk+typeName), ustr.Ifs(len(bag.Schema.TargetNamespace) > 0, bag.Schema.TargetNamespace.String()+" ", "")+me.Name.String(), me.Annotation)
if me.parent == bag.Schema {
loadedSchemas := make(map[string]bool)
for _, subEl = range bag.Schema.RootSchema([]string{bag.Schema.loadUri}).globalSubstitutionElems(me, loadedSchemas) {
td.addEmbed(subEl, idPrefix+pref+bag.safeName(subEl.Name.String()), subEl.Annotation)
}
}
if len(defVal) > 0 {
doc = sfmt("Returns the %v value for %v -- "+ustr.Ifs(isPt, "%v", "%#v"), strings.ToLower(defName), safeName, defVal)
if isPt {
if PkgGen.ForceParseForDefaults {
td.addMethod(nil, tmp, safeName+defName, valueType, sfmt("var x = new(%v); x.Set(%#v); return *x", valueType, defVal), doc)
} else {
td.addMethod(nil, tmp, safeName+defName, valueType, sfmt("return %v(%v)", valueType, defVal), doc)
}
} else {
td.addMethod(nil, tmp, safeName+defName, valueType, sfmt("return %v(%#v)", valueType, defVal), doc)
}
}
}
}
}
me.elemBase.afterMakePkg(bag)
}
func (me *ExtensionComplexContent) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsAttribute.makePkg(bag)
me.hasElemsAnyAttribute.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
me.hasElemAll.makePkg(bag)
me.hasElemsChoice.makePkg(bag)
me.hasElemsGroup.makePkg(bag)
me.hasElemsSequence.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *ExtensionSimpleContent) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsAttribute.makePkg(bag)
me.hasElemsAnyAttribute.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Field) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Group) makePkg(bag *PkgBag) {
var refName, refImp string
var choices = []*Choice{me.Choice}
var seqs = []*Sequence{me.Sequence}
var el *Element
var gr *Group
var elsDone, grsDone = map[string]bool{}, map[string]bool{}
me.elemBase.beforeMakePkg(bag)
me.hasElemAll.makePkg(bag)
me.hasElemChoice.makePkg(bag)
me.hasElemSequence.makePkg(bag)
if len(me.Ref) > 0 {
if len(bag.elemGroups[me]) == 0 {
refName = bag.resolveQnameRef(me.Ref.String(), "", &refImp)
bag.elemGroups[me] = idPrefix + "HasGroup_" + refName
bag.elemGroupRefImps[me] = refImp
}
} else {
me.Ref.Set(me.Name.String())
safeName := bag.safeName(me.Name.String())
tmp := idPrefix + "HasGroup_" + safeName
bag.elemGroups[me] = tmp
var td = bag.addType(me, tmp, "", me.Annotation)
choices, seqs = Flattened(choices, seqs)
if me.All != nil {
for _, el = range me.All.Elements {
subMakeElem(bag, td, el, elsDone, 1, me.All.Annotation)
}
}
for _, ch := range choices {
for _, el = range ch.Elements {
subMakeElem(bag, td, el, elsDone, ch.hasAttrMaxOccurs.Value(), ch.Annotation)
}
for _, gr = range ch.Groups {
subMakeElemGroup(bag, td, gr, grsDone, ch.Annotation)
}
}
for _, seq := range seqs {
for _, el = range seq.Elements {
subMakeElem(bag, td, el, elsDone, seq.hasAttrMaxOccurs.Value(), seq.Annotation)
}
for _, gr = range seq.Groups {
subMakeElemGroup(bag, td, gr, grsDone, seq.Annotation)
}
}
}
me.elemBase.afterMakePkg(bag)
}
func (me *Import) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
var impName, impPath string
var pos int
me.hasElemAnnotation.makePkg(bag)
for k, v := range bag.Schema.XMLNamespaces {
if v == me.Namespace {
impName = safeIdentifier(k)
break
}
}
if len(impName) > 0 {
if pos, impPath = strings.Index(me.SchemaLocation.String(), protSep), me.SchemaLocation.String(); pos > 0 {
impPath = impPath[pos+len(protSep):]
} else {
impPath = path.Join(path.Dir(bag.Schema.loadUri), impPath)
}
impPath = path.Join(path.Dir(impPath), goPkgPrefix+path.Base(impPath)+goPkgSuffix)
bag.imports[impName] = path.Join(PkgGen.BasePath, impPath)
}
me.elemBase.afterMakePkg(bag)
}
func (me *Key) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemField.makePkg(bag)
me.hasElemSelector.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *KeyRef) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemField.makePkg(bag)
me.hasElemSelector.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *List) makePkg(bag *PkgBag) {
var safeName string
me.elemBase.beforeMakePkg(bag)
me.hasElemsSimpleType.makePkg(bag)
rtr := bag.resolveQnameRef(me.ItemType.String(), "T", nil)
if len(rtr) == 0 {
rtr = me.SimpleTypes[0].Name.String()
}
st := bag.Stacks.CurSimpleType()
safeName = bag.safeName(ustr.PrependIf(st.Name.String(), "T"))
body, doc := "", sfmt("%v declares a String containing a whitespace-separated list of %v values. This Values() method creates and returns a slice of all elements in that list", safeName, rtr)
body = sfmt("svals := %v.ListValues(string(me)); list = make([]%v, len(svals)); for i, s := range svals { list[i].Set(s) }; return", bag.impName, rtr)
bag.ctd.addMethod(me, safeName, "Values", sfmt("(list []%v)", rtr), body, doc+".", me.Annotation)
for baseType := bag.simpleBaseTypes[rtr]; len(baseType) > 0; baseType = bag.simpleBaseTypes[baseType] {
body = sfmt("svals := %v.ListValues(string(me)); list = make([]%v, len(svals)); for i, s := range svals { list[i].Set(s) }; return", bag.impName, baseType)
bag.ctd.addMethod(me, safeName, "Values"+bag.safeName(baseType), sfmt("(list []%v)", baseType), body, sfmt("%s, typed as %s.", doc, baseType), me.Annotation)
}
me.elemBase.afterMakePkg(bag)
}
func (me *Notation) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemAnnotation.makePkg(bag)
bag.appendFmt(false, "%vNotations.Add(%#v, %#v, %#v, %#v)", idPrefix, me.Id, me.Name, me.Public, me.System)
me.elemBase.afterMakePkg(bag)
}
func (me *Redefine) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsSimpleType.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
me.hasElemsGroup.makePkg(bag)
me.hasElemsComplexType.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionComplexContent) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsAttribute.makePkg(bag)
me.hasElemsAnyAttribute.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
me.hasElemAll.makePkg(bag)
me.hasElemsChoice.makePkg(bag)
me.hasElemsSequence.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleContent) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsSimpleType.makePkg(bag)
me.hasElemsAttribute.makePkg(bag)
me.hasElemsAnyAttribute.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
me.hasElemLength.makePkg(bag)
me.hasElemPattern.makePkg(bag)
me.hasElemsEnumeration.makePkg(bag)
me.hasElemFractionDigits.makePkg(bag)
me.hasElemMaxExclusive.makePkg(bag)
me.hasElemMaxInclusive.makePkg(bag)
me.hasElemMaxLength.makePkg(bag)
me.hasElemMinExclusive.makePkg(bag)
me.hasElemMinInclusive.makePkg(bag)
me.hasElemMinLength.makePkg(bag)
me.hasElemTotalDigits.makePkg(bag)
me.hasElemWhiteSpace.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleEnumeration) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
safeName := bag.safeName(ustr.PrependIf(bag.Stacks.CurSimpleType().Name.String(), "T"))
var doc = sfmt("Returns true if the value of this enumerated %v is %#v.", safeName, me.Value)
bag.ctd.addMethod(me, safeName, "Is"+bag.safeName(me.Value), "bool", sfmt("return me.String() == %#v", me.Value), doc)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleFractionDigits) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleLength) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleMaxExclusive) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleMaxInclusive) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleMaxLength) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleMinExclusive) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleMinInclusive) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleMinLength) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimplePattern) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleTotalDigits) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleType) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsSimpleType.makePkg(bag)
me.hasElemLength.makePkg(bag)
me.hasElemPattern.makePkg(bag)
me.hasElemsEnumeration.makePkg(bag)
me.hasElemFractionDigits.makePkg(bag)
me.hasElemMaxExclusive.makePkg(bag)
me.hasElemMaxInclusive.makePkg(bag)
me.hasElemMaxLength.makePkg(bag)
me.hasElemMinExclusive.makePkg(bag)
me.hasElemMinInclusive.makePkg(bag)
me.hasElemMinLength.makePkg(bag)
me.hasElemTotalDigits.makePkg(bag)
me.hasElemWhiteSpace.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *RestrictionSimpleWhiteSpace) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Schema) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsImport.makePkg(bag)
me.hasElemsSimpleType.makePkg(bag)
me.hasElemsAttribute.makePkg(bag)
me.hasElemsAttributeGroup.makePkg(bag)
me.hasElemsComplexType.makePkg(bag)
me.hasElemsElement.makePkg(bag)
me.hasElemsGroup.makePkg(bag)
me.hasElemsRedefine.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Selector) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemAnnotation.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *Sequence) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemsAny.makePkg(bag)
me.hasElemsChoice.makePkg(bag)
me.hasElemsGroup.makePkg(bag)
me.hasElemsSequence.makePkg(bag)
me.hasElemsElement.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *SimpleContent) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemExtensionSimpleContent.makePkg(bag)
me.hasElemRestrictionSimpleContent.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func (me *SimpleType) makePkg(bag *PkgBag) {
var typeName = me.Name
var baseType, safeName = "", ""
var resolve = true
var isPt bool
if len(typeName) == 0 {
typeName = bag.AnonName(me.longSafeName(bag))
me.Name = typeName
} else {
me.Name = typeName
}
typeName = xsdt.NCName(ustr.PrependIf(typeName.String(), "T"))
me.elemBase.beforeMakePkg(bag)
bag.Stacks.SimpleType.Push(me)
safeName = bag.safeName(typeName.String())
if me.RestrictionSimpleType != nil {
if baseType = me.RestrictionSimpleType.Base.String(); (len(baseType) == 0) && (len(me.RestrictionSimpleType.SimpleTypes) > 0) {
resolve, baseType = false, me.RestrictionSimpleType.SimpleTypes[0].Name.String()
}
}
if len(baseType) == 0 {
baseType = bag.xsdStringTypeRef()
}
if resolve {
baseType = bag.resolveQnameRef(baseType, "T", nil)
}
bag.simpleBaseTypes[safeName] = baseType
if isPt = bag.isParseType(baseType); isPt {
bag.parseTypes[safeName] = true
}
var td = bag.addType(me, safeName, baseType, me.Annotation)
var doc string
if isPt {
doc = sfmt("Since %v is a non-string scalar type (either boolean or numeric), sets the current value obtained from parsing the specified string.", safeName)
} else {
doc = sfmt("Since %v is just a simple String type, this merely sets the current value from the specified string.", safeName)
}
td.addMethod(nil, "*"+safeName, "Set (s string)", "", sfmt("(*%v)(me).Set(s)", baseType), doc)
if isPt {
doc = sfmt("Returns a string representation of this %v's current non-string scalar value.", safeName)
} else {
doc = sfmt("Since %v is just a simple String type, this merely returns the current string value.", safeName)
}
td.addMethod(nil, safeName, "String", "string", sfmt("return %v(me).String()", baseType), doc)
doc = sfmt("This convenience method just performs a simple type conversion to %v's alias type %v.", safeName, baseType)
td.addMethod(nil, safeName, "To"+bag.safeName(baseType), baseType, sfmt("return %v(me)", baseType), doc)
me.hasElemRestrictionSimpleType.makePkg(bag)
me.hasElemList.makePkg(bag)
me.hasElemUnion.makePkg(bag)
bag.Stacks.SimpleType.Pop()
me.elemBase.afterMakePkg(bag)
}
func (me *Union) makePkg(bag *PkgBag) {
var memberTypes []string
var rtn, rtnSafeName, safeName string
me.elemBase.beforeMakePkg(bag)
me.hasElemsSimpleType.makePkg(bag)
memberTypes = ustr.Split(me.MemberTypes, " ")
for _, st := range me.SimpleTypes {
memberTypes = append(memberTypes, st.Name.String())
}
for _, mt := range memberTypes {
rtn = bag.resolveQnameRef(mt, "T", nil)
safeName, rtnSafeName = bag.safeName(ustr.PrependIf(bag.Stacks.CurSimpleType().Name.String(), "T")), bag.safeName(rtn)
bag.ctd.addMethod(me, safeName, "To"+rtnSafeName, rtn, sfmt(ustr.Ifs(bag.isParseType(rtn), "var x = new(%v); x.Set(me.String()); return *x", "return %v(me)"), rtn), sfmt("%v is an XSD union-type of several types. This is a simple type conversion to %v, but keep in mind the actual value may or may not be a valid %v value.", safeName, rtnSafeName, rtnSafeName), me.Annotation)
}
me.elemBase.afterMakePkg(bag)
}
func (me *Unique) makePkg(bag *PkgBag) {
me.elemBase.beforeMakePkg(bag)
me.hasElemField.makePkg(bag)
me.hasElemSelector.makePkg(bag)
me.elemBase.afterMakePkg(bag)
}
func anns(a *All, cc *ComplexContent) (anns []*Annotation) {
if (a != nil) && (a.Annotation != nil) {
anns = append(anns, a.Annotation)
}
if cc != nil {
if cc.Annotation != nil {
anns = append(anns, cc.Annotation)
}
if ecc := cc.ExtensionComplexContent; (ecc != nil) && (ecc.Annotation != nil) {
anns = append(anns, ecc.Annotation)
}
}
return
}
func pluralize(s string) string {
for _, psp := range PkgGen.PluralizeSpecialPrefixes {
if strings.HasPrefix(s, psp) {
return ustr.Pluralize(s[len(psp):] + s[:len(psp)])
}
}
return ustr.Pluralize(s)
}
func sfmt(s string, a ...interface{}) string {
return fmt.Sprintf(s, a...)
}
// For any rune, return a rune that is a valid in an identifier
func coerceToIdentifierRune(ch rune) rune {
if !unicode.IsLetter(ch) && !unicode.IsNumber(ch) {
return '_'
}
return ch
}
// Take any string and convert it to a valid identifier
// Appends an underscore if the first rune is a number
func safeIdentifier(s string) string {
s = strings.Map(coerceToIdentifierRune, s)
if unicode.IsNumber([]rune(s)[0]) {
s = fmt.Sprint("_", s)
}
return s
}
func subMakeElem(bag *PkgBag, td *declType, el *Element, done map[string]bool, parentMaxOccurs xsdt.Long, anns ...*Annotation) {
var elCache map[string]string
anns = append(anns, el.Annotation)
if refName := bag.elemKeys[el]; (len(refName) > 0) && (!done[refName]) {
if done[refName], elCache = true, ustr.Ifm((parentMaxOccurs == 1) && (el.hasAttrMaxOccurs.Value() == 1), bag.elemsCacheOnce, bag.elemsCacheMult); !strings.HasPrefix(elCache[refName], bag.impName+"."+idPrefix) {
td.addEmbed(el, elCache[refName], anns...)
}
}
}
func subMakeElemGroup(bag *PkgBag, td *declType, gr *Group, done map[string]bool, anns ...*Annotation) {
var refImp string
anns = append(anns, gr.Annotation)
if refName := bag.resolveQnameRef(gr.Ref.String(), "", &refImp); !done[refName] {
if done[refName] = true; len(refImp) > 0 {
if !strings.HasPrefix(refName, bag.impName+"."+idPrefix) {
td.addEmbed(gr, refImp+"."+idPrefix+"HasGroup_"+refName[(len(refImp)+1):], anns...)
}
} else {
td.addEmbed(gr, idPrefix+"HasGroup_"+refName, anns...)
}
}
}
================================================
FILE: elemparents.go
================================================
package xsd
func (me *All) initElement(parent element) {
me.elemBase.init(parent, me, "all", &me.hasAttrId, &me.hasAttrMaxOccurs, &me.hasAttrMinOccurs)
me.hasElemAnnotation.initChildren(me)
me.hasElemsElement.initChildren(me)
}
func (me *Annotation) initElement(parent element) {
me.elemBase.init(parent, me, "annotation")
me.hasElemsAppInfo.initChildren(me)
me.hasElemsDocumentation.initChildren(me)
}
func (me *Any) initElement(parent element) {
me.elemBase.init(parent, me, "any", &me.hasAttrId, &me.hasAttrNamespace, &me.hasAttrMaxOccurs, &me.hasAttrMinOccurs, &me.hasAttrProcessContents)
me.hasElemAnnotation.initChildren(me)
}
func (me *AnyAttribute) initElement(parent element) {
me.elemBase.init(parent, me, "anyAttribute", &me.hasAttrId, &me.hasAttrNamespace, &me.hasAttrProcessContents)
me.hasElemAnnotation.initChildren(me)
}
func (me *AppInfo) initElement(parent element) {
me.elemBase.init(parent, me, "appInfo", &me.hasAttrSource)
}
func (me *Attribute) initElement(parent element) {
me.elemBase.init(parent, me, "attribute", &me.hasAttrDefault, &me.hasAttrFixed, &me.hasAttrForm, &me.hasAttrId, &me.hasAttrName, &me.hasAttrRef, &me.hasAttrType, &me.hasAttrUse)
me.hasElemAnnotation.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *AttributeGroup) initElement(parent element) {
me.elemBase.init(parent, me, "attributeGroup", &me.hasAttrId, &me.hasAttrName, &me.hasAttrRef)
me.hasElemAnnotation.initChildren(me)
me.hasElemsAttribute.initChildren(me)
me.hasElemsAnyAttribute.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
}
func (me *Choice) initElement(parent element) {
me.elemBase.init(parent, me, "choice", &me.hasAttrId, &me.hasAttrMaxOccurs, &me.hasAttrMinOccurs)
me.hasElemAnnotation.initChildren(me)
me.hasElemsAny.initChildren(me)
me.hasElemsChoice.initChildren(me)
me.hasElemsElement.initChildren(me)
me.hasElemsGroup.initChildren(me)
me.hasElemsSequence.initChildren(me)
}
func (me *ComplexContent) initElement(parent element) {
me.elemBase.init(parent, me, "complexContent", &me.hasAttrId, &me.hasAttrMixed)
me.hasElemAnnotation.initChildren(me)
me.hasElemExtensionComplexContent.initChildren(me)
me.hasElemRestrictionComplexContent.initChildren(me)
}
func (me *ComplexType) initElement(parent element) {
me.elemBase.init(parent, me, "complexType", &me.hasAttrAbstract, &me.hasAttrBlock, &me.hasAttrFinal, &me.hasAttrId, &me.hasAttrMixed, &me.hasAttrName)
me.hasElemAnnotation.initChildren(me)
me.hasElemAll.initChildren(me)
me.hasElemChoice.initChildren(me)
me.hasElemsAttribute.initChildren(me)
me.hasElemGroup.initChildren(me)
me.hasElemSequence.initChildren(me)
me.hasElemComplexContent.initChildren(me)
me.hasElemSimpleContent.initChildren(me)
me.hasElemsAnyAttribute.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
}
func (me *Documentation) initElement(parent element) {
me.elemBase.init(parent, me, "documentation", &me.hasAttrLang, &me.hasAttrSource)
}
func (me *Element) initElement(parent element) {
me.elemBase.init(parent, me, "element", &me.hasAttrAbstract, &me.hasAttrBlock, &me.hasAttrDefault, &me.hasAttrFinal, &me.hasAttrFixed, &me.hasAttrForm, &me.hasAttrId, &me.hasAttrName, &me.hasAttrNillable, &me.hasAttrRef, &me.hasAttrType, &me.hasAttrMaxOccurs, &me.hasAttrMinOccurs, &me.hasAttrSubstitutionGroup)
me.hasElemAnnotation.initChildren(me)
me.hasElemUnique.initChildren(me)
me.hasElemsKey.initChildren(me)
me.hasElemComplexType.initChildren(me)
me.hasElemKeyRef.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *ExtensionComplexContent) initElement(parent element) {
me.elemBase.init(parent, me, "extension", &me.hasAttrBase, &me.hasAttrId)
me.hasElemAnnotation.initChildren(me)
me.hasElemAll.initChildren(me)
me.hasElemsAttribute.initChildren(me)
me.hasElemsChoice.initChildren(me)
me.hasElemsGroup.initChildren(me)
me.hasElemsSequence.initChildren(me)
me.hasElemsAnyAttribute.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
}
func (me *ExtensionSimpleContent) initElement(parent element) {
me.elemBase.init(parent, me, "extension", &me.hasAttrBase, &me.hasAttrId)
me.hasElemAnnotation.initChildren(me)
me.hasElemsAttribute.initChildren(me)
me.hasElemsAnyAttribute.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
}
func (me *Field) initElement(parent element) {
me.elemBase.init(parent, me, "field", &me.hasAttrId, &me.hasAttrXpath)
me.hasElemAnnotation.initChildren(me)
}
func (me *Group) initElement(parent element) {
me.elemBase.init(parent, me, "group", &me.hasAttrId, &me.hasAttrName, &me.hasAttrRef, &me.hasAttrMaxOccurs, &me.hasAttrMinOccurs)
me.hasElemAnnotation.initChildren(me)
me.hasElemAll.initChildren(me)
me.hasElemChoice.initChildren(me)
me.hasElemSequence.initChildren(me)
}
func (me *Import) initElement(parent element) {
me.elemBase.init(parent, me, "import", &me.hasAttrId, &me.hasAttrNamespace, &me.hasAttrSchemaLocation)
me.hasElemAnnotation.initChildren(me)
}
func (me *Key) initElement(parent element) {
me.elemBase.init(parent, me, "key", &me.hasAttrId, &me.hasAttrName)
me.hasElemAnnotation.initChildren(me)
me.hasElemField.initChildren(me)
me.hasElemSelector.initChildren(me)
}
func (me *KeyRef) initElement(parent element) {
me.elemBase.init(parent, me, "keyref", &me.hasAttrId, &me.hasAttrName, &me.hasAttrRefer)
me.hasElemAnnotation.initChildren(me)
me.hasElemField.initChildren(me)
me.hasElemSelector.initChildren(me)
}
func (me *List) initElement(parent element) {
me.elemBase.init(parent, me, "list", &me.hasAttrId, &me.hasAttrItemType)
me.hasElemAnnotation.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *Notation) initElement(parent element) {
me.elemBase.init(parent, me, "notation", &me.hasAttrId, &me.hasAttrName, &me.hasAttrPublic, &me.hasAttrSystem)
me.hasElemAnnotation.initChildren(me)
}
func (me *Redefine) initElement(parent element) {
me.elemBase.init(parent, me, "redefine", &me.hasAttrId, &me.hasAttrSchemaLocation)
me.hasElemAnnotation.initChildren(me)
me.hasElemsGroup.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
me.hasElemsComplexType.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *RestrictionComplexContent) initElement(parent element) {
me.elemBase.init(parent, me, "restriction", &me.hasAttrBase, &me.hasAttrId)
me.hasElemAnnotation.initChildren(me)
me.hasElemAll.initChildren(me)
me.hasElemsAttribute.initChildren(me)
me.hasElemsChoice.initChildren(me)
me.hasElemsSequence.initChildren(me)
me.hasElemsAnyAttribute.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
}
func (me *RestrictionSimpleContent) initElement(parent element) {
me.elemBase.init(parent, me, "restriction", &me.hasAttrBase, &me.hasAttrId)
me.hasElemAnnotation.initChildren(me)
me.hasElemLength.initChildren(me)
me.hasElemPattern.initChildren(me)
me.hasElemsAttribute.initChildren(me)
me.hasElemsEnumeration.initChildren(me)
me.hasElemFractionDigits.initChildren(me)
me.hasElemMaxExclusive.initChildren(me)
me.hasElemMaxInclusive.initChildren(me)
me.hasElemMaxLength.initChildren(me)
me.hasElemMinExclusive.initChildren(me)
me.hasElemMinInclusive.initChildren(me)
me.hasElemMinLength.initChildren(me)
me.hasElemTotalDigits.initChildren(me)
me.hasElemWhiteSpace.initChildren(me)
me.hasElemsAnyAttribute.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *RestrictionSimpleEnumeration) initElement(parent element) {
me.elemBase.init(parent, me, "enumeration", &me.hasAttrValue)
}
func (me *RestrictionSimpleFractionDigits) initElement(parent element) {
me.elemBase.init(parent, me, "fractionDigits", &me.hasAttrValue)
}
func (me *RestrictionSimpleLength) initElement(parent element) {
me.elemBase.init(parent, me, "length", &me.hasAttrValue)
}
func (me *RestrictionSimpleMaxExclusive) initElement(parent element) {
me.elemBase.init(parent, me, "maxExclusive", &me.hasAttrValue)
}
func (me *RestrictionSimpleMaxInclusive) initElement(parent element) {
me.elemBase.init(parent, me, "maxInclusive", &me.hasAttrValue)
}
func (me *RestrictionSimpleMaxLength) initElement(parent element) {
me.elemBase.init(parent, me, "maxLength", &me.hasAttrValue)
}
func (me *RestrictionSimpleMinExclusive) initElement(parent element) {
me.elemBase.init(parent, me, "minExclusive", &me.hasAttrValue)
}
func (me *RestrictionSimpleMinInclusive) initElement(parent element) {
me.elemBase.init(parent, me, "minInclusive", &me.hasAttrValue)
}
func (me *RestrictionSimpleMinLength) initElement(parent element) {
me.elemBase.init(parent, me, "minLength", &me.hasAttrValue)
}
func (me *RestrictionSimplePattern) initElement(parent element) {
me.elemBase.init(parent, me, "pattern", &me.hasAttrValue)
}
func (me *RestrictionSimpleTotalDigits) initElement(parent element) {
me.elemBase.init(parent, me, "totalDigits", &me.hasAttrValue)
}
func (me *RestrictionSimpleType) initElement(parent element) {
me.elemBase.init(parent, me, "restriction", &me.hasAttrBase, &me.hasAttrId)
me.hasElemAnnotation.initChildren(me)
me.hasElemLength.initChildren(me)
me.hasElemPattern.initChildren(me)
me.hasElemsEnumeration.initChildren(me)
me.hasElemFractionDigits.initChildren(me)
me.hasElemMaxExclusive.initChildren(me)
me.hasElemMaxInclusive.initChildren(me)
me.hasElemMaxLength.initChildren(me)
me.hasElemMinExclusive.initChildren(me)
me.hasElemMinInclusive.initChildren(me)
me.hasElemMinLength.initChildren(me)
me.hasElemTotalDigits.initChildren(me)
me.hasElemWhiteSpace.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *RestrictionSimpleWhiteSpace) initElement(parent element) {
me.elemBase.init(parent, me, "whiteSpace", &me.hasAttrValue)
}
func (me *Schema) initElement(parent element) {
me.elemBase.init(parent, me, "schema", &me.hasAttrId, &me.hasAttrLang, &me.hasAttrVersion, &me.hasAttrBlockDefault, &me.hasAttrFinalDefault, &me.hasAttrSchemaLocation, &me.hasAttrTargetNamespace, &me.hasAttrAttributeFormDefault, &me.hasAttrElementFormDefault)
me.hasElemAnnotation.initChildren(me)
me.hasElemsAttribute.initChildren(me)
me.hasElemsElement.initChildren(me)
me.hasElemsGroup.initChildren(me)
me.hasElemsImport.initChildren(me)
me.hasElemsNotation.initChildren(me)
me.hasElemsRedefine.initChildren(me)
me.hasElemsAttributeGroup.initChildren(me)
me.hasElemsComplexType.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *Selector) initElement(parent element) {
me.elemBase.init(parent, me, "selector", &me.hasAttrId, &me.hasAttrXpath)
me.hasElemAnnotation.initChildren(me)
}
func (me *Sequence) initElement(parent element) {
me.elemBase.init(parent, me, "sequence", &me.hasAttrId, &me.hasAttrMaxOccurs, &me.hasAttrMinOccurs)
me.hasElemAnnotation.initChildren(me)
me.hasElemsAny.initChildren(me)
me.hasElemsChoice.initChildren(me)
me.hasElemsElement.initChildren(me)
me.hasElemsGroup.initChildren(me)
me.hasElemsSequence.initChildren(me)
}
func (me *SimpleContent) initElement(parent element) {
me.elemBase.init(parent, me, "simpleContent", &me.hasAttrId)
me.hasElemAnnotation.initChildren(me)
me.hasElemExtensionSimpleContent.initChildren(me)
me.hasElemRestrictionSimpleContent.initChildren(me)
}
func (me *SimpleType) initElement(parent element) {
me.elemBase.init(parent, me, "simpleType", &me.hasAttrFinal, &me.hasAttrId, &me.hasAttrName)
me.hasElemAnnotation.initChildren(me)
me.hasElemRestrictionSimpleType.initChildren(me)
me.hasElemList.initChildren(me)
me.hasElemUnion.initChildren(me)
}
func (me *Union) initElement(parent element) {
me.elemBase.init(parent, me, "union", &me.hasAttrId, &me.hasAttrMemberTypes)
me.hasElemAnnotation.initChildren(me)
me.hasElemsSimpleType.initChildren(me)
}
func (me *Unique) initElement(parent element) {
me.elemBase.init(parent, me, "unique", &me.hasAttrId, &me.hasAttrName)
me.hasElemAnnotation.initChildren(me)
me.hasElemField.initChildren(me)
me.hasElemSelector.initChildren(me)
}
================================================
FILE: hasattr.go
================================================
package xsd
import (
xsdt "github.com/metaleap/go-xsd/types"
)
type hasAttrAbstract struct {
Abstract bool `xml:"abstract,attr"`
}
type hasAttrAttributeFormDefault struct {
AttributeFormDefault string `xml:"attributeFormDefault,attr"`
}
type hasAttrBase struct {
Base xsdt.Qname `xml:"base,attr"`
}
type hasAttrBlock struct {
Block string `xml:"block,attr"`
}
type hasAttrBlockDefault struct {
BlockDefault string `xml:"blockDefault,attr"`
}
type hasAttrDefault struct {
Default string `xml:"default,attr"`
}
type hasAttrFinal struct {
Final string `xml:"final,attr"`
}
type hasAttrFinalDefault struct {
FinalDefault string `xml:"finalDefault,attr"`
}
type hasAttrFixed struct {
Fixed string `xml:"fixed,attr"`
}
type hasAttrForm struct {
Form string `xml:"form,attr"`
}
type hasAttrElementFormDefault struct {
ElementFormDefault string `xml:"elementFormDefault,attr"`
}
type hasAttrId struct {
Id xsdt.Id `xml:"id,attr"`
}
type hasAttrItemType struct {
ItemType xsdt.Qname `xml:"itemType,attr"`
}
type hasAttrLang struct {
Lang xsdt.Language `xml:"lang,attr"`
}
type hasAttrMaxOccurs struct {
MaxOccurs string `xml:"maxOccurs,attr"`
}
func (me *hasAttrMaxOccurs) Value() (l xsdt.Long) {
if len(me.MaxOccurs) == 0 {
l = 1
} else if me.MaxOccurs == "unbounded" {
l = -1
} else {
l.Set(me.MaxOccurs)
}
return
}
type hasAttrMemberTypes struct {
MemberTypes string `xml:"memberTypes,attr"`
}
type hasAttrMinOccurs struct {
MinOccurs uint64 `xml:"minOccurs,attr"`
}
type hasAttrMixed struct {
Mixed bool `xml:"mixed,attr"`
}
type hasAttrName struct {
Name xsdt.NCName `xml:"name,attr"`
}
type hasAttrNamespace struct {
Namespace string `xml:"namespace,attr"`
}
type hasAttrNillable struct {
Nillable bool `xml:"nillable,attr"`
}
type hasAttrProcessContents struct {
ProcessContents string `xml:"processContents,attr"`
}
type hasAttrPublic struct {
Public string `xml:"public,attr"`
}
type hasAttrRef struct {
Ref xsdt.Qname `xml:"ref,attr"`
}
type hasAttrRefer struct {
Refer xsdt.Qname `xml:"refer,attr"`
}
type hasAttrSchemaLocation struct {
SchemaLocation xsdt.AnyURI `xml:"schemaLocation,attr"`
}
type hasAttrSource struct {
Source xsdt.AnyURI `xml:"source,attr"`
}
type hasAttrSubstitutionGroup struct {
SubstitutionGroup xsdt.Qname `xml:"substitutionGroup,attr"`
}
type hasAttrSystem struct {
System xsdt.AnyURI `xml:"system,attr"`
}
type hasAttrTargetNamespace struct {
TargetNamespace xsdt.AnyURI `xml:"targetNamespace,attr"`
}
type hasAttrType struct {
Type xsdt.Qname `xml:"type,attr"`
}
type hasAttrUse struct {
Use string `xml:"use,attr"`
}
type hasAttrValue struct {
Value string `xml:"value,attr"`
}
type hasAttrVersion struct {
Version xsdt.Token `xml:"version,attr"`
}
type hasAttrXpath struct {
Xpath string `xml:"xpath,attr"`
}
================================================
FILE: haselem.go
================================================
package xsd
type hasCdata struct {
CDATA string `xml:",chardata"`
}
type hasElemAll struct {
All *All `xml:"all"`
}
type hasElemAnnotation struct {
Annotation *Annotation `xml:"annotation"`
}
type hasElemsAny struct {
Anys []*Any `xml:"any"`
}
type hasElemsAnyAttribute struct {
AnyAttributes []*AnyAttribute `xml:"anyAttribute"`
}
type hasElemsAppInfo struct {
AppInfos []*AppInfo `xml:"appinfo"`
}
type hasElemsAttribute struct {
Attributes []*Attribute `xml:"attribute"`
}
type hasElemsAttributeGroup struct {
AttributeGroups []*AttributeGroup `xml:"attributeGroup"`
}
type hasElemChoice struct {
Choice *Choice `xml:"choice"`
}
type hasElemsChoice struct {
Choices []*Choice `xml:"choice"`
}
type hasElemComplexContent struct {
ComplexContent *ComplexContent `xml:"complexContent"`
}
type hasElemComplexType struct {
ComplexType *ComplexType `xml:"complexType"`
}
type hasElemsComplexType struct {
ComplexTypes []*ComplexType `xml:"complexType"`
}
type hasElemsDocumentation struct {
Documentations []*Documentation `xml:"documentation"`
}
type hasElemsElement struct {
Elements []*Element `xml:"element"`
}
type hasElemsEnumeration struct {
Enumerations []*RestrictionSimpleEnumeration `xml:"enumeration"`
}
type hasElemExtensionComplexContent struct {
ExtensionComplexContent *ExtensionComplexContent `xml:"extension"`
}
type hasElemExtensionSimpleContent struct {
ExtensionSimpleContent *ExtensionSimpleContent `xml:"extension"`
}
type hasElemField struct {
Field *Field `xml:"field"`
}
type hasElemFractionDigits struct {
FractionDigits *RestrictionSimpleFractionDigits `xml:"fractionDigits"`
}
type hasElemGroup struct {
Group *Group `xml:"group"`
}
type hasElemsGroup struct {
Groups []*Group `xml:"group"`
}
type hasElemsImport struct {
Imports []*Import `xml:"import"`
}
type hasElemsInclude struct {
Includes []*Include `xml:"include"`
}
type hasElemsKey struct {
Keys []*Key `xml:"key"`
}
type hasElemKeyRef struct {
KeyRef *KeyRef `xml:"keyref"`
}
type hasElemLength struct {
Length *RestrictionSimpleLength `xml:"length"`
}
type hasElemList struct {
List *List `xml:"list"`
}
type hasElemMaxExclusive struct {
MaxExclusive *RestrictionSimpleMaxExclusive `xml:"maxExclusive"`
}
type hasElemMaxInclusive struct {
MaxInclusive *RestrictionSimpleMaxInclusive `xml:"maxInclusive"`
}
type hasElemMaxLength struct {
MaxLength *RestrictionSimpleMaxLength `xml:"maxLength"`
}
type hasElemMinExclusive struct {
MinExclusive *RestrictionSimpleMinExclusive `xml:"minExclusive"`
}
type hasElemMinInclusive struct {
MinInclusive *RestrictionSimpleMinInclusive `xml:"minInclusive"`
}
type hasElemMinLength struct {
MinLength *RestrictionSimpleMinLength `xml:"minLength"`
}
type hasElemsNotation struct {
Notations []*Notation `xml:"notation"`
}
type hasElemPattern struct {
Pattern *RestrictionSimplePattern `xml:"pattern"`
}
type hasElemsRedefine struct {
Redefines []*Redefine `xml:"redefine"`
}
type hasElemRestrictionComplexContent struct {
RestrictionComplexContent *RestrictionComplexContent `xml:"restriction"`
}
type hasElemRestrictionSimpleContent struct {
RestrictionSimpleContent *RestrictionSimpleContent `xml:"restriction"`
}
type hasElemRestrictionSimpleType struct {
RestrictionSimpleType *RestrictionSimpleType `xml:"restriction"`
}
type hasElemSelector struct {
Selector *Selector `xml:"selector"`
}
type hasElemSequence struct {
Sequence *Sequence `xml:"sequence"`
}
type hasElemsSequence struct {
Sequences []*Sequence `xml:"sequence"`
}
type hasElemSimpleContent struct {
SimpleContent *SimpleContent `xml:"simpleContent"`
}
type hasElemsSimpleType struct {
SimpleTypes []*SimpleType `xml:"simpleType"`
}
type hasElemTotalDigits struct {
TotalDigits *RestrictionSimpleTotalDigits `xml:"totalDigits"`
}
type hasElemUnion struct {
Union *Union `xml:"union"`
}
type hasElemUnique struct {
Unique *Unique `xml:"unique"`
}
type hasElemWhiteSpace struct {
WhiteSpace *RestrictionSimpleWhiteSpace `xml:"whiteSpace"`
}
================================================
FILE: hasmakepkg.go
================================================
package xsd
func (me *hasElemAll) makePkg(bag *PkgBag) {
if me.All != nil {
me.All.makePkg(bag)
}
}
func (me *hasElemAnnotation) makePkg(bag *PkgBag) {
if me.Annotation != nil {
me.Annotation.makePkg(bag)
}
}
func (me *hasElemsAny) makePkg(bag *PkgBag) {
for _, any := range me.Anys {
any.makePkg(bag)
}
}
func (me *hasElemsAnyAttribute) makePkg(bag *PkgBag) {
for _, aa := range me.AnyAttributes {
aa.makePkg(bag)
}
}
func (me *hasElemsAppInfo) makePkg(bag *PkgBag) {
for _, ai := range me.AppInfos {
ai.makePkg(bag)
}
}
func (me *hasElemsAttribute) makePkg(bag *PkgBag) {
for _, ea := range me.Attributes {
ea.makePkg(bag)
}
}
func (me *hasElemsAttributeGroup) makePkg(bag *PkgBag) {
for _, ag := range me.AttributeGroups {
ag.makePkg(bag)
}
}
func (me *hasElemChoice) makePkg(bag *PkgBag) {
if me.Choice != nil {
me.Choice.makePkg(bag)
}
}
func (me *hasElemsChoice) makePkg(bag *PkgBag) {
for _, ch := range me.Choices {
ch.makePkg(bag)
}
}
func (me *hasElemComplexContent) makePkg(bag *PkgBag) {
if me.ComplexContent != nil {
me.ComplexContent.makePkg(bag)
}
}
func (me *hasElemComplexType) makePkg(bag *PkgBag) {
if me.ComplexType != nil {
me.ComplexType.makePkg(bag)
}
}
func (me *hasElemsComplexType) makePkg(bag *PkgBag) {
for _, ct := range me.ComplexTypes {
ct.makePkg(bag)
}
}
func (me *hasElemsDocumentation) makePkg(bag *PkgBag) {
for _, doc := range me.Documentations {
doc.makePkg(bag)
}
}
func (me *hasElemsElement) makePkg(bag *PkgBag) {
for _, el := range me.Elements {
el.makePkg(bag)
}
}
func (me *hasElemsEnumeration) makePkg(bag *PkgBag) {
for _, enum := range me.Enumerations {
enum.makePkg(bag)
}
}
func (me *hasElemExtensionComplexContent) makePkg(bag *PkgBag) {
if me.ExtensionComplexContent != nil {
me.ExtensionComplexContent.makePkg(bag)
}
}
func (me *hasElemExtensionSimpleContent) makePkg(bag *PkgBag) {
if me.ExtensionSimpleContent != nil {
me.ExtensionSimpleContent.makePkg(bag)
}
}
func (me *hasElemField) makePkg(bag *PkgBag) {
if me.Field != nil {
me.Field.makePkg(bag)
}
}
func (me *hasElemFractionDigits) makePkg(bag *PkgBag) {
if me.FractionDigits != nil {
me.FractionDigits.makePkg(bag)
}
}
func (me *hasElemGroup) makePkg(bag *PkgBag) {
if me.Group != nil {
me.Group.makePkg(bag)
}
}
func (me *hasElemsGroup) makePkg(bag *PkgBag) {
for _, gr := range me.Groups {
gr.makePkg(bag)
}
}
func (me *hasElemsImport) makePkg(bag *PkgBag) {
for _, imp := range me.Imports {
imp.makePkg(bag)
}
}
func (me *hasElemsKey) makePkg(bag *PkgBag) {
for _, k := range me.Keys {
k.makePkg(bag)
}
}
func (me *hasElemKeyRef) makePkg(bag *PkgBag) {
if me.KeyRef != nil {
me.KeyRef.makePkg(bag)
}
}
func (me *hasElemLength) makePkg(bag *PkgBag) {
if me.Length != nil {
me.Length.makePkg(bag)
}
}
func (me *hasElemList) makePkg(bag *PkgBag) {
if me.List != nil {
me.List.makePkg(bag)
}
}
func (me *hasElemMaxExclusive) makePkg(bag *PkgBag) {
if me.MaxExclusive != nil {
me.MaxExclusive.makePkg(bag)
}
}
func (me *hasElemMaxInclusive) makePkg(bag *PkgBag) {
if me.MaxInclusive != nil {
me.MaxInclusive.makePkg(bag)
}
}
func (me *hasElemMaxLength) makePkg(bag *PkgBag) {
if me.MaxLength != nil {
me.MaxLength.makePkg(bag)
}
}
func (me *hasElemMinExclusive) makePkg(bag *PkgBag) {
if me.MinExclusive != nil {
me.MinExclusive.makePkg(bag)
}
}
func (me *hasElemMinInclusive) makePkg(bag *PkgBag) {
if me.MinInclusive != nil {
me.MinInclusive.makePkg(bag)
}
}
func (me *hasElemMinLength) makePkg(bag *PkgBag) {
if me.MinLength != nil {
me.MinLength.makePkg(bag)
}
}
func (me *hasElemsNotation) makePkg(bag *PkgBag) {
for _, not := range me.Notations {
not.makePkg(bag)
}
}
func (me *hasElemPattern) makePkg(bag *PkgBag) {
if me.Pattern != nil {
me.Pattern.makePkg(bag)
}
}
func (me *hasElemsRedefine) makePkg(bag *PkgBag) {
for _, rd := range me.Redefines {
rd.makePkg(bag)
}
}
func (me *hasElemRestrictionComplexContent) makePkg(bag *PkgBag) {
if me.RestrictionComplexContent != nil {
me.RestrictionComplexContent.makePkg(bag)
}
}
func (me *hasElemRestrictionSimpleContent) makePkg(bag *PkgBag) {
if me.RestrictionSimpleContent != nil {
me.RestrictionSimpleContent.makePkg(bag)
}
}
func (me *hasElemRestrictionSimpleType) makePkg(bag *PkgBag) {
if me.RestrictionSimpleType != nil {
me.RestrictionSimpleType.makePkg(bag)
}
}
func (me *hasElemSelector) makePkg(bag *PkgBag) {
if me.Selector != nil {
me.Selector.makePkg(bag)
}
}
func (me *hasElemSequence) makePkg(bag *PkgBag) {
if me.Sequence != nil {
me.Sequence.makePkg(bag)
}
}
func (me *hasElemsSequence) makePkg(bag *PkgBag) {
for _, seq := range me.Sequences {
seq.makePkg(bag)
}
}
func (me *hasElemSimpleContent) makePkg(bag *PkgBag) {
if me.SimpleContent != nil {
me.SimpleContent.makePkg(bag)
}
}
func (me *hasElemsSimpleType) makePkg(bag *PkgBag) {
for _, st := range me.SimpleTypes {
st.makePkg(bag)
}
}
func (me *hasElemTotalDigits) makePkg(bag *PkgBag) {
if me.TotalDigits != nil {
me.TotalDigits.makePkg(bag)
}
}
func (me *hasElemUnion) makePkg(bag *PkgBag) {
if me.Union != nil {
me.Union.makePkg(bag)
}
}
func (me *hasElemUnique) makePkg(bag *PkgBag) {
if me.Unique != nil {
me.Unique.makePkg(bag)
}
}
func (me *hasElemWhiteSpace) makePkg(bag *PkgBag) {
if me.WhiteSpace != nil {
me.WhiteSpace.makePkg(bag)
}
}
func (me *hasAttrAbstract) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrBase) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrBlock) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrDefault) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrFinal) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrFixed) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrForm) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrId) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrLang) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrMixed) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrName) beforeMakePkg(bag *PkgBag) {
bag.Stacks.Name.Push(me.Name)
}
func (me *hasAttrNamespace) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrNillable) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrPublic) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrRef) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrRefer) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrSource) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrSystem) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrType) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrUse) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrValue) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrVersion) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrXpath) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrBlockDefault) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrFinalDefault) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrItemType) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrMaxOccurs) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrMemberTypes) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrMinOccurs) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrProcessContents) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrSchemaLocation) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrSubstitutionGroup) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrTargetNamespace) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrAttributeFormDefault) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrElementFormDefault) beforeMakePkg(bag *PkgBag) {
}
func (me *hasAttrAbstract) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrBase) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrBlock) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrDefault) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrFinal) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrFixed) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrForm) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrId) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrLang) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrMixed) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrName) afterMakePkg(bag *PkgBag) {
bag.Stacks.Name.Pop()
}
func (me *hasAttrNamespace) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrNillable) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrPublic) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrRef) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrRefer) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrSource) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrSystem) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrType) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrUse) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrValue) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrVersion) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrXpath) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrBlockDefault) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrFinalDefault) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrItemType) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrMaxOccurs) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrMemberTypes) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrMinOccurs) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrProcessContents) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrSchemaLocation) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrSubstitutionGroup) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrTargetNamespace) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrAttributeFormDefault) afterMakePkg(bag *PkgBag) {
}
func (me *hasAttrElementFormDefault) afterMakePkg(bag *PkgBag) {
}
================================================
FILE: hasparents.go
================================================
package xsd
func (me *hasElemAll) initChildren(p element) {
if me.All != nil {
me.All.initElement(p)
}
}
func (me *hasElemAnnotation) initChildren(p element) {
if me.Annotation != nil {
me.Annotation.initElement(p)
}
}
func (me *hasElemsAny) initChildren(p element) {
for _, any := range me.Anys {
any.initElement(p)
}
}
func (me *hasElemsAnyAttribute) initChildren(p element) {
for _, aa := range me.AnyAttributes {
aa.initElement(p)
}
}
func (me *hasElemsAppInfo) initChildren(p element) {
for _, ai := range me.AppInfos {
ai.initElement(p)
}
}
func (me *hasElemsAttribute) initChildren(p element) {
for _, ea := range me.Attributes {
ea.initElement(p)
}
}
func (me *hasElemsAttributeGroup) initChildren(p element) {
for _, ag := range me.AttributeGroups {
ag.initElement(p)
}
}
func (me *hasElemChoice) initChildren(p element) {
if me.Choice != nil {
me.Choice.initElement(p)
}
}
func (me *hasElemsChoice) initChildren(p element) {
for _, ch := range me.Choices {
ch.initElement(p)
}
}
func (me *hasElemComplexContent) initChildren(p element) {
if me.ComplexContent != nil {
me.ComplexContent.initElement(p)
}
}
func (me *hasElemComplexType) initChildren(p element) {
if me.ComplexType != nil {
me.ComplexType.initElement(p)
}
}
func (me *hasElemsComplexType) initChildren(p element) {
for _, ct := range me.ComplexTypes {
ct.initElement(p)
}
}
func (me *hasElemsDocumentation) initChildren(p element) {
for _, doc := range me.Documentations {
doc.initElement(p)
}
}
func (me *hasElemsElement) initChildren(p element) {
for _, el := range me.Elements {
el.initElement(p)
}
}
func (me *hasElemsEnumeration) initChildren(p element) {
for _, enum := range me.Enumerations {
enum.initElement(p)
}
}
func (me *hasElemExtensionComplexContent) initChildren(p element) {
if me.ExtensionComplexContent != nil {
me.ExtensionComplexContent.initElement(p)
}
}
func (me *hasElemExtensionSimpleContent) initChildren(p element) {
if me.ExtensionSimpleContent != nil {
me.ExtensionSimpleContent.initElement(p)
}
}
func (me *hasElemField) initChildren(p element) {
if me.Field != nil {
me.Field.initElement(p)
}
}
func (me *hasElemFractionDigits) initChildren(p element) {
if me.FractionDigits != nil {
me.FractionDigits.initElement(p)
}
}
func (me *hasElemGroup) initChildren(p element) {
if me.Group != nil {
me.Group.initElement(p)
}
}
func (me *hasElemsGroup) initChildren(p element) {
for _, gr := range me.Groups {
gr.initElement(p)
}
}
func (me *hasElemsImport) initChildren(p element) {
for _, imp := range me.Imports {
imp.initElement(p)
}
}
func (me *hasElemsKey) initChildren(p element) {
for _, k := range me.Keys {
k.initElement(p)
}
}
func (me *hasElemKeyRef) initChildren(p element) {
if me.KeyRef != nil {
me.KeyRef.initElement(p)
}
}
func (me *hasElemLength) initChildren(p element) {
if me.Length != nil {
me.Length.initElement(p)
}
}
func (me *hasElemList) initChildren(p element) {
if me.List != nil {
me.List.initElement(p)
}
}
func (me *hasElemMaxExclusive) initChildren(p element) {
if me.MaxExclusive != nil {
me.MaxExclusive.initElement(p)
}
}
func (me *hasElemMaxInclusive) initChildren(p element) {
if me.MaxInclusive != nil {
me.MaxInclusive.initElement(p)
}
}
func (me *hasElemMaxLength) initChildren(p element) {
if me.MaxLength != nil {
me.MaxLength.initElement(p)
}
}
func (me *hasElemMinExclusive) initChildren(p element) {
if me.MinExclusive != nil {
me.MinExclusive.initElement(p)
}
}
func (me *hasElemMinInclusive) initChildren(p element) {
if me.MinInclusive != nil {
me.MinInclusive.initElement(p)
}
}
func (me *hasElemMinLength) initChildren(p element) {
if me.MinLength != nil {
me.MinLength.initElement(p)
}
}
func (me *hasElemsNotation) initChildren(p element) {
for _, not := range me.Notations {
not.initElement(p)
}
}
func (me *hasElemPattern) initChildren(p element) {
if me.Pattern != nil {
me.Pattern.initElement(p)
}
}
func (me *hasElemsRedefine) initChildren(p element) {
for _, rd := range me.Redefines {
rd.initElement(p)
}
}
func (me *hasElemRestrictionComplexContent) initChildren(p element) {
if me.RestrictionComplexContent != nil {
me.RestrictionComplexContent.initElement(p)
}
}
func (me *hasElemRestrictionSimpleContent) initChildren(p element) {
if me.RestrictionSimpleContent != nil {
me.RestrictionSimpleContent.initElement(p)
}
}
func (me *hasElemRestrictionSimpleType) initChildren(p element) {
if me.RestrictionSimpleType != nil {
me.RestrictionSimpleType.initElement(p)
}
}
func (me *hasElemSelector) initChildren(p element) {
if me.Selector != nil {
me.Selector.initElement(p)
}
}
func (me *hasElemSequence) initChildren(p element) {
if me.Sequence != nil {
me.Sequence.initElement(p)
}
}
func (me *hasElemsSequence) initChildren(p element) {
for _, seq := range me.Sequences {
seq.initElement(p)
}
}
func (me *hasElemSimpleContent) initChildren(p element) {
if me.SimpleContent != nil {
me.SimpleContent.initElement(p)
}
}
func (me *hasElemsSimpleType) initChildren(p element) {
for _, st := range me.SimpleTypes {
st.initElement(p)
}
}
func (me *hasElemTotalDigits) initChildren(p element) {
if me.TotalDigits != nil {
me.TotalDigits.initElement(p)
}
}
func (me *hasElemUnion) initChildren(p element) {
if me.Union != nil {
me.Union.initElement(p)
}
}
func (me *hasElemUnique) initChildren(p element) {
if me.Unique != nil {
me.Unique.initElement(p)
}
}
func (me *hasElemWhiteSpace) initChildren(p element) {
if me.WhiteSpace != nil {
me.WhiteSpace.initElement(p)
}
}
================================================
FILE: makepkg.go
================================================
package xsd
import (
"fmt"
"path"
"strings"
"github.com/metaleap/go-util/dev/go"
"github.com/metaleap/go-util/slice"
"github.com/metaleap/go-util/str"
xsdt "github.com/metaleap/go-xsd/types"
)
var (
PkgGen = &pkgGen{
BaseCodePath: udevgo.GopathSrcGithub("metaleap", "go-xsd-pkg"),
BasePath: "github.com/metaleap/go-xsd-pkg",
ForceParseForDefaults: false,
PluralizeSpecialPrefixes: []string{"Library", "Instance"},
AddWalkers: true,
}
typeRenderRepls = map[string]string{"*": "", "[": "", "]": "", "(list ": "", ")": ""}
)
type pkgGen struct {
BaseCodePath, BasePath string
ForceParseForDefaults bool
PluralizeSpecialPrefixes []string
AddWalkers bool
}
type beforeAfterMake interface {
afterMakePkg(*PkgBag)
beforeMakePkg(*PkgBag)
}
type pkgStack []interface{}
func (me *pkgStack) Pop() (el interface{}) { sl := *me; el = sl[0]; *me = sl[1:]; return }
func (me *pkgStack) Push(el interface{}) { nu := []interface{}{el}; *me = append(nu, *me...) }
type pkgStacks struct {
Name, SimpleType pkgStack
}
func (me *pkgStacks) CurName() (r xsdt.NCName) {
if len(me.Name) > 0 {
r = me.Name[0].(xsdt.NCName)
}
return
}
func (me *pkgStacks) CurSimpleType() (r *SimpleType) {
if len(me.SimpleType) > 0 {
r = me.SimpleType[0].(*SimpleType)
}
return
}
func (me *pkgStacks) FullName() (r string) {
for _, name := range me.Name {
r += name.(xsdt.NCName).String()
}
return
}
type PkgBag struct {
Schema *Schema
Stacks pkgStacks
allAtts []*Attribute
allAttGroups []*AttributeGroup
allElems []*Element
allElemGroups []*Group
allNotations []*Notation
ctd *declType
lines []string
impName string
debug bool
imports, attsCache, elemsCacheOnce, elemsCacheMult, simpleBaseTypes, simpleContentValueTypes map[string]string
impsUsed, elemsWritten, parseTypes, walkerTypes, declConvs map[string]bool
anonCounts map[string]uint64
attGroups, attGroupRefImps map[*AttributeGroup]string
attsKeys, attRefImps map[*Attribute]string
declTypes map[string]*declType
declElemTypes map[element][]*declType
declWrittenTypes []*declType
elemGroups, elemGroupRefImps map[*Group]string
elemChoices, elemChoiceRefImps map[*Choice]string
elemSeqs, elemSeqRefImps map[*Sequence]string
elemKeys, elemRefImps map[*Element]string
}
func newPkgBag(schema *Schema) (bag *PkgBag) {
var newImpname = true
bag = &PkgBag{Schema: schema}
bag.impName = "xsdt"
for i := 0; newImpname; i++ {
newImpname = false
loadedSchemas := make(map[string]bool)
for _, s := range schema.allSchemas(loadedSchemas) {
for ns := range s.XMLNamespaces {
if ns == bag.impName {
newImpname = true
break
}
}
}
if newImpname {
bag.impName = sfmt("xsdt", i)
}
}
bag.imports, bag.impsUsed, bag.lines = map[string]string{}, map[string]bool{}, []string{"//\tAuto-generated by the \"go-xsd\" package located at:", "//\t\tgithub.com/metaleap/go-xsd", "//\tComments on types and fields (if any) are from the XSD file located at:", "//\t\t" + bag.Schema.loadUri, "package go_" + bag.safeName(ustr.Replace(path.Base(bag.Schema.RootSchema([]string{bag.Schema.loadUri}).loadUri), map[string]string{"xsd": "", "schema": ""})), ""}
bag.imports[bag.impName] = "github.com/metaleap/go-xsd/types"
bag.anonCounts, bag.declTypes, bag.declElemTypes = map[string]uint64{}, map[string]*declType{}, map[element][]*declType{}
bag.simpleContentValueTypes, bag.attsCache, bag.elemsCacheOnce, bag.elemsCacheMult, bag.simpleBaseTypes = map[string]string{}, map[string]string{}, map[string]string{}, map[string]string{}, map[string]string{}
bag.attGroups, bag.attGroupRefImps = map[*AttributeGroup]string{}, map[*AttributeGroup]string{}
bag.attsKeys, bag.attRefImps = map[*Attribute]string{}, map[*Attribute]string{}
bag.elemGroups, bag.elemGroupRefImps = map[*Group]string{}, map[*Group]string{}
bag.elemKeys, bag.elemRefImps = map[*Element]string{}, map[*Element]string{}
bag.elemsWritten, bag.parseTypes, bag.walkerTypes, bag.declConvs = map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{}
for _, pt := range []string{"Boolean", "Byte", "Double", "Float", "Int", "Integer", "Long", "NegativeInteger", "NonNegativeInteger", "NonPositiveInteger", "PositiveInteger", "Short", "UnsignedByte", "UnsignedInt", "UnsignedLong", "UnsignedShort"} {
bag.parseTypes[bag.impName+"."+pt] = true
}
bag.addType(nil, idPrefix+"HasCdata", "").addField(nil, idPrefix+"CDATA", "string", ",chardata")
return
}
func (me *PkgBag) addType(elem element, n, t string, a ...*Annotation) (dt *declType) {
dt = &declType{elem: elem, Name: n, Type: t, Annotations: a}
dt.Embeds, dt.Fields, dt.Methods, dt.memberWritten = map[string]*declEmbed{}, map[string]*declField{}, map[string]*declMethod{}, map[string]bool{}
me.ctd, me.declTypes[n] = dt, dt
if elem != nil {
me.declElemTypes[elem] = append(me.declElemTypes[elem], dt)
}
return
}
func (me *PkgBag) AnonName(n string) (an xsdt.NCName) {
var c uint64
n = "Txsd" + n
an = xsdt.NCName(n)
if c = me.anonCounts[n]; c > 0 {
an += xsdt.NCName(fmt.Sprintf("%v", c))
}
me.anonCounts[n] = c + 1
return
}
func (me *PkgBag) append(lines ...string) {
me.lines = append(me.lines, lines...)
}
func (me *PkgBag) appendFmt(addLineAfter bool, format string, fmtArgs ...interface{}) {
me.append(fmt.Sprintf(format, fmtArgs...))
if addLineAfter {
me.append("")
}
}
func (me *PkgBag) assembleSource() string {
var (
dt *declType
render = func(el element) {
for _, dt = range me.declElemTypes[el] {
if dt != nil {
dt.render(me)
}
}
}
initLines = me.lines
snConv string
)
me.lines = []string{}
loadedSchemas := make(map[string]bool)
me.Schema.collectGlobals(me, loadedSchemas)
if len(me.allNotations) > 0 {
me.impsUsed[me.impName] = true
me.appendFmt(false, "var %sNotations = new(%s.Notations)\n\nfunc init () {", idPrefix, me.impName)
for _, not := range me.allNotations {
not.makePkg(me)
}
me.appendFmt(true, "}")
}
for _, att := range me.allAtts {
render(att)
}
for _, attGr := range me.allAttGroups {
render(attGr)
}
for _, el := range me.allElems {
render(el)
}
for _, gr := range me.allElemGroups {
render(gr)
}
for _, dt := range me.declTypes {
dt.render(me)
}
if len(me.walkerTypes) > 0 {
doc := sfmt("//\tProvides %v strong-typed hooks for your own custom handler functions to be invoked when the Walk() method is called on any instance of any (non-attribute-related) struct type defined in this package.\n//\tIf your custom handler does get called at all for a given struct instance, then it always gets called twice, first with the 'enter' bool argument set to true, then (after having Walk()ed all subordinate struct instances, if any) once again with it set to false.", len(me.walkerTypes))
me.appendFmt(true, `var (
// Set this to false to break a Walk() immediately as soon as the first error is returned by a custom handler function.
// If true, Walk() proceeds and accumulates all errors in the WalkErrors slice.
WalkContinueOnError = true
// Contains all errors accumulated during Walk()s. If you're using this, you need to reset this yourself as needed prior to a fresh Walk().
WalkErrors []error
// Your custom error-handling function, if required.
WalkOnError func(error)
%s
WalkHandlers = &%sWalkHandlers {}
)`, doc, idPrefix)
me.appendFmt(false, doc)
me.appendFmt(false, "type %vWalkHandlers struct {", idPrefix)
for wt := range me.walkerTypes {
me.appendFmt(false, "\t%s func (*%s, bool) (error)", wt, wt)
}
me.appendFmt(true, "}")
}
for conv := range me.declConvs {
snConv = me.safeName(conv)
me.appendFmt(false, "//\tA convenience interface that declares a type conversion to %v.", conv)
me.appendFmt(true, "type To%v interface { To%v () %v }", snConv, snConv, conv)
}
initLines = append(initLines, "import (")
for impName, impPath := range me.imports {
if me.impsUsed[impName] {
if len(impPath) > 0 {
initLines = append(initLines, sfmt("\t%s \"%s\"", impName, impPath))
} else {
initLines = append(initLines, sfmt("\t\"%s\"", impName))
}
}
}
initLines = append(initLines, ")", "")
return strings.Join(append(initLines, me.lines...), "\n")
}
func (me *PkgBag) checkType(typeSpec string) {
var dt *declType
tn := ustr.Replace(typeSpec, typeRenderRepls)
if dt = me.declTypes[tn]; (dt != nil) && (len(dt.EquivalentTo) > 0) {
tn = dt.EquivalentTo
dt = me.declTypes[tn]
}
if pos := strings.Index(tn, "."); pos > 0 {
me.impsUsed[tn[:pos]] = true
}
if dt != nil {
dt.render(me)
} // else if (tn != "string") && (tn != "bool") && (len(tn) > 0) && !strings.Contains(tn, ".") { println("TYPE NOT FOUND: " + tn) }
}
func (me *PkgBag) isParseType(typeRef string) bool {
for pt := range me.parseTypes {
if typeRef == pt {
return true
}
}
return false
}
func (me *PkgBag) resolveQnameRef(ref, pref string, noUsageRec *string) string {
var ns = me.Schema.XMLNamespaces[""]
var impName = ""
if len(ref) == 0 {
return ""
}
if pos := strings.Index(ref, ":"); pos > 0 {
impName, ns = ref[:pos], me.Schema.XMLNamespaces[ref[:pos]]
impName = safeIdentifier(impName)
ref = ref[(pos + 1):]
}
if ns == xsdNamespaceUri {
impName, pref = me.impName, ""
}
if ns == me.Schema.TargetNamespace.String() {
impName = ""
}
if noUsageRec == nil { /*me.impsUsed[impName] = true*/
} else {
*noUsageRec = impName
}
return ustr.PrefixWithSep(impName, ".", me.safeName(ustr.PrependIf(ref, pref)))
}
func (me *PkgBag) rewriteTypeSpec(typeSpec string) (tn string) {
tn = ustr.Replace(typeSpec, typeRenderRepls)
if dt := me.declTypes[tn]; (dt != nil) && (len(dt.EquivalentTo) > 0) {
tn = strings.Replace(typeSpec, tn, dt.EquivalentTo, -1)
} else {
tn = typeSpec
}
return
}
func (me *PkgBag) safeName(name string) string {
return ustr.SafeIdentifier(name)
}
func (me *PkgBag) xsdStringTypeRef() string {
return ustr.PrefixWithSep(me.Schema.XSDNamespacePrefix, ":", "string")
}
type declEmbed struct {
Name string
Annotations []*Annotation
elem element
finalTypeName string
}
func (me *declEmbed) render(bag *PkgBag, dt *declType) {
if n := bag.rewriteTypeSpec(me.Name); !dt.memberWritten["E_"+n] {
dt.memberWritten["E_"+n] = true
for _, ann := range me.Annotations {
if ann != nil {
ann.makePkg(bag)
}
}
me.finalTypeName = bag.rewriteTypeSpec(n)
bag.appendFmt(true, "\t%s", me.finalTypeName)
}
}
type declField struct {
Name, Type, XmlTag string
Annotations []*Annotation
elem element
finalTypeName string
}
func (me *declField) render(bag *PkgBag, dt *declType) {
for _, ann := range me.Annotations {
if ann != nil {
ann.makePkg(bag)
}
}
me.finalTypeName = bag.rewriteTypeSpec(me.Type)
bag.appendFmt(true, "\t%s %s `xml:\"%s\"`", me.Name, me.finalTypeName, me.XmlTag)
}
type declMethod struct {
Body, Doc, Name, ReceiverType, ReturnType string
Annotations []*Annotation
elem element
}
func (me *declMethod) render(bag *PkgBag, dt *declType) {
for _, ann := range me.Annotations {
if ann != nil {
ann.makePkg(bag)
}
}
bag.appendFmt(false, "//\t%s", me.Doc)
rt := bag.rewriteTypeSpec(me.ReturnType)
bag.appendFmt(true, "func (me %s) %s %s { %s }", bag.rewriteTypeSpec(me.ReceiverType), ustr.Ifs(strings.Contains(me.Name, "("), me.Name, me.Name+" ()"), rt, strings.Replace(me.Body, me.ReturnType, rt, -1))
}
type declType struct {
EquivalentTo, Name, Type string
Embeds map[string]*declEmbed
Annotations []*Annotation
Fields map[string]*declField
Methods map[string]*declMethod
elem element
memberWritten map[string]bool
rendered bool
}
func (me *declType) addAnnotations(a ...*Annotation) {
me.Annotations = append(me.Annotations, a...)
}
func (me *declType) addField(elem element, n, t, x string, a ...*Annotation) (f *declField) {
f = &declField{elem: elem, Name: n, Type: t, XmlTag: x, Annotations: a}
me.Fields[n] = f
return
}
func (me *declType) addEmbed(elem element, name string, a ...*Annotation) (e *declEmbed) {
e = &declEmbed{elem: elem, Name: name, Annotations: a}
me.Embeds[name] = e
return
}
func (me *declType) addMethod(elem element, recType, name, retType, body, doc string, a ...*Annotation) (m *declMethod) {
m = &declMethod{elem: elem, Body: body, Doc: doc, Name: name, ReceiverType: recType, ReturnType: retType, Annotations: a}
me.Methods[name] = m
return
}
func (me *declType) checkForEquivalents(bag *PkgBag) {
if (len(me.EquivalentTo) == 0) && (strings.HasPrefix(me.Name, "Txsd") || strings.HasPrefix(me.Name, idPrefix)) {
for _, dt := range bag.declWrittenTypes {
if (dt != me) && (len(dt.EquivalentTo) == 0) && me.equivalentTo(dt) {
me.EquivalentTo = dt.Name
}
}
}
}
func (me *declType) equivalentTo(dt *declType) bool {
var sme, sdt []string
if me.Type != dt.Type {
return false
}
if len(me.Embeds) != len(dt.Embeds) {
return false
}
if len(me.Fields) != len(dt.Fields) {
return false
}
sme, sdt = []string{}, []string{}
for e := range me.Embeds {
sme = append(sme, e)
}
for e := range dt.Embeds {
sdt = append(sdt, e)
}
if !uslice.StrEquivalent(sme, sdt) {
return false
}
sme, sdt = []string{}, []string{}
for _, f := range me.Fields {
sme = append(sme, f.Name+f.Type+f.XmlTag)
}
for _, f := range dt.Fields {
sdt = append(sdt, f.Name+f.Type+f.XmlTag)
}
if !uslice.StrEquivalent(sme, sdt) {
return false
}
sme, sdt = []string{}, []string{}
for _, m := range me.Methods {
if m.Name != "Walk" {
sme = append(sme, m.Name+m.ReturnType+m.Body)
}
}
for _, m := range dt.Methods {
if m.Name != "Walk" {
sdt = append(sdt, m.Name+m.ReturnType+m.Body)
}
}
if !uslice.StrEquivalent(sme, sdt) {
return false
}
return true
}
func (me *declType) render(bag *PkgBag) {
if !me.rendered {
me.rendered = true
if me.checkForEquivalents(bag); len(me.EquivalentTo) == 0 {
var myName = me.Name
for _, ann := range me.Annotations {
if ann != nil {
ann.makePkg(bag)
}
}
for _, e := range me.Embeds {
bag.checkType(e.Name)
}
for _, f := range me.Fields {
bag.checkType(f.Type)
}
for _, m := range me.Methods {
bag.checkType(m.ReturnType)
}
if len(me.Type) > 0 {
bag.checkType(me.Type)
bag.appendFmt(true, "type %s %s", myName, me.Type)
} else {
bag.appendFmt(false, "type %s struct {", myName)
for _, f := range me.Fields {
f.render(bag, me)
}
for _, e := range me.Embeds {
e.render(bag, me)
}
bag.appendFmt(true, "}")
if PkgGen.AddWalkers && !strings.HasPrefix(myName, idPrefix+"HasAtt") {
errCheck := sfmt("%s.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) { return }", bag.impName)
fnCall := "\t\tif fn != nil { if err = fn(me, %v); %s }"
walkBody := sfmt("\n\tif fn := WalkHandlers.%s; me != nil {\n%s\n", myName, sfmt(fnCall, true, errCheck))
ec, fc := 0, 0
bag.walkerTypes[myName] = true
for _, e := range me.Embeds {
if bag.walkerTypes[e.finalTypeName] {
ec++
walkBody += sfmt("\t\tif err = me.%s.Walk(); %s\n", e.finalTypeName, errCheck)
}
}
for _, f := range me.Fields {
if bag.walkerTypes[strings.Replace(f.finalTypeName, "*", "", -1)] {
fc++
walkBody += sfmt("\t\tif err = me.%v.Walk(); %s\n", f.Name, errCheck)
} else if strings.HasPrefix(f.finalTypeName, "[]") && bag.walkerTypes[ustr.Replace(f.finalTypeName, typeRenderRepls)] {
walkBody += sfmt("\t\tfor _, x := range me.%s { if err = x.Walk(); %s }\n", f.Name, errCheck)
}
}
walkBody += sfmt("%s\n}\n\treturn\n", sfmt(fnCall, false, errCheck))
me.addMethod(nil, "*"+myName, "Walk", "(err error)", walkBody, sfmt("If the WalkHandlers.%v function is not nil (ie. was set by outside code), calls it with this %v instance as the single argument. Then calls the Walk() method on %v/%v embed(s) and %v/%v field(s) belonging to this %v instance.", myName, myName, ec, len(me.Embeds), fc, len(me.Fields), myName))
}
}
bag.declWrittenTypes = append(bag.declWrittenTypes, me)
for _, m := range me.Methods {
m.render(bag, me)
}
}
}
}
================================================
FILE: types/README.md
================================================
# xsdt
--
import "github.com/metaleap/go-xsd/types"
A tiny package imported by all "go-xsd"-generated packages.
Maps all XSD built-in simple-types to Go types, which affords us easy mapping of
any XSD type references in the schema to Go imports: every xs:string and
xs:boolean automatically becomes xsdt.String and xsdt.Boolean etc. Types are
mapped to Go types depending on how encoding/xml.Unmarshal() can handle them:
ie. it parses bools and numbers, but dates/durations have too many format
mismatches and thus are just declared string types. Same for base64- and
hex-encoded binary data: since Unmarshal() won't decode them, we leave them as
strings. If you need their binary data, your code needs to import Go's
base64/hex codec packages and use them as necessary.
## Usage
#### func ListValues
```go
func ListValues(v string) (spl []string)
```
XSD "list" types are always space-separated strings. All generated Go types
based on any XSD's list types get a Values() method, which will always resort to
this function.
#### func ListValuesBoolean
```go
func ListValuesBoolean(vals []Boolean) (sl []bool)
```
#### func ListValuesDouble
```go
func ListValuesDouble(vals []Double) (sl []float64)
```
#### func ListValuesLong
```go
func ListValuesLong(vals []Long) (sl []int64)
```
#### func OnWalkError
```go
func OnWalkError(err *error, slice *[]error, breakWalk bool, handler func(error)) (ret bool)
```
A helper function for the Walk() functionality of generated wrapper packages.
#### type AnySimpleType
```go
type AnySimpleType string
```
In XSD, the type xsd:anySimpleType is the base type from which all other
built-in types are derived.
#### func (*AnySimpleType) Set
```go
func (me *AnySimpleType) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (AnySimpleType) String
```go
func (me AnySimpleType) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type AnyType
```go
type AnyType string
```
In XSD, represents any simple or complex type. In Go, we hope no one schema ever
uses it.
#### func (*AnyType) Set
```go
func (me *AnyType) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (AnyType) String
```go
func (me AnyType) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type AnyURI
```go
type AnyURI string
```
Represents a URI as defined by RFC 2396. An anyURI value can be absolute or
relative, and may have an optional fragment identifier.
#### func (*AnyURI) Set
```go
func (me *AnyURI) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (AnyURI) String
```go
func (me AnyURI) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Base64Binary
```go
type Base64Binary string // []byte
```
Represents Base64-encoded arbitrary binary data. A base64Binary is the set of
finite-length sequences of binary octets.
#### func (*Base64Binary) Set
```go
func (me *Base64Binary) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Base64Binary) String
```go
func (me Base64Binary) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Boolean
```go
type Boolean bool
```
Represents Boolean values, which are either true or false.
#### func (Boolean) B
```go
func (me Boolean) B() bool
```
Because littering your code with type conversions is a hassle...
#### func (*Boolean) Set
```go
func (me *Boolean) Set(v string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Boolean) String
```go
func (me Boolean) String() string
```
Returns a string representation of its current non-string scalar value.
#### type Byte
```go
type Byte int8
```
Represents an integer with a minimum value of -128 and maximum of 127.
#### func (Byte) N
```go
func (me Byte) N() int8
```
Because littering your code with type conversions is a hassle...
#### func (*Byte) Set
```go
func (me *Byte) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Byte) String
```go
func (me Byte) String() string
```
Returns a string representation of its current non-string scalar value.
#### type Date
```go
type Date string // time.Time
```
Represents a calendar date. The pattern for date is CCYY-MM-DD with optional
time zone indicator as allowed for dateTime.
#### func (*Date) Set
```go
func (me *Date) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Date) String
```go
func (me Date) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type DateTime
```go
type DateTime string // time.Time
```
Represents a specific instance of time.
#### func (*DateTime) Set
```go
func (me *DateTime) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (DateTime) String
```go
func (me DateTime) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Decimal
```go
type Decimal string // complex128
```
Represents arbitrary precision numbers.
#### func (*Decimal) Set
```go
func (me *Decimal) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Decimal) String
```go
func (me Decimal) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Double
```go
type Double float64
```
Represents double-precision 64-bit floating-point numbers.
#### func (Double) N
```go
func (me Double) N() float64
```
Because littering your code with type conversions is a hassle...
#### func (*Double) Set
```go
func (me *Double) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Double) String
```go
func (me Double) String() string
```
Returns a string representation of its current non-string scalar value.
#### type Duration
```go
type Duration string // time.Duration
```
Represents a duration of time.
#### func (*Duration) Set
```go
func (me *Duration) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Duration) String
```go
func (me Duration) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Entities
```go
type Entities string
```
Represents the ENTITIES attribute type. Contains a set of values of type ENTITY.
#### func (*Entities) Set
```go
func (me *Entities) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Entities) String
```go
func (me Entities) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### func (Entities) Values
```go
func (me Entities) Values() (list []Entity)
```
This type declares a String containing a whitespace-separated list of values.
This Values() method creates and returns a slice of all elements in that list.
#### type Entity
```go
type Entity NCName
```
This is a reference to an unparsed entity with a name that matches the specified
name.
#### func (*Entity) Set
```go
func (me *Entity) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Entity) String
```go
func (me Entity) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Float
```go
type Float float32
```
Represents single-precision 32-bit floating-point numbers.
#### func (Float) N
```go
func (me Float) N() float32
```
Because littering your code with type conversions is a hassle...
#### func (*Float) Set
```go
func (me *Float) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Float) String
```go
func (me Float) String() string
```
Returns a string representation of its current non-string scalar value.
#### type GDay
```go
type GDay string
```
Represents a Gregorian day that recurs, specifically a day of the month such as
the fifth day of the month. A gDay is the space of a set of calendar dates.
Specifically, it is a set of one-day long, monthly periodic instances.
#### func (*GDay) Set
```go
func (me *GDay) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (GDay) String
```go
func (me GDay) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type GMonth
```go
type GMonth string
```
Represents a Gregorian month that recurs every year. A gMonth is the space of a
set of calendar months. Specifically, it is a set of one-month long, yearly
periodic instances.
#### func (*GMonth) Set
```go
func (me *GMonth) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (GMonth) String
```go
func (me GMonth) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type GMonthDay
```go
type GMonthDay string
```
Represents a specific Gregorian date that recurs, specifically a day of the year
such as the third of May. A gMonthDay is the set of calendar dates.
Specifically, it is a set of one-day long, annually periodic instances.
#### func (*GMonthDay) Set
```go
func (me *GMonthDay) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (GMonthDay) String
```go
func (me GMonthDay) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type GYear
```go
type GYear string
```
Represents a Gregorian year. A set of one-year long, nonperiodic instances.
#### func (*GYear) Set
```go
func (me *GYear) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (GYear) String
```go
func (me GYear) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type GYearMonth
```go
type GYearMonth string
```
Represents a specific Gregorian month in a specific Gregorian year. A set of
one-month long, nonperiodic instances.
#### func (*GYearMonth) Set
```go
func (me *GYearMonth) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (GYearMonth) String
```go
func (me GYearMonth) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type HexBinary
```go
type HexBinary string // []byte
```
Represents arbitrary hex-encoded binary data. A hexBinary is the set of
finite-length sequences of binary octets. Each binary octet is encoded as a
character tuple, consisting of two hexadecimal digits ([0-9a-fA-F]) representing
the octet code.
#### func (*HexBinary) Set
```go
func (me *HexBinary) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (HexBinary) String
```go
func (me HexBinary) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Id
```go
type Id NCName
```
The ID must be a no-colon-name (NCName) and must be unique within an XML
document.
#### func (*Id) Set
```go
func (me *Id) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Id) String
```go
func (me Id) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Idref
```go
type Idref NCName
```
Represents a reference to an element that has an ID attribute that matches the
specified ID. An IDREF must be an NCName and must be a value of an element or
attribute of type ID within the XML document.
#### func (*Idref) Set
```go
func (me *Idref) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Idref) String
```go
func (me Idref) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Idrefs
```go
type Idrefs string
```
Contains a set of values of type IDREF.
#### func (*Idrefs) Set
```go
func (me *Idrefs) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Idrefs) String
```go
func (me Idrefs) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### func (Idrefs) Values
```go
func (me Idrefs) Values() (list []Idref)
```
This type declares a String containing a whitespace-separated list of values.
This Values() method creates and returns a slice of all elements in that list.
#### type Int
```go
type Int int32
```
Represents an integer with a minimum value of -2147483648 and maximum of
2147483647.
#### func (Int) N
```go
func (me Int) N() int32
```
Because littering your code with type conversions is a hassle...
#### func (*Int) Set
```go
func (me *Int) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Int) String
```go
func (me Int) String() string
```
Returns a string representation of its current non-string scalar value.
#### type Integer
```go
type Integer int64
```
Represents a sequence of decimal digits with an optional leading sign (+ or -).
#### func (Integer) N
```go
func (me Integer) N() int64
```
Because littering your code with type conversions is a hassle...
#### func (*Integer) Set
```go
func (me *Integer) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Integer) String
```go
func (me Integer) String() string
```
Returns a string representation of its current non-string scalar value.
#### type Language
```go
type Language Token
```
Represents natural language identifiers (defined by RFC 1766).
#### func (*Language) Set
```go
func (me *Language) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Language) String
```go
func (me Language) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Long
```go
type Long int64
```
Represents an integer with a minimum value of -9223372036854775808 and maximum
of 9223372036854775807.
#### func (Long) N
```go
func (me Long) N() int64
```
Because littering your code with type conversions is a hassle...
#### func (*Long) Set
```go
func (me *Long) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Long) String
```go
func (me Long) String() string
```
Returns a string representation of its current non-string scalar value.
#### type NCName
```go
type NCName Name
```
Represents noncolonized names. This data type is the same as Name, except it
cannot begin with a colon.
#### func (*NCName) Set
```go
func (me *NCName) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (NCName) String
```go
func (me NCName) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Name
```go
type Name Token
```
Represents names in XML. A Name is a token that begins with a letter,
underscore, or colon and continues with name characters (letters, digits, and
other characters).
#### func (*Name) Set
```go
func (me *Name) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Name) String
```go
func (me Name) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type NegativeInteger
```go
type NegativeInteger int64
```
Represents an integer that is less than zero. Consists of a negative sign (-)
and sequence of decimal digits.
#### func (NegativeInteger) N
```go
func (me NegativeInteger) N() int64
```
Because littering your code with type conversions is a hassle...
#### func (*NegativeInteger) Set
```go
func (me *NegativeInteger) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (NegativeInteger) String
```go
func (me NegativeInteger) String() string
```
Returns a string representation of its current non-string scalar value.
#### type Nmtoken
```go
type Nmtoken Token
```
An NMTOKEN is set of name characters (letters, digits, and other characters) in
any combination. Unlike Name and NCName, NMTOKEN has no restrictions on the
starting character.
#### func (*Nmtoken) Set
```go
func (me *Nmtoken) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Nmtoken) String
```go
func (me Nmtoken) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Nmtokens
```go
type Nmtokens string
```
Contains a set of values of type NMTOKEN.
#### func (*Nmtokens) Set
```go
func (me *Nmtokens) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Nmtokens) String
```go
func (me Nmtokens) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### func (Nmtokens) Values
```go
func (me Nmtokens) Values() (list []Nmtoken)
```
This type declares a String containing a whitespace-separated list of values.
This Values() method creates and returns a slice of all elements in that list.
#### type NonNegativeInteger
```go
type NonNegativeInteger uint64
```
Represents an integer that is greater than or equal to zero.
#### func (NonNegativeInteger) N
```go
func (me NonNegativeInteger) N() uint64
```
Because littering your code with type conversions is a hassle...
#### func (*NonNegativeInteger) Set
```go
func (me *NonNegativeInteger) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (NonNegativeInteger) String
```go
func (me NonNegativeInteger) String() string
```
Returns a string representation of its current non-string scalar value.
#### type NonPositiveInteger
```go
type NonPositiveInteger int64
```
Represents an integer that is less than or equal to zero. A
nonPositiveIntegerconsists of a negative sign (-) and sequence of decimal
digits.
#### func (NonPositiveInteger) N
```go
func (me NonPositiveInteger) N() int64
```
Because littering your code with type conversions is a hassle...
#### func (*NonPositiveInteger) Set
```go
func (me *NonPositiveInteger) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (NonPositiveInteger) String
```go
func (me NonPositiveInteger) String() string
```
Returns a string representation of its current non-string scalar value.
#### type NormalizedString
```go
type NormalizedString String
```
Represents white space normalized strings.
#### func (*NormalizedString) Set
```go
func (me *NormalizedString) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (NormalizedString) String
```go
func (me NormalizedString) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Notation
```go
type Notation string
```
A set of QNames.
#### func (*Notation) Set
```go
func (me *Notation) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Notation) String
```go
func (me Notation) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### func (Notation) Values
```go
func (me Notation) Values() (list []Qname)
```
This type declares a String containing a whitespace-separated list of values.
This Values() method creates and returns a slice of all elements in that list.
#### type Notations
```go
type Notations map[string]*notation
```
#### func (Notations) Add
```go
func (me Notations) Add(id, name, public, system string)
```
#### type PositiveInteger
```go
type PositiveInteger uint64
```
Represents an integer that is greater than zero.
#### func (PositiveInteger) N
```go
func (me PositiveInteger) N() uint64
```
Because littering your code with type conversions is a hassle...
#### func (*PositiveInteger) Set
```go
func (me *PositiveInteger) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (PositiveInteger) String
```go
func (me PositiveInteger) String() string
```
Returns a string representation of its current non-string scalar value.
#### type Qname
```go
type Qname string
```
Represents a qualified name. A qualified name is composed of a prefix and a
local name separated by a colon. Both the prefix and local names must be an
NCName. The prefix must be associated with a namespace URI reference, using a
namespace declaration.
#### func (*Qname) Set
```go
func (me *Qname) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Qname) String
```go
func (me Qname) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Short
```go
type Short int16
```
Represents an integer with a minimum value of -32768 and maximum of 32767.
#### func (Short) N
```go
func (me Short) N() int16
```
Because littering your code with type conversions is a hassle...
#### func (*Short) Set
```go
func (me *Short) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (Short) String
```go
func (me Short) String() string
```
Returns a string representation of its current non-string scalar value.
#### type String
```go
type String string
```
Represents character strings.
#### func (*String) Set
```go
func (me *String) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (String) String
```go
func (me String) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type Time
```go
type Time string // time.Time
```
Represents a specific instance of time.
#### func (*Time) Set
```go
func (me *Time) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Time) String
```go
func (me Time) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type ToXsdtAnySimpleType
```go
type ToXsdtAnySimpleType interface {
ToXsdtAnySimpleType() AnySimpleType
}
```
A convenience interface that declares a type conversion to AnySimpleType.
#### type ToXsdtAnyType
```go
type ToXsdtAnyType interface {
ToXsdtAnyType() AnyType
}
```
A convenience interface that declares a type conversion to AnyType.
#### type ToXsdtAnyURI
```go
type ToXsdtAnyURI interface {
ToXsdtAnyURI() AnyURI
}
```
A convenience interface that declares a type conversion to AnyURI.
#### type ToXsdtBase64Binary
```go
type ToXsdtBase64Binary interface {
ToXsdtBase64Binary() Base64Binary
}
```
A convenience interface that declares a type conversion to Base64Binary.
#### type ToXsdtBoolean
```go
type ToXsdtBoolean interface {
ToXsdtBoolean() Boolean
}
```
A convenience interface that declares a type conversion to Boolean.
#### type ToXsdtByte
```go
type ToXsdtByte interface {
ToXsdtByte() Byte
}
```
A convenience interface that declares a type conversion to Byte.
#### type ToXsdtDate
```go
type ToXsdtDate interface {
ToXsdtDate() Date
}
```
A convenience interface that declares a type conversion to Date.
#### type ToXsdtDateTime
```go
type ToXsdtDateTime interface {
ToXsdtDateTime() DateTime
}
```
A convenience interface that declares a type conversion to DateTime.
#### type ToXsdtDecimal
```go
type ToXsdtDecimal interface {
ToXsdtDecimal() Decimal
}
```
A convenience interface that declares a type conversion to Decimal.
#### type ToXsdtDouble
```go
type ToXsdtDouble interface {
ToXsdtDouble() Double
}
```
A convenience interface that declares a type conversion to Double.
#### type ToXsdtDuration
```go
type ToXsdtDuration interface {
ToXsdtDuration() Duration
}
```
A convenience interface that declares a type conversion to Duration.
#### type ToXsdtEntities
```go
type ToXsdtEntities interface {
ToXsdtEntities() Entities
}
```
A convenience interface that declares a type conversion to Entities.
#### type ToXsdtEntity
```go
type ToXsdtEntity interface {
ToXsdtEntity() Entity
}
```
A convenience interface that declares a type conversion to Entity.
#### type ToXsdtFloat
```go
type ToXsdtFloat interface {
ToXsdtFloat() Float
}
```
A convenience interface that declares a type conversion to Float.
#### type ToXsdtGDay
```go
type ToXsdtGDay interface {
ToXsdtGDay() GDay
}
```
A convenience interface that declares a type conversion to GDay.
#### type ToXsdtGMonth
```go
type ToXsdtGMonth interface {
ToXsdtGMonth() GMonth
}
```
A convenience interface that declares a type conversion to GMonth.
#### type ToXsdtGMonthDay
```go
type ToXsdtGMonthDay interface {
ToXsdtGMonthDay() GMonthDay
}
```
A convenience interface that declares a type conversion to GMonthDay.
#### type ToXsdtGYear
```go
type ToXsdtGYear interface {
ToXsdtGYear() GYear
}
```
A convenience interface that declares a type conversion to GYear.
#### type ToXsdtGYearMonth
```go
type ToXsdtGYearMonth interface {
ToXsdtGYearMonth() GYearMonth
}
```
A convenience interface that declares a type conversion to GYearMonth.
#### type ToXsdtHexBinary
```go
type ToXsdtHexBinary interface {
ToXsdtHexBinary() HexBinary
}
```
A convenience interface that declares a type conversion to HexBinary.
#### type ToXsdtId
```go
type ToXsdtId interface {
ToXsdtId() Id
}
```
A convenience interface that declares a type conversion to Id.
#### type ToXsdtIdref
```go
type ToXsdtIdref interface {
ToXsdtIdref() Idref
}
```
A convenience interface that declares a type conversion to Idref.
#### type ToXsdtIdrefs
```go
type ToXsdtIdrefs interface {
ToXsdtIdrefs() Idrefs
}
```
A convenience interface that declares a type conversion to Idrefs.
#### type ToXsdtInt
```go
type ToXsdtInt interface {
ToXsdtInt() Int
}
```
A convenience interface that declares a type conversion to Int.
#### type ToXsdtInteger
```go
type ToXsdtInteger interface {
ToXsdtInteger() Integer
}
```
A convenience interface that declares a type conversion to Integer.
#### type ToXsdtLanguage
```go
type ToXsdtLanguage interface {
ToXsdtLanguage() Language
}
```
A convenience interface that declares a type conversion to Language.
#### type ToXsdtLong
```go
type ToXsdtLong interface {
ToXsdtLong() Long
}
```
A convenience interface that declares a type conversion to Long.
#### type ToXsdtNCName
```go
type ToXsdtNCName interface {
ToXsdtNCName() NCName
}
```
A convenience interface that declares a type conversion to NCName.
#### type ToXsdtName
```go
type ToXsdtName interface {
ToXsdtName() Name
}
```
A convenience interface that declares a type conversion to Name.
#### type ToXsdtNegativeInteger
```go
type ToXsdtNegativeInteger interface {
ToXsdtNegativeInteger() NegativeInteger
}
```
A convenience interface that declares a type conversion to NegativeInteger.
#### type ToXsdtNmtoken
```go
type ToXsdtNmtoken interface {
ToXsdtNmtoken() Nmtoken
}
```
A convenience interface that declares a type conversion to Nmtoken.
#### type ToXsdtNmtokens
```go
type ToXsdtNmtokens interface {
ToXsdtNmtokens() Nmtokens
}
```
A convenience interface that declares a type conversion to Nmtokens.
#### type ToXsdtNonNegativeInteger
```go
type ToXsdtNonNegativeInteger interface {
ToXsdtNonNegativeInteger() NonNegativeInteger
}
```
A convenience interface that declares a type conversion to NonNegativeInteger.
#### type ToXsdtNonPositiveInteger
```go
type ToXsdtNonPositiveInteger interface {
ToXsdtNonPositiveInteger() NonPositiveInteger
}
```
A convenience interface that declares a type conversion to NonPositiveInteger.
#### type ToXsdtNormalizedString
```go
type ToXsdtNormalizedString interface {
ToXsdtNormalizedS() NormalizedString
}
```
A convenience interface that declares a type conversion to NormalizedString.
#### type ToXsdtNotation
```go
type ToXsdtNotation interface {
ToXsdtNotation() Notation
}
```
A convenience interface that declares a type conversion to Notation.
#### type ToXsdtPositiveInteger
```go
type ToXsdtPositiveInteger interface {
ToXsdtPositiveInteger() PositiveInteger
}
```
A convenience interface that declares a type conversion to PositiveInteger.
#### type ToXsdtQname
```go
type ToXsdtQname interface {
ToXsdtQname() Qname
}
```
A convenience interface that declares a type conversion to Qname.
#### type ToXsdtShort
```go
type ToXsdtShort interface {
ToXsdtShort() Short
}
```
A convenience interface that declares a type conversion to Short.
#### type ToXsdtString
```go
type ToXsdtString interface {
ToXsdtString() String
}
```
A convenience interface that declares a type conversion to String.
#### type ToXsdtTime
```go
type ToXsdtTime interface {
ToXsdtTime() Time
}
```
A convenience interface that declares a type conversion to Time.
#### type ToXsdtToken
```go
type ToXsdtToken interface {
ToXsdtToken() Token
}
```
A convenience interface that declares a type conversion to Token.
#### type ToXsdtUnsignedByte
```go
type ToXsdtUnsignedByte interface {
ToXsdtUnsignedByte() UnsignedByte
}
```
A convenience interface that declares a type conversion to UnsignedByte.
#### type ToXsdtUnsignedInt
```go
type ToXsdtUnsignedInt interface {
ToXsdtUnsignedInt() UnsignedInt
}
```
A convenience interface that declares a type conversion to UnsignedInt.
#### type ToXsdtUnsignedLong
```go
type ToXsdtUnsignedLong interface {
ToXsdtUnsignedLong() UnsignedLong
}
```
A convenience interface that declares a type conversion to UnsignedLong.
#### type ToXsdtUnsignedShort
```go
type ToXsdtUnsignedShort interface {
ToXsdtUnsignedShort() UnsignedShort
}
```
A convenience interface that declares a type conversion to UnsignedShort.
#### type Token
```go
type Token NormalizedString
```
Represents tokenized strings.
#### func (*Token) Set
```go
func (me *Token) Set(v string)
```
Since this is just a simple String type, this merely sets the current value from
the specified string.
#### func (Token) String
```go
func (me Token) String() string
```
Since this is just a simple String type, this merely returns its current string
value.
#### type UnsignedByte
```go
type UnsignedByte uint8
```
Represents an integer with a minimum of zero and maximum of 255.
#### func (UnsignedByte) N
```go
func (me UnsignedByte) N() uint8
```
Because littering your code with type conversions is a hassle...
#### func (*UnsignedByte) Set
```go
func (me *UnsignedByte) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (UnsignedByte) String
```go
func (me UnsignedByte) String() string
```
Returns a string representation of its current non-string scalar value.
#### type UnsignedInt
```go
type UnsignedInt uint32
```
Represents an integer with a minimum of zero and maximum of 4294967295.
#### func (UnsignedInt) N
```go
func (me UnsignedInt) N() uint32
```
Because littering your code with type conversions is a hassle...
#### func (*UnsignedInt) Set
```go
func (me *UnsignedInt) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (UnsignedInt) String
```go
func (me UnsignedInt) String() string
```
Returns a string representation of its current non-string scalar value.
#### type UnsignedLong
```go
type UnsignedLong uint64
```
Represents an integer with a minimum of zero and maximum of
18446744073709551615.
#### func (UnsignedLong) N
```go
func (me UnsignedLong) N() uint64
```
Because littering your code with type conversions is a hassle...
#### func (*UnsignedLong) Set
```go
func (me *UnsignedLong) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (UnsignedLong) String
```go
func (me UnsignedLong) String() string
```
Returns a string representation of its current non-string scalar value.
#### type UnsignedShort
```go
type UnsignedShort uint16
```
Represents an integer with a minimum of zero and maximum of 65535.
#### func (UnsignedShort) N
```go
func (me UnsignedShort) N() uint16
```
Because littering your code with type conversions is a hassle...
#### func (*UnsignedShort) Set
```go
func (me *UnsignedShort) Set(s string)
```
Since this is a non-string scalar type, sets its current value obtained from
parsing the specified string.
#### func (UnsignedShort) String
```go
func (me UnsignedShort) String() string
```
Returns a string representation of its current non-string scalar value.
--
**godocdown** http://github.com/robertkrimen/godocdown
================================================
FILE: types/doc.go
================================================
// A tiny package imported by all "go-xsd"-generated packages.
//
// Maps all XSD built-in simple-types to Go types, which affords us easy mapping of any XSD type references in the schema to Go imports: every xs:string and xs:boolean automatically becomes xsdt.String and xsdt.Boolean etc.
// Types are mapped to Go types depending on how encoding/xml.Unmarshal() can handle them: ie. it parses bools and numbers, but dates/durations have too many format mismatches and thus are just declared string types.
// Same for base64- and hex-encoded binary data: since Unmarshal() won't decode them, we leave them as strings. If you need their binary data, your code needs to import Go's base64/hex codec packages and use them as necessary.
package xsdt
================================================
FILE: types/xsdtypes.go
================================================
package xsdt
import (
"strconv"
)
type notation struct {
Id, Name, Public, System string
}
type Notations map[string]*notation
func (me Notations) Add(id, name, public, system string) {
me[name] = ¬ation{Id: id, Name: name, Public: public, System: system}
}
// In XSD, the type xsd:anySimpleType is the base type from which all other built-in types are derived.
type AnySimpleType string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *AnySimpleType) Set(v string) {
*me = AnySimpleType(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me AnySimpleType) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to AnySimpleType.
type ToXsdtAnySimpleType interface {
ToXsdtAnySimpleType() AnySimpleType
}
// In XSD, represents any simple or complex type. In Go, we hope no one schema ever uses it.
type AnyType string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *AnyType) Set(v string) {
*me = AnyType(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me AnyType) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to AnyType.
type ToXsdtAnyType interface {
ToXsdtAnyType() AnyType
}
// Represents a URI as defined by RFC 2396. An anyURI value can be absolute or relative, and may have an optional fragment identifier.
type AnyURI string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *AnyURI) Set(v string) {
*me = AnyURI(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me AnyURI) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to AnyURI.
type ToXsdtAnyURI interface {
ToXsdtAnyURI() AnyURI
}
// Represents Base64-encoded arbitrary binary data. A base64Binary is the set of finite-length sequences of binary octets.
type Base64Binary string // []byte
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Base64Binary) Set(v string) {
*me = Base64Binary(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Base64Binary) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Base64Binary.
type ToXsdtBase64Binary interface {
ToXsdtBase64Binary() Base64Binary
}
// Represents Boolean values, which are either true or false.
type Boolean bool
// Because littering your code with type conversions is a hassle...
func (me Boolean) B() bool {
return bool(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Boolean) Set(v string) {
// most schemas use true and false but sadly, a very few rare ones *do* use "0" and "1"...
switch v {
case "0":
*me = false
case "1":
*me = true
default:
b, _ := strconv.ParseBool(v)
*me = Boolean(b)
}
}
// Returns a string representation of its current non-string scalar value.
func (me Boolean) String() string {
return strconv.FormatBool(bool(me))
}
// A convenience interface that declares a type conversion to Boolean.
type ToXsdtBoolean interface {
ToXsdtBoolean() Boolean
}
// Represents an integer with a minimum value of -128 and maximum of 127.
type Byte int8
// Because littering your code with type conversions is a hassle...
func (me Byte) N() int8 {
return int8(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Byte) Set(s string) {
v, _ := strconv.ParseInt(s, 0, 8)
*me = Byte(v)
}
// Returns a string representation of its current non-string scalar value.
func (me Byte) String() string {
return strconv.FormatInt(int64(me), 10)
}
// A convenience interface that declares a type conversion to Byte.
type ToXsdtByte interface {
ToXsdtByte() Byte
}
// Represents a calendar date.
// The pattern for date is CCYY-MM-DD with optional time zone indicator as allowed for dateTime.
type Date string // time.Time
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Date) Set(v string) {
*me = Date(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Date) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Date.
type ToXsdtDate interface {
ToXsdtDate() Date
}
// Represents a specific instance of time.
type DateTime string // time.Time
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *DateTime) Set(v string) {
*me = DateTime(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me DateTime) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to DateTime.
type ToXsdtDateTime interface {
ToXsdtDateTime() DateTime
}
// Represents a specific instance of time.
type Time string // time.Time
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Time) Set(v string) {
*me = Time(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Time) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Time.
type ToXsdtTime interface {
ToXsdtTime() Time
}
// Represents arbitrary precision numbers.
type Decimal string // complex128
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Decimal) Set(v string) {
*me = Decimal(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Decimal) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Decimal.
type ToXsdtDecimal interface {
ToXsdtDecimal() Decimal
}
// Represents double-precision 64-bit floating-point numbers.
type Double float64
// Because littering your code with type conversions is a hassle...
func (me Double) N() float64 {
return float64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Double) Set(s string) {
v, _ := strconv.ParseFloat(s, 64)
*me = Double(v)
}
// Returns a string representation of its current non-string scalar value.
func (me Double) String() string {
return strconv.FormatFloat(float64(me), 'f', 8, 64)
}
// A convenience interface that declares a type conversion to Double.
type ToXsdtDouble interface {
ToXsdtDouble() Double
}
// Represents a duration of time.
type Duration string // time.Duration
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Duration) Set(v string) {
*me = Duration(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Duration) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Duration.
type ToXsdtDuration interface {
ToXsdtDuration() Duration
}
// Represents the ENTITIES attribute type. Contains a set of values of type ENTITY.
type Entities string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Entities) Set(v string) {
*me = Entities(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Entities) String() string {
return string(me)
}
// This type declares a String containing a whitespace-separated list of values. This Values() method creates and returns a slice of all elements in that list.
func (me Entities) Values() (list []Entity) {
spl := ListValues(string(me))
list = make([]Entity, len(spl))
for i, s := range spl {
list[i].Set(s)
}
return
}
// A convenience interface that declares a type conversion to Entities.
type ToXsdtEntities interface {
ToXsdtEntities() Entities
}
// This is a reference to an unparsed entity with a name that matches the specified name.
type Entity NCName
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Entity) Set(v string) {
*me = Entity(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Entity) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Entity.
type ToXsdtEntity interface {
ToXsdtEntity() Entity
}
// Represents single-precision 32-bit floating-point numbers.
type Float float32
// Because littering your code with type conversions is a hassle...
func (me Float) N() float32 {
return float32(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Float) Set(s string) {
v, _ := strconv.ParseFloat(s, 32)
*me = Float(v)
}
// Returns a string representation of its current non-string scalar value.
func (me Float) String() string {
return strconv.FormatFloat(float64(me), 'f', 8, 32)
}
// A convenience interface that declares a type conversion to Float.
type ToXsdtFloat interface {
ToXsdtFloat() Float
}
// Represents a Gregorian day that recurs, specifically a day of the month such as the fifth day of the month. A gDay is the space of a set of calendar dates. Specifically, it is a set of one-day long, monthly periodic instances.
type GDay string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *GDay) Set(v string) {
*me = GDay(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me GDay) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to GDay.
type ToXsdtGDay interface {
ToXsdtGDay() GDay
}
// Represents a Gregorian month that recurs every year. A gMonth is the space of a set of calendar months. Specifically, it is a set of one-month long, yearly periodic instances.
type GMonth string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *GMonth) Set(v string) {
*me = GMonth(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me GMonth) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to GMonth.
type ToXsdtGMonth interface {
ToXsdtGMonth() GMonth
}
// Represents a specific Gregorian date that recurs, specifically a day of the year such as the third of May. A gMonthDay is the set of calendar dates. Specifically, it is a set of one-day long, annually periodic instances.
type GMonthDay string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *GMonthDay) Set(v string) {
*me = GMonthDay(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me GMonthDay) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to GMonthDay.
type ToXsdtGMonthDay interface {
ToXsdtGMonthDay() GMonthDay
}
// Represents a Gregorian year. A set of one-year long, nonperiodic instances.
type GYear string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *GYear) Set(v string) {
*me = GYear(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me GYear) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to GYear.
type ToXsdtGYear interface {
ToXsdtGYear() GYear
}
// Represents a specific Gregorian month in a specific Gregorian year. A set of one-month long, nonperiodic instances.
type GYearMonth string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *GYearMonth) Set(v string) {
*me = GYearMonth(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me GYearMonth) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to GYearMonth.
type ToXsdtGYearMonth interface {
ToXsdtGYearMonth() GYearMonth
}
// Represents arbitrary hex-encoded binary data. A hexBinary is the set of finite-length sequences of binary octets. Each binary octet is encoded as a character tuple, consisting of two hexadecimal digits ([0-9a-fA-F]) representing the octet code.
type HexBinary string // []byte
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *HexBinary) Set(v string) {
*me = HexBinary(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me HexBinary) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to HexBinary.
type ToXsdtHexBinary interface {
ToXsdtHexBinary() HexBinary
}
// The ID must be a no-colon-name (NCName) and must be unique within an XML document.
type Id NCName
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Id) Set(v string) {
*me = Id(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Id) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Id.
type ToXsdtId interface {
ToXsdtId() Id
}
// Represents a reference to an element that has an ID attribute that matches the specified ID. An IDREF must be an NCName and must be a value of an element or attribute of type ID within the XML document.
type Idref NCName
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Idref) Set(v string) {
*me = Idref(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Idref) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Idref.
type ToXsdtIdref interface {
ToXsdtIdref() Idref
}
// Contains a set of values of type IDREF.
type Idrefs string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Idrefs) Set(v string) {
*me = Idrefs(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Idrefs) String() string {
return string(me)
}
// This type declares a String containing a whitespace-separated list of values. This Values() method creates and returns a slice of all elements in that list.
func (me Idrefs) Values() (list []Idref) {
spl := ListValues(string(me))
list = make([]Idref, len(spl))
for i, s := range spl {
list[i].Set(s)
}
return
}
// A convenience interface that declares a type conversion to Idrefs.
type ToXsdtIdrefs interface {
ToXsdtIdrefs() Idrefs
}
// Represents an integer with a minimum value of -2147483648 and maximum of 2147483647.
type Int int32
// Because littering your code with type conversions is a hassle...
func (me Int) N() int32 {
return int32(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Int) Set(s string) {
v, _ := strconv.ParseInt(s, 0, 32)
*me = Int(v)
}
// Returns a string representation of its current non-string scalar value.
func (me Int) String() string {
return strconv.FormatInt(int64(me), 10)
}
// A convenience interface that declares a type conversion to Int.
type ToXsdtInt interface {
ToXsdtInt() Int
}
// Represents a sequence of decimal digits with an optional leading sign (+ or -).
type Integer int64
// Because littering your code with type conversions is a hassle...
func (me Integer) N() int64 {
return int64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Integer) Set(s string) {
v, _ := strconv.ParseInt(s, 0, 64)
*me = Integer(v)
}
// Returns a string representation of its current non-string scalar value.
func (me Integer) String() string {
return strconv.FormatInt(int64(me), 10)
}
// A convenience interface that declares a type conversion to Integer.
type ToXsdtInteger interface {
ToXsdtInteger() Integer
}
// Represents natural language identifiers (defined by RFC 1766).
type Language Token
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Language) Set(v string) {
*me = Language(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Language) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Language.
type ToXsdtLanguage interface {
ToXsdtLanguage() Language
}
// Represents an integer with a minimum value of -9223372036854775808 and maximum of 9223372036854775807.
type Long int64
// Because littering your code with type conversions is a hassle...
func (me Long) N() int64 {
return int64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Long) Set(s string) {
v, _ := strconv.ParseInt(s, 0, 64)
*me = Long(v)
}
// Returns a string representation of its current non-string scalar value.
func (me Long) String() string {
return strconv.FormatInt(int64(me), 10)
}
// A convenience interface that declares a type conversion to Long.
type ToXsdtLong interface {
ToXsdtLong() Long
}
// Represents names in XML. A Name is a token that begins with a letter, underscore, or colon and continues with name characters (letters, digits, and other characters).
type Name Token
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Name) Set(v string) {
*me = Name(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Name) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Name.
type ToXsdtName interface {
ToXsdtName() Name
}
// Represents noncolonized names. This data type is the same as Name, except it cannot begin with a colon.
type NCName Name
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *NCName) Set(v string) {
*me = NCName(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me NCName) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to NCName.
type ToXsdtNCName interface {
ToXsdtNCName() NCName
}
// Represents an integer that is less than zero. Consists of a negative sign (-) and sequence of decimal digits.
type NegativeInteger int64
// Because littering your code with type conversions is a hassle...
func (me NegativeInteger) N() int64 {
return int64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *NegativeInteger) Set(s string) {
v, _ := strconv.ParseInt(s, 0, 64)
*me = NegativeInteger(v)
}
// Returns a string representation of its current non-string scalar value.
func (me NegativeInteger) String() string {
return strconv.FormatInt(int64(me), 10)
}
// A convenience interface that declares a type conversion to NegativeInteger.
type ToXsdtNegativeInteger interface {
ToXsdtNegativeInteger() NegativeInteger
}
// An NMTOKEN is set of name characters (letters, digits, and other characters) in any combination. Unlike Name and NCName, NMTOKEN has no restrictions on the starting character.
type Nmtoken Token
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Nmtoken) Set(v string) {
*me = Nmtoken(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Nmtoken) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Nmtoken.
type ToXsdtNmtoken interface {
ToXsdtNmtoken() Nmtoken
}
// Contains a set of values of type NMTOKEN.
type Nmtokens string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Nmtokens) Set(v string) {
*me = Nmtokens(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Nmtokens) String() string {
return string(me)
}
// This type declares a String containing a whitespace-separated list of values. This Values() method creates and returns a slice of all elements in that list.
func (me Nmtokens) Values() (list []Nmtoken) {
spl := ListValues(string(me))
list = make([]Nmtoken, len(spl))
for i, s := range spl {
list[i].Set(s)
}
return
}
// A convenience interface that declares a type conversion to Nmtokens.
type ToXsdtNmtokens interface {
ToXsdtNmtokens() Nmtokens
}
// Represents an integer that is greater than or equal to zero.
type NonNegativeInteger uint64
// Because littering your code with type conversions is a hassle...
func (me NonNegativeInteger) N() uint64 {
return uint64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *NonNegativeInteger) Set(s string) {
v, _ := strconv.ParseUint(s, 0, 64)
*me = NonNegativeInteger(v)
}
// Returns a string representation of its current non-string scalar value.
func (me NonNegativeInteger) String() string {
return strconv.FormatUint(uint64(me), 10)
}
// A convenience interface that declares a type conversion to NonNegativeInteger.
type ToXsdtNonNegativeInteger interface {
ToXsdtNonNegativeInteger() NonNegativeInteger
}
// Represents an integer that is less than or equal to zero. A nonPositiveIntegerconsists of a negative sign (-) and sequence of decimal digits.
type NonPositiveInteger int64
// Because littering your code with type conversions is a hassle...
func (me NonPositiveInteger) N() int64 {
return int64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *NonPositiveInteger) Set(s string) {
v, _ := strconv.ParseInt(s, 0, 64)
*me = NonPositiveInteger(v)
}
// Returns a string representation of its current non-string scalar value.
func (me NonPositiveInteger) String() string {
return strconv.FormatInt(int64(me), 10)
}
// A convenience interface that declares a type conversion to NonPositiveInteger.
type ToXsdtNonPositiveInteger interface {
ToXsdtNonPositiveInteger() NonPositiveInteger
}
// Represents white space normalized strings.
type NormalizedString String
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *NormalizedString) Set(v string) {
*me = NormalizedString(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me NormalizedString) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to NormalizedString.
type ToXsdtNormalizedString interface {
ToXsdtNormalizedS() NormalizedString
}
// A set of QNames.
type Notation string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Notation) Set(v string) {
*me = Notation(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Notation) String() string {
return string(me)
}
// This type declares a String containing a whitespace-separated list of values. This Values() method creates and returns a slice of all elements in that list.
func (me Notation) Values() (list []Qname) {
spl := ListValues(string(me))
list = make([]Qname, len(spl))
for i, s := range spl {
list[i].Set(s)
}
return
}
// A convenience interface that declares a type conversion to Notation.
type ToXsdtNotation interface {
ToXsdtNotation() Notation
}
// Represents an integer that is greater than zero.
type PositiveInteger uint64
// Because littering your code with type conversions is a hassle...
func (me PositiveInteger) N() uint64 {
return uint64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *PositiveInteger) Set(s string) {
v, _ := strconv.ParseUint(s, 0, 64)
*me = PositiveInteger(v)
}
// Returns a string representation of its current non-string scalar value.
func (me PositiveInteger) String() string {
return strconv.FormatUint(uint64(me), 10)
}
// A convenience interface that declares a type conversion to PositiveInteger.
type ToXsdtPositiveInteger interface {
ToXsdtPositiveInteger() PositiveInteger
}
// Represents a qualified name. A qualified name is composed of a prefix and a local name separated by a colon. Both the prefix and local names must be an NCName. The prefix must be associated with a namespace URI reference, using a namespace declaration.
type Qname string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Qname) Set(v string) {
*me = Qname(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Qname) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Qname.
type ToXsdtQname interface {
ToXsdtQname() Qname
}
// Represents an integer with a minimum value of -32768 and maximum of 32767.
type Short int16
// Because littering your code with type conversions is a hassle...
func (me Short) N() int16 {
return int16(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *Short) Set(s string) {
v, _ := strconv.ParseInt(s, 0, 16)
*me = Short(v)
}
// Returns a string representation of its current non-string scalar value.
func (me Short) String() string {
return strconv.FormatInt(int64(me), 10)
}
// A convenience interface that declares a type conversion to Short.
type ToXsdtShort interface {
ToXsdtShort() Short
}
// Represents character strings.
type String string
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *String) Set(v string) {
*me = String(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me String) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to String.
type ToXsdtString interface {
ToXsdtString() String
}
// Represents tokenized strings.
type Token NormalizedString
// Since this is just a simple String type, this merely sets the current value from the specified string.
func (me *Token) Set(v string) {
*me = Token(v)
}
// Since this is just a simple String type, this merely returns its current string value.
func (me Token) String() string {
return string(me)
}
// A convenience interface that declares a type conversion to Token.
type ToXsdtToken interface {
ToXsdtToken() Token
}
// Represents an integer with a minimum of zero and maximum of 255.
type UnsignedByte uint8
// Because littering your code with type conversions is a hassle...
func (me UnsignedByte) N() uint8 {
return uint8(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *UnsignedByte) Set(s string) {
v, _ := strconv.ParseUint(s, 0, 8)
*me = UnsignedByte(v)
}
// Returns a string representation of its current non-string scalar value.
func (me UnsignedByte) String() string {
return strconv.FormatUint(uint64(me), 10)
}
// A convenience interface that declares a type conversion to UnsignedByte.
type ToXsdtUnsignedByte interface {
ToXsdtUnsignedByte() UnsignedByte
}
// Represents an integer with a minimum of zero and maximum of 4294967295.
type UnsignedInt uint32
// Because littering your code with type conversions is a hassle...
func (me UnsignedInt) N() uint32 {
return uint32(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *UnsignedInt) Set(s string) {
v, _ := strconv.ParseUint(s, 0, 32)
*me = UnsignedInt(v)
}
// Returns a string representation of its current non-string scalar value.
func (me UnsignedInt) String() string {
return strconv.FormatUint(uint64(me), 10)
}
// A convenience interface that declares a type conversion to UnsignedInt.
type ToXsdtUnsignedInt interface {
ToXsdtUnsignedInt() UnsignedInt
}
// Represents an integer with a minimum of zero and maximum of 18446744073709551615.
type UnsignedLong uint64
// Because littering your code with type conversions is a hassle...
func (me UnsignedLong) N() uint64 {
return uint64(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *UnsignedLong) Set(s string) {
v, _ := strconv.ParseUint(s, 0, 64)
*me = UnsignedLong(v)
}
// Returns a string representation of its current non-string scalar value.
func (me UnsignedLong) String() string {
return strconv.FormatUint(uint64(me), 10)
}
// A convenience interface that declares a type conversion to UnsignedLong.
type ToXsdtUnsignedLong interface {
ToXsdtUnsignedLong() UnsignedLong
}
// Represents an integer with a minimum of zero and maximum of 65535.
type UnsignedShort uint16
// Because littering your code with type conversions is a hassle...
func (me UnsignedShort) N() uint16 {
return uint16(me)
}
// Since this is a non-string scalar type, sets its current value obtained from parsing the specified string.
func (me *UnsignedShort) Set(s string) {
v, _ := strconv.ParseUint(s, 0, 16)
*me = UnsignedShort(v)
}
// Returns a string representation of its current non-string scalar value.
func (me UnsignedShort) String() string {
return strconv.FormatUint(uint64(me), 10)
}
// A convenience interface that declares a type conversion to UnsignedShort.
type ToXsdtUnsignedShort interface {
ToXsdtUnsignedShort() UnsignedShort
}
// XSD "list" types are always space-separated strings. All generated Go types based on any XSD's list types get a Values() method, which will always resort to this function.
func ListValues(v string) (spl []string) {
if len(v) == 0 {
return
}
lastWs := true
wsr := func(r rune) bool {
return (r == ' ') || (r == '\r') || (r == '\n') || (r == '\t')
}
wss := func(r string) bool {
return (r == " ") || (r == "\r") || (r == "\n") || (r == "\t")
}
for wss(v[len(v)-1:]) {
v = v[:len(v)-1]
}
for wss(v[:1]) {
v = v[1:]
}
if len(v) > 0 {
cur, num, i := "", 1, 0
for _, r := range v {
if wsr(r) {
if !lastWs {
num++
lastWs = true
}
} else {
lastWs = false
}
}
lastWs, spl = true, make([]string, num)
for _, r := range v {
if wsr(r) {
if !lastWs {
if len(cur) > 0 {
spl[i] = cur
i++
}
cur, lastWs = "", true
}
} else {
lastWs = false
cur += string(r)
}
}
if len(cur) > 0 {
spl[i] = cur
}
}
return
}
func ListValuesBoolean(vals []Boolean) (sl []bool) {
sl = make([]bool, len(vals))
for i, b := range vals {
sl[i] = b.B()
}
return
}
func ListValuesDouble(vals []Double) (sl []float64) {
sl = make([]float64, len(vals))
for i, d := range vals {
sl[i] = d.N()
}
return
}
func ListValuesLong(vals []Long) (sl []int64) {
sl = make([]int64, len(vals))
for i, l := range vals {
sl[i] = l.N()
}
return
}
// A helper function for the Walk() functionality of generated wrapper packages.
func OnWalkError(err *error, slice *[]error, breakWalk bool, handler func(error)) (ret bool) {
if e := *err; e != nil {
*slice = append(*slice, e)
ret = breakWalk
if handler != nil {
handler(e)
}
}
*err = nil
return
}
================================================
FILE: xsd-makepkg/main.go
================================================
package main
import (
"flag"
"log"
"os/exec"
"strings"
"github.com/metaleap/go-util/dev/go"
xsd "github.com/metaleap/go-xsd"
)
var (
flagGoFmt = flag.Bool("gofmt", true, "Run 'gofmt' against the generated Go wrapper package?")
flagGoInst = flag.Bool("goinst", true, "Run 'go-buildrun' against the generated Go wrapper package?")
flagSchema = flag.String("uri", "", "The XML Schema Definition file URIs to generate a Go wrapper packages from, whitespace-separated. (For each, the protocol prefix can be omitted, it then defaults to http://. Only protocols understood by the net/http package are supported.)")
flagLocalCopy = flag.Bool("local", true, "Local copy: only downloads if file does not exist locally")
flagForceParse = flag.Bool("parse", false, "Not necessary unless the generated Go wrapper package won't compile.")
flagBasePath = flag.String("basepath", "", "Defaults to "+xsd.PkgGen.BasePath+". A $GOPATH/src/-relative path (always a slash-style path, even on Windows) where XSD files are downloaded to / loaded from and generated Go wrapper packages are created. Any XSD imports are also rewritten as Go imports from that path (but are not otherwise auto-magically processed in any way).")
// if no schemas are specified in *flagSchema, we run the pkg-maker through a default series of various XSDs...
schemas = []string{
"www.w3.org/2001/xml.xsd",
"www.w3.org/2001/03/xml.xsd",
"www.w3.org/TR/2002/WD-SVG11-20020108/xml.xsd",
"www.w3.org/TR/2002/WD-SVG11-20020108/xlink.xsd",
"www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd",
"www.w3.org/2007/schema-for-xslt20.xsd",
"www.w3.org/Math/XMLSchema/mathml2/common/xlink-href.xsd",
"www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd",
"docs.oasis-open.org/election/external/xAL.xsd",
"docbook.org/xml/5.0/xsd/xml.xsd",
"docbook.org/xml/5.0/xsd/xlink.xsd",
"docbook.org/xml/5.0/xsd/docbook.xsd",
"kbcafe.com/rss/atom.xsd.xml",
"thearchitect.co.uk/schemas/rss-2_0.xsd",
"schemas.opengis.net/kml/2.2.0/atom-author-link.xsd",
"schemas.opengis.net/kml/2.2.0/ogckml22.xsd",
"khronos.org/files/collada_schema_1_4",
"khronos.org/files/collada_schema_1_5",
}
)
func main() {
var (
sd *xsd.Schema
err error
raw []byte
outFilePath string
)
flag.Parse()
if len(*flagSchema) > 0 {
schemas = strings.Split(*flagSchema, " ")
}
if len(*flagBasePath) > 0 {
xsd.PkgGen.BasePath, xsd.PkgGen.BaseCodePath = *flagBasePath, udevgo.GopathSrc(strings.Split(*flagBasePath, "/")...)
}
for _, s := range schemas {
log.Printf("LOAD:\t%v\n", s)
if sd, err = xsd.LoadSchema(s, *flagLocalCopy); err != nil {
log.Printf("\tERROR: %v\n", err)
} else if sd != nil {
xsd.PkgGen.ForceParseForDefaults = *flagForceParse || (s == "schemas.opengis.net/kml/2.2.0/ogckml22.xsd") // KML schema uses 0 and 1 as defaults for booleans...
if outFilePath, err = sd.MakeGoPkgSrcFile(); err == nil {
log.Printf("MKPKG:\t%v\n", outFilePath)
if *flagGoFmt {
if raw, err = exec.Command("gofmt", "-w=true", "-s=true", "-e=true", outFilePath).CombinedOutput(); len(raw) > 0 {
log.Printf("GOFMT:\t%s\n", string(raw))
}
if err != nil {
log.Printf("GOFMT:\t%v\n", err)
}
}
if *flagGoInst {
if raw, err = exec.Command("go-buildrun", "-d=__doc.html", "-f="+outFilePath).CombinedOutput(); len(raw) > 0 {
println(string(raw))
}
if err != nil {
log.Printf("GOINST:\t%v\n", err)
}
}
} else {
log.Printf("\tERROR:\t%v\n", err)
}
}
}
}
================================================
FILE: xsd-makepkg/tests/README.md
================================================
# tests
--
import "github.com/metaleap/go-xsd/xsd-makepkg/tests"
A simple test function shared by the various test programs inside this directory (rss, atom, collada, svg etc.)
## Usage
```go
var (
OnDocLoaded func(interface{})
)
```
#### func TestViaRemarshal
```go
func TestViaRemarshal(dirPath string, makeEmptyDoc func() interface{})
```
Attempts to xml.Unmarshal() all files in the "infiles" sub-directory of the
specified directory path into the interface{} structure returned by the
specified constructor. For each such input file, then attempts to
xml.MarshalIndent() said structure back into a new output XML file with the same
name, in the "outfiles" sub-directory of the specified directory path.
--
**godocdown** http://github.com/robertkrimen/godocdown
================================================
FILE: xsd-makepkg/tests/doc.go
================================================
// A simple test function shared by the various test programs inside this directory (rss, atom, collada, svg etc.)
package tests
================================================
FILE: xsd-makepkg/tests/tests.go
================================================
package tests
import (
"encoding/xml"
"fmt"
"log"
"path/filepath"
"strings"
"github.com/metaleap/go-util/fs"
xmlx "github.com/go-forks/go-pkg-xmlx"
)
var (
OnDocLoaded func(interface{})
)
func verifyDocs(origData, faksData []byte) (errs []error) {
orig, faks := xmlx.New(), xmlx.New()
err := orig.LoadBytes(origData, nil)
if err == nil {
if err = faks.LoadBytes(faksData, nil); err == nil {
errs = verifyNode(orig.Root, faks.Root)
}
}
return
}
func verifyNode(orig, faks *xmlx.Node) (errs []error) {
type both struct {
origNodes, faksNodes []*xmlx.Node
}
var (
curBoth *both
cn *xmlx.Node
tmp string
i int
subErrs []error
)
attVal := func(xn *xmlx.Node, att *xmlx.Attr) (v string) {
if v = xn.As("", att.Name.Local); len(v) == 0 {
v = xn.As(att.Name.Space, att.Name.Local)
}
return
}
cleanNodes := func(xns ...*xmlx.Node) {
for _, xn := range xns {
for _, cn = range xn.Children {
if cn.Type != xmlx.NT_ELEMENT {
xn.RemoveChild(cn)
}
}
}
}
cleanNodes(orig, faks)
for _, a := range orig.Attributes {
if tmp = attVal(faks, a); tmp != a.Value {
errs = append(errs, fmt.Errorf("Attribute '%s:%s' of <%s> element: different values (orig='%s' faks='%s')", a.Name.Space, a.Name.Local, orig.Name.Local, a.Value, tmp))
}
}
if len(orig.Children) > len(faks.Children) {
errs = append(errs, fmt.Errorf("Orig <%s> element has %v children, but faks has %v.", orig.Name.Local, len(orig.Children), len(faks.Children)))
}
if orig.Value != faks.Value {
errs = append(errs, fmt.Errorf("Orig <%s> element value differs from faks value.", orig.Name.Local))
}
namedNodes := map[string]*both{}
for _, cn = range orig.Children {
if curBoth = namedNodes[cn.Name.Local]; curBoth == nil {
curBoth = &both{}
namedNodes[cn.Name.Local] = curBoth
}
curBoth.origNodes = append(curBoth.origNodes, cn)
}
for _, cn = range faks.Children {
if curBoth = namedNodes[cn.Name.Local]; curBoth != nil {
curBoth.faksNodes = append(curBoth.faksNodes, cn)
}
}
for tmp, curBoth = range namedNodes {
if len(curBoth.origNodes) != len(curBoth.faksNodes) {
errs = append(errs, fmt.Errorf("Orig <%s> element has %v <%s> elements but faks <%s> element has %v.", orig.Name.Local, len(curBoth.origNodes), tmp, faks.Name.Local, len(curBoth.faksNodes)))
} else if len(curBoth.origNodes) == 1 {
errs = append(errs, verifyNode(curBoth.origNodes[0], curBoth.faksNodes[0])...)
} else {
for i, cn = range curBoth.origNodes {
if subErrs = verifyNode(cn, curBoth.faksNodes[i]); len(subErrs) > 0 {
errs = append(errs, subErrs...)
}
}
}
}
return
}
// Attempts to xml.Unmarshal() all files in the "infiles" sub-directory of the specified directory path into the interface{} structure returned by the specified constructor.
// For each such input file, then attempts to xml.MarshalIndent() said structure back into a new output XML file with the same name, in the "outfiles" sub-directory of the specified directory path.
func TestViaRemarshal(dirPath string, makeEmptyDoc func() interface{}) {
var dirPathInFiles = filepath.Join(dirPath, "infiles")
var dirPathOutFiles = filepath.Join(dirPath, "outfiles")
var loadXmlDocFile = func(filename string) bool {
log.Printf("Loading %s", filename)
doc, dataOrig := makeEmptyDoc(), ufs.ReadBinaryFile(filename, true)
err := xml.Unmarshal(dataOrig, doc)
if err != nil {
panic(err)
}
if OnDocLoaded != nil {
OnDocLoaded(doc)
}
outFileName := filepath.Join(dirPathOutFiles, filepath.Base(filename))
log.Printf("Writing %s", outFileName)
dataFaks, err := xml.MarshalIndent(doc, "", "\t")
if err != nil {
panic(err)
}
ufs.WriteTextFile(outFileName, strings.Trim(string(dataFaks), " \r\n\t"))
log.Printf("Verifying...")
if errs := verifyDocs(dataOrig, dataFaks); len(errs) > 0 {
for _, err = range errs {
log.Printf("%v", err)
}
}
return true
}
if errs := ufs.NewDirWalker(false, nil, loadXmlDocFile).Walk(dirPathInFiles); len(errs) > 0 {
panic(errs[0])
}
}
================================================
FILE: xsd-makepkg/tests/xsd-test-atom/feed/infiles/samplefeed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<link href="http://example.org/"/>
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>John Doe</name>
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
<entry>
<title>Atom-Powered Robots Run Amok</title>
<link href="http://example.org/2003/12/13/atom03"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
<summary>Some text.</summary>
</entry>
</feed>
================================================
FILE: xsd-makepkg/tests/xsd-test-atom/feed/outfiles/samplefeed.xml
================================================
<feed base="" lang="">
<link xmlns="http://www.w3.org/2005/Atom" length="0" title="" href="http://example.org/" hreflang="" type="" base="" lang="" rel=""></link>
<entry xmlns="http://www.w3.org/2005/Atom" base="" lang="">
<link xmlns="http://www.w3.org/2005/Atom" length="0" title="" href="http://example.org/2003/12/13/atom03" hreflang="" type="" base="" lang="" rel=""></link>
<summary xmlns="http://www.w3.org/2005/Atom" base="" lang="" type="">Some text.</summary>
<id xmlns="http://www.w3.org/2005/Atom" base="" lang="">urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated xmlns="http://www.w3.org/2005/Atom" base="" lang="">2003-12-13T18:30:02Z</updated>
<title xmlns="http://www.w3.org/2005/Atom" base="" lang="" type="">Atom-Powered Robots Run Amok</title>
</entry>
<title xmlns="http://www.w3.org/2005/Atom" base="" lang="" type="">Example Feed</title>
<author xmlns="http://www.w3.org/2005/Atom" base="" lang="">
<name xmlns="http://www.w3.org/2005/Atom">John Doe</name>
</author>
<updated xmlns="http://www.w3.org/2005/Atom" base="" lang="">2003-12-13T18:30:02Z</updated>
<id xmlns="http://www.w3.org/2005/Atom" base="" lang="">urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
</feed>
================================================
FILE: xsd-makepkg/tests/xsd-test-atom/main.go
================================================
package main
import (
"encoding/xml"
"github.com/metaleap/go-xsd/xsd-makepkg/tests"
"github.com/metaleap/go-util/dev/go"
atom "github.com/metaleap/go-xsd-pkg/kbcafe.com/rss/atom.xsd.xml_go"
)
type AtomEntryDoc struct {
XMLName xml.Name `xml:"entry"`
atom.TentryType
}
type AtomFeedDoc struct {
XMLName xml.Name `xml:"feed"`
atom.TfeedType
}
func main() {
var (
entryDirBasePath = udevgo.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-atom", "entry")
entryMakeEmptyDoc = func() interface{} { return &AtomEntryDoc{} }
feedDirBasePath = udevgo.GopathSrcGithub("metaleap", "go-xsd", "xsd-makepkg", "tests", "xsd-test-atom", "feed")
feedMakeEmptyDoc = func() interface{} { return &AtomFeedDoc{} }
)
tests.TestViaRemarshal(entryDirBasePath, entryMakeEmptyDoc)
tests.TestViaRemarshal(feedDirBasePath, feedMakeEmptyDoc)
}
================================================
FILE: xsd-makepkg/tests/xsd-test-collada/1.4.1/infiles/berlin.dae
================================================
[File too large to display: 10.3 MB]
================================================
FILE: xsd-makepkg/tests/xsd-test-collada/1.4.1/infiles/cube.dae
================================================
<?xml version="1.0" ?><COLLADA version="1.4.1" xmlns="http://www.collada.org/2005/11/COLLADASchema">
<asset>
<contributor>
<author>alorino</author>
<authoring_tool>Maya 7.0 | ColladaMaya v2.01 Jun 9 2006 at 16:08:19 | FCollada v1.11</authoring_tool>
<comments>Collada Maya Export Options: bakeTransforms=0;exportPolygonMeshes=1;bakeLighting=0;isSampling=0;
curveConstrainSampling=0;exportCameraAsLookat=0;
exportLights=1;exportCameras=1;exportJointsAndSkin=1;
exportAnimations=1;exportTriangles=0;exportInvisibleNodes=0;
exportNormals=1;exportTexCoords=1;exportVertexColors=1;exportTangents=0;
exportTexTangents=0;exportConstraints=0;exportPhysics=0;exportXRefs=1;
dereferenceXRefs=0;cameraXFov=0;cameraYFov=1</comments>
<copyright>
Copyright 2006 Sony Computer Entertainment Inc.
Licensed under the SCEA Shared Source License, Version 1.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at:
http://research.scea.com/scea_shared_source_license.html
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</copyright>
</contributor>
<created>2006-06-21T21:25:37Z</created>
<modified>2006-06-21T21:25:37Z</modified>
<unit meter="0.01" name="centimeter"/>
<up_axis>Y_UP</up_axis>
</asset>
<library_cameras>
<camera id="cl_unnamed_1" name="cl_unnamed_1">
<optics>
<technique_common>
<perspective>
<yfov>37.8493</yfov>
<aspect_ratio>1</aspect_ratio>
<znear>10</znear>
<zfar>1000</zfar>
</perspective>
</technique_common>
</optics>
</camera>
<camera id="testCameraShape" name="testCameraShape">
<optics>
<technique_common>
<perspective>
<yfov>37.8501</yfov>
<aspect_ratio>1</aspect_ratio>
<znear>0.01</znear>
<zfar>1000</zfar>
</perspective>
</technique_common>
</optics>
</camera>
</library_cameras>
<library_lights>
<light id="Lt_Light-lib" name="Lt_Light">
<technique_common>
<point>
<color>1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0</quadratic_attenuation>
</point>
</technique_common>
</light>
<light id="pointLightShape1-lib" name="pointLightShape1">
<technique_common>
<point>
<color>1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0</quadratic_attenuation>
</point>
</technique_common>
</light>
</library_lights>
<library_materials>
<material id="Blue" name="Blue">
<instance_effect url="#Blue-fx"/>
</material>
<material id="Red" name="Red">
<instance_effect url="#Red-fx"/>
</material>
</library_materials>
<library_effects>
<effect id="Blue-fx">
<profile_COMMON>
<technique sid="common">
<phong>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient>
<color>0 0 0 1</color>
</ambient>
<diffuse>
<color>0.137255 0.403922 0.870588 1</color>
</diffuse>
<specular>
<color>0.5 0.5 0.5 1</color>
</specular>
<shininess>
<float>10</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
</reflective>
<reflectivity>
<float>0.5</float>
</reflectivity>
<transparent>
<color>0 0 0 1</color>
</transparent>
<transparency>
<float>1</float>
</transparency>
<index_of_refraction>
<float>0</float>
</index_of_refraction>
</phong>
</technique>
</profile_COMMON>
</effect>
<effect id="Red-fx">
<profile_COMMON>
<technique sid="common">
<phong>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient>
<color>0 0 0 1</color>
</ambient>
<diffuse>
<color>0.658824 0.101961 0.109804 1</color>
</diffuse>
<specular>
<color>0.368627 0.368627 0.368627 1</color>
</specular>
<shininess>
<float>10</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
</reflective>
<reflectivity>
<float>0.5</float>
</reflectivity>
<transparent>
<color>0 0 0 1</color>
</transparent>
<transparency>
<float>1</float>
</transparency>
<index_of_refraction>
<float>0</float>
</index_of_refraction>
</phong>
</technique>
</profile_COMMON>
</effect>
</library_effects>
<library_geometries>
<geometry id="box-lib" name="box">
<mesh>
<source id="box-lib-positions" name="position">
<float_array count="24" id="box-lib-positions-array">-50 50 50 50 50 50 -50 -50 50 50 -50 50 -50 50 -50 50 50 -50 -50 -50 -50 50 -50 -50</float_array>
<technique_common>
<accessor count="8" offset="0" source="#box-lib-positions-array" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="box-lib-normals" name="normal">
<float_array count="72" id="box-lib-normals-arr
gitextract__7bfnx83/ ├── LICENSE.md ├── README.md ├── elem.go ├── elemmakepkg.go ├── elemparents.go ├── hasattr.go ├── haselem.go ├── hasmakepkg.go ├── hasparents.go ├── makepkg.go ├── types/ │ ├── README.md │ ├── doc.go │ └── xsdtypes.go ├── xsd-makepkg/ │ ├── main.go │ └── tests/ │ ├── README.md │ ├── doc.go │ ├── tests.go │ ├── xsd-test-atom/ │ │ ├── feed/ │ │ │ ├── infiles/ │ │ │ │ └── samplefeed.xml │ │ │ └── outfiles/ │ │ │ └── samplefeed.xml │ │ └── main.go │ ├── xsd-test-collada/ │ │ ├── 1.4.1/ │ │ │ ├── infiles/ │ │ │ │ ├── berlin.dae │ │ │ │ ├── cube.dae │ │ │ │ ├── cube_triangulate.dae │ │ │ │ ├── duck.dae │ │ │ │ ├── duck_triangulate.dae │ │ │ │ └── mgmidget.dae │ │ │ └── outfiles/ │ │ │ ├── berlin.dae │ │ │ ├── cube.dae │ │ │ ├── cube_triangulate.dae │ │ │ ├── duck.dae │ │ │ ├── duck_triangulate.dae │ │ │ └── mgmidget.dae │ │ ├── 1.5/ │ │ │ ├── infiles/ │ │ │ │ ├── berlin.dae │ │ │ │ ├── cube.dae │ │ │ │ ├── cube_triangulate.dae │ │ │ │ ├── duck.dae │ │ │ │ ├── duck_triangulate.dae │ │ │ │ └── mgmidget.dae │ │ │ └── outfiles/ │ │ │ ├── berlin.dae │ │ │ ├── cube.dae │ │ │ ├── cube_triangulate.dae │ │ │ ├── duck.dae │ │ │ ├── duck_triangulate.dae │ │ │ └── mgmidget.dae │ │ └── main.go │ ├── xsd-test-kml/ │ │ ├── infiles/ │ │ │ └── doc.kml │ │ ├── main.go │ │ └── outfiles/ │ │ └── doc.kml │ ├── xsd-test-rss/ │ │ ├── infiles/ │ │ │ └── go-ngine-blog.rss │ │ ├── main.go │ │ └── outfiles/ │ │ └── go-ngine-blog.rss │ └── xsd-test-svg/ │ └── main.go └── xsd-schema.go
SYMBOL INDEX (680 symbols across 17 files)
FILE: elem.go
type element (line 7) | type element interface
type elemBase (line 13) | type elemBase struct
method afterMakePkg (line 20) | func (me *elemBase) afterMakePkg(bag *PkgBag) {
method beforeMakePkg (line 29) | func (me *elemBase) beforeMakePkg(bag *PkgBag) {
method base (line 38) | func (me *elemBase) base() *elemBase { return me }
method init (line 40) | func (me *elemBase) init(parent, self element, xsdName xsdt.NCName, at...
method longSafeName (line 49) | func (me *elemBase) longSafeName(bag *PkgBag) (ln string) {
method selfName (line 60) | func (me *elemBase) selfName() xsdt.NCName {
method Parent (line 71) | func (me *elemBase) Parent() element { return me.parent }
type All (line 73) | type All struct
type Annotation (line 83) | type Annotation struct
type Any (line 90) | type Any struct
type AnyAttribute (line 101) | type AnyAttribute struct
type AppInfo (line 110) | type AppInfo struct
type Attribute (line 117) | type Attribute struct
type AttributeGroup (line 132) | type AttributeGroup struct
type Choice (line 144) | type Choice struct
type ComplexContent (line 158) | type ComplexContent struct
type ComplexType (line 168) | type ComplexType struct
type Documentation (line 189) | type Documentation struct
type Element (line 197) | type Element struct
type ExtensionComplexContent (line 222) | type ExtensionComplexContent struct
type ExtensionSimpleContent (line 237) | type ExtensionSimpleContent struct
type Field (line 248) | type Field struct
type Group (line 256) | type Group struct
type Include (line 270) | type Include struct
type Import (line 278) | type Import struct
type Key (line 287) | type Key struct
type KeyRef (line 297) | type KeyRef struct
type List (line 308) | type List struct
type Notation (line 317) | type Notation struct
type Redefine (line 327) | type Redefine struct
type RestrictionComplexContent (line 339) | type RestrictionComplexContent struct
type RestrictionSimpleContent (line 353) | type RestrictionSimpleContent struct
type RestrictionSimpleEnumeration (line 377) | type RestrictionSimpleEnumeration struct
type RestrictionSimpleFractionDigits (line 383) | type RestrictionSimpleFractionDigits struct
type RestrictionSimpleLength (line 389) | type RestrictionSimpleLength struct
type RestrictionSimpleMaxExclusive (line 395) | type RestrictionSimpleMaxExclusive struct
type RestrictionSimpleMaxInclusive (line 401) | type RestrictionSimpleMaxInclusive struct
type RestrictionSimpleMaxLength (line 407) | type RestrictionSimpleMaxLength struct
type RestrictionSimpleMinExclusive (line 413) | type RestrictionSimpleMinExclusive struct
type RestrictionSimpleMinInclusive (line 419) | type RestrictionSimpleMinInclusive struct
type RestrictionSimpleMinLength (line 425) | type RestrictionSimpleMinLength struct
type RestrictionSimplePattern (line 431) | type RestrictionSimplePattern struct
type RestrictionSimpleTotalDigits (line 437) | type RestrictionSimpleTotalDigits struct
type RestrictionSimpleType (line 443) | type RestrictionSimpleType struct
type RestrictionSimpleWhiteSpace (line 464) | type RestrictionSimpleWhiteSpace struct
type Selector (line 470) | type Selector struct
type Sequence (line 478) | type Sequence struct
type SimpleContent (line 492) | type SimpleContent struct
type SimpleType (line 501) | type SimpleType struct
type Union (line 513) | type Union struct
type Unique (line 522) | type Unique struct
function Flattened (line 532) | func Flattened(choices []*Choice, seqs []*Sequence) (allChoices []*Choic...
FILE: elemmakepkg.go
constant idPrefix (line 15) | idPrefix = "XsdGoPkg"
method makePkg (line 18) | func (me *All) makePkg(bag *PkgBag) {
method makePkg (line 24) | func (me *Annotation) makePkg(bag *PkgBag) {
method makePkg (line 31) | func (me *Any) makePkg(bag *PkgBag) {
method makePkg (line 36) | func (me *AnyAttribute) makePkg(bag *PkgBag) {
method makePkg (line 41) | func (me *AppInfo) makePkg(bag *PkgBag) {
method makePkg (line 46) | func (me *Attribute) makePkg(bag *PkgBag) {
method makePkg (line 103) | func (me *AttributeGroup) makePkg(bag *PkgBag) {
method makePkg (line 139) | func (me *Choice) makePkg(bag *PkgBag) {
method makePkg (line 149) | func (me *ComplexContent) makePkg(bag *PkgBag) {
method makePkg (line 156) | func (me *ComplexType) makePkg(bag *PkgBag) {
method makePkg (line 347) | func (me *Documentation) makePkg(bag *PkgBag) {
method makePkg (line 360) | func (me *Element) makePkg(bag *PkgBag) {
method makePkg (line 442) | func (me *ExtensionComplexContent) makePkg(bag *PkgBag) {
method makePkg (line 454) | func (me *ExtensionSimpleContent) makePkg(bag *PkgBag) {
method makePkg (line 462) | func (me *Field) makePkg(bag *PkgBag) {
method makePkg (line 467) | func (me *Group) makePkg(bag *PkgBag) {
method makePkg (line 517) | func (me *Import) makePkg(bag *PkgBag) {
method makePkg (line 540) | func (me *Key) makePkg(bag *PkgBag) {
method makePkg (line 547) | func (me *KeyRef) makePkg(bag *PkgBag) {
method makePkg (line 554) | func (me *List) makePkg(bag *PkgBag) {
method makePkg (line 574) | func (me *Notation) makePkg(bag *PkgBag) {
method makePkg (line 581) | func (me *Redefine) makePkg(bag *PkgBag) {
method makePkg (line 590) | func (me *RestrictionComplexContent) makePkg(bag *PkgBag) {
method makePkg (line 601) | func (me *RestrictionSimpleContent) makePkg(bag *PkgBag) {
method makePkg (line 622) | func (me *RestrictionSimpleEnumeration) makePkg(bag *PkgBag) {
method makePkg (line 630) | func (me *RestrictionSimpleFractionDigits) makePkg(bag *PkgBag) {
method makePkg (line 635) | func (me *RestrictionSimpleLength) makePkg(bag *PkgBag) {
method makePkg (line 640) | func (me *RestrictionSimpleMaxExclusive) makePkg(bag *PkgBag) {
method makePkg (line 645) | func (me *RestrictionSimpleMaxInclusive) makePkg(bag *PkgBag) {
method makePkg (line 650) | func (me *RestrictionSimpleMaxLength) makePkg(bag *PkgBag) {
method makePkg (line 655) | func (me *RestrictionSimpleMinExclusive) makePkg(bag *PkgBag) {
method makePkg (line 660) | func (me *RestrictionSimpleMinInclusive) makePkg(bag *PkgBag) {
method makePkg (line 665) | func (me *RestrictionSimpleMinLength) makePkg(bag *PkgBag) {
method makePkg (line 670) | func (me *RestrictionSimplePattern) makePkg(bag *PkgBag) {
method makePkg (line 675) | func (me *RestrictionSimpleTotalDigits) makePkg(bag *PkgBag) {
method makePkg (line 680) | func (me *RestrictionSimpleType) makePkg(bag *PkgBag) {
method makePkg (line 698) | func (me *RestrictionSimpleWhiteSpace) makePkg(bag *PkgBag) {
method makePkg (line 703) | func (me *Schema) makePkg(bag *PkgBag) {
method makePkg (line 716) | func (me *Selector) makePkg(bag *PkgBag) {
method makePkg (line 722) | func (me *Sequence) makePkg(bag *PkgBag) {
method makePkg (line 732) | func (me *SimpleContent) makePkg(bag *PkgBag) {
method makePkg (line 739) | func (me *SimpleType) makePkg(bag *PkgBag) {
method makePkg (line 792) | func (me *Union) makePkg(bag *PkgBag) {
method makePkg (line 809) | func (me *Unique) makePkg(bag *PkgBag) {
function anns (line 816) | func anns(a *All, cc *ComplexContent) (anns []*Annotation) {
function pluralize (line 831) | func pluralize(s string) string {
function sfmt (line 840) | func sfmt(s string, a ...interface{}) string {
function coerceToIdentifierRune (line 845) | func coerceToIdentifierRune(ch rune) rune {
function safeIdentifier (line 854) | func safeIdentifier(s string) string {
function subMakeElem (line 862) | func subMakeElem(bag *PkgBag, td *declType, el *Element, done map[string...
function subMakeElemGroup (line 872) | func subMakeElemGroup(bag *PkgBag, td *declType, gr *Group, done map[str...
FILE: elemparents.go
method initElement (line 3) | func (me *All) initElement(parent element) {
method initElement (line 9) | func (me *Annotation) initElement(parent element) {
method initElement (line 15) | func (me *Any) initElement(parent element) {
method initElement (line 20) | func (me *AnyAttribute) initElement(parent element) {
method initElement (line 25) | func (me *AppInfo) initElement(parent element) {
method initElement (line 29) | func (me *Attribute) initElement(parent element) {
method initElement (line 35) | func (me *AttributeGroup) initElement(parent element) {
method initElement (line 43) | func (me *Choice) initElement(parent element) {
method initElement (line 53) | func (me *ComplexContent) initElement(parent element) {
method initElement (line 60) | func (me *ComplexType) initElement(parent element) {
method initElement (line 74) | func (me *Documentation) initElement(parent element) {
method initElement (line 78) | func (me *Element) initElement(parent element) {
method initElement (line 88) | func (me *ExtensionComplexContent) initElement(parent element) {
method initElement (line 100) | func (me *ExtensionSimpleContent) initElement(parent element) {
method initElement (line 108) | func (me *Field) initElement(parent element) {
method initElement (line 113) | func (me *Group) initElement(parent element) {
method initElement (line 121) | func (me *Import) initElement(parent element) {
method initElement (line 126) | func (me *Key) initElement(parent element) {
method initElement (line 133) | func (me *KeyRef) initElement(parent element) {
method initElement (line 140) | func (me *List) initElement(parent element) {
method initElement (line 146) | func (me *Notation) initElement(parent element) {
method initElement (line 151) | func (me *Redefine) initElement(parent element) {
method initElement (line 160) | func (me *RestrictionComplexContent) initElement(parent element) {
method initElement (line 171) | func (me *RestrictionSimpleContent) initElement(parent element) {
method initElement (line 192) | func (me *RestrictionSimpleEnumeration) initElement(parent element) {
method initElement (line 196) | func (me *RestrictionSimpleFractionDigits) initElement(parent element) {
method initElement (line 200) | func (me *RestrictionSimpleLength) initElement(parent element) {
method initElement (line 204) | func (me *RestrictionSimpleMaxExclusive) initElement(parent element) {
method initElement (line 208) | func (me *RestrictionSimpleMaxInclusive) initElement(parent element) {
method initElement (line 212) | func (me *RestrictionSimpleMaxLength) initElement(parent element) {
method initElement (line 216) | func (me *RestrictionSimpleMinExclusive) initElement(parent element) {
method initElement (line 220) | func (me *RestrictionSimpleMinInclusive) initElement(parent element) {
method initElement (line 224) | func (me *RestrictionSimpleMinLength) initElement(parent element) {
method initElement (line 228) | func (me *RestrictionSimplePattern) initElement(parent element) {
method initElement (line 232) | func (me *RestrictionSimpleTotalDigits) initElement(parent element) {
method initElement (line 236) | func (me *RestrictionSimpleType) initElement(parent element) {
method initElement (line 254) | func (me *RestrictionSimpleWhiteSpace) initElement(parent element) {
method initElement (line 258) | func (me *Schema) initElement(parent element) {
method initElement (line 272) | func (me *Selector) initElement(parent element) {
method initElement (line 277) | func (me *Sequence) initElement(parent element) {
method initElement (line 287) | func (me *SimpleContent) initElement(parent element) {
method initElement (line 294) | func (me *SimpleType) initElement(parent element) {
method initElement (line 302) | func (me *Union) initElement(parent element) {
method initElement (line 308) | func (me *Unique) initElement(parent element) {
FILE: hasattr.go
type hasAttrAbstract (line 7) | type hasAttrAbstract struct
type hasAttrAttributeFormDefault (line 11) | type hasAttrAttributeFormDefault struct
type hasAttrBase (line 15) | type hasAttrBase struct
type hasAttrBlock (line 19) | type hasAttrBlock struct
type hasAttrBlockDefault (line 23) | type hasAttrBlockDefault struct
type hasAttrDefault (line 27) | type hasAttrDefault struct
type hasAttrFinal (line 31) | type hasAttrFinal struct
type hasAttrFinalDefault (line 35) | type hasAttrFinalDefault struct
type hasAttrFixed (line 39) | type hasAttrFixed struct
type hasAttrForm (line 43) | type hasAttrForm struct
type hasAttrElementFormDefault (line 47) | type hasAttrElementFormDefault struct
type hasAttrId (line 51) | type hasAttrId struct
type hasAttrItemType (line 55) | type hasAttrItemType struct
type hasAttrLang (line 59) | type hasAttrLang struct
type hasAttrMaxOccurs (line 63) | type hasAttrMaxOccurs struct
method Value (line 67) | func (me *hasAttrMaxOccurs) Value() (l xsdt.Long) {
type hasAttrMemberTypes (line 78) | type hasAttrMemberTypes struct
type hasAttrMinOccurs (line 82) | type hasAttrMinOccurs struct
type hasAttrMixed (line 86) | type hasAttrMixed struct
type hasAttrName (line 90) | type hasAttrName struct
type hasAttrNamespace (line 94) | type hasAttrNamespace struct
type hasAttrNillable (line 98) | type hasAttrNillable struct
type hasAttrProcessContents (line 102) | type hasAttrProcessContents struct
type hasAttrPublic (line 106) | type hasAttrPublic struct
type hasAttrRef (line 110) | type hasAttrRef struct
type hasAttrRefer (line 114) | type hasAttrRefer struct
type hasAttrSchemaLocation (line 118) | type hasAttrSchemaLocation struct
type hasAttrSource (line 122) | type hasAttrSource struct
type hasAttrSubstitutionGroup (line 126) | type hasAttrSubstitutionGroup struct
type hasAttrSystem (line 130) | type hasAttrSystem struct
type hasAttrTargetNamespace (line 134) | type hasAttrTargetNamespace struct
type hasAttrType (line 138) | type hasAttrType struct
type hasAttrUse (line 142) | type hasAttrUse struct
type hasAttrValue (line 146) | type hasAttrValue struct
type hasAttrVersion (line 150) | type hasAttrVersion struct
type hasAttrXpath (line 154) | type hasAttrXpath struct
FILE: haselem.go
type hasCdata (line 3) | type hasCdata struct
type hasElemAll (line 7) | type hasElemAll struct
type hasElemAnnotation (line 11) | type hasElemAnnotation struct
type hasElemsAny (line 15) | type hasElemsAny struct
type hasElemsAnyAttribute (line 19) | type hasElemsAnyAttribute struct
type hasElemsAppInfo (line 23) | type hasElemsAppInfo struct
type hasElemsAttribute (line 27) | type hasElemsAttribute struct
type hasElemsAttributeGroup (line 31) | type hasElemsAttributeGroup struct
type hasElemChoice (line 35) | type hasElemChoice struct
type hasElemsChoice (line 39) | type hasElemsChoice struct
type hasElemComplexContent (line 43) | type hasElemComplexContent struct
type hasElemComplexType (line 47) | type hasElemComplexType struct
type hasElemsComplexType (line 51) | type hasElemsComplexType struct
type hasElemsDocumentation (line 55) | type hasElemsDocumentation struct
type hasElemsElement (line 59) | type hasElemsElement struct
type hasElemsEnumeration (line 63) | type hasElemsEnumeration struct
type hasElemExtensionComplexContent (line 67) | type hasElemExtensionComplexContent struct
type hasElemExtensionSimpleContent (line 71) | type hasElemExtensionSimpleContent struct
type hasElemField (line 75) | type hasElemField struct
type hasElemFractionDigits (line 79) | type hasElemFractionDigits struct
type hasElemGroup (line 83) | type hasElemGroup struct
type hasElemsGroup (line 87) | type hasElemsGroup struct
type hasElemsImport (line 91) | type hasElemsImport struct
type hasElemsInclude (line 95) | type hasElemsInclude struct
type hasElemsKey (line 99) | type hasElemsKey struct
type hasElemKeyRef (line 103) | type hasElemKeyRef struct
type hasElemLength (line 107) | type hasElemLength struct
type hasElemList (line 111) | type hasElemList struct
type hasElemMaxExclusive (line 115) | type hasElemMaxExclusive struct
type hasElemMaxInclusive (line 119) | type hasElemMaxInclusive struct
type hasElemMaxLength (line 123) | type hasElemMaxLength struct
type hasElemMinExclusive (line 127) | type hasElemMinExclusive struct
type hasElemMinInclusive (line 131) | type hasElemMinInclusive struct
type hasElemMinLength (line 135) | type hasElemMinLength struct
type hasElemsNotation (line 139) | type hasElemsNotation struct
type hasElemPattern (line 143) | type hasElemPattern struct
type hasElemsRedefine (line 147) | type hasElemsRedefine struct
type hasElemRestrictionComplexContent (line 151) | type hasElemRestrictionComplexContent struct
type hasElemRestrictionSimpleContent (line 155) | type hasElemRestrictionSimpleContent struct
type hasElemRestrictionSimpleType (line 159) | type hasElemRestrictionSimpleType struct
type hasElemSelector (line 163) | type hasElemSelector struct
type hasElemSequence (line 167) | type hasElemSequence struct
type hasElemsSequence (line 171) | type hasElemsSequence struct
type hasElemSimpleContent (line 175) | type hasElemSimpleContent struct
type hasElemsSimpleType (line 179) | type hasElemsSimpleType struct
type hasElemTotalDigits (line 183) | type hasElemTotalDigits struct
type hasElemUnion (line 187) | type hasElemUnion struct
type hasElemUnique (line 191) | type hasElemUnique struct
type hasElemWhiteSpace (line 195) | type hasElemWhiteSpace struct
FILE: hasmakepkg.go
method makePkg (line 3) | func (me *hasElemAll) makePkg(bag *PkgBag) {
method makePkg (line 9) | func (me *hasElemAnnotation) makePkg(bag *PkgBag) {
method makePkg (line 15) | func (me *hasElemsAny) makePkg(bag *PkgBag) {
method makePkg (line 21) | func (me *hasElemsAnyAttribute) makePkg(bag *PkgBag) {
method makePkg (line 27) | func (me *hasElemsAppInfo) makePkg(bag *PkgBag) {
method makePkg (line 33) | func (me *hasElemsAttribute) makePkg(bag *PkgBag) {
method makePkg (line 39) | func (me *hasElemsAttributeGroup) makePkg(bag *PkgBag) {
method makePkg (line 45) | func (me *hasElemChoice) makePkg(bag *PkgBag) {
method makePkg (line 51) | func (me *hasElemsChoice) makePkg(bag *PkgBag) {
method makePkg (line 57) | func (me *hasElemComplexContent) makePkg(bag *PkgBag) {
method makePkg (line 63) | func (me *hasElemComplexType) makePkg(bag *PkgBag) {
method makePkg (line 69) | func (me *hasElemsComplexType) makePkg(bag *PkgBag) {
method makePkg (line 75) | func (me *hasElemsDocumentation) makePkg(bag *PkgBag) {
method makePkg (line 81) | func (me *hasElemsElement) makePkg(bag *PkgBag) {
method makePkg (line 87) | func (me *hasElemsEnumeration) makePkg(bag *PkgBag) {
method makePkg (line 93) | func (me *hasElemExtensionComplexContent) makePkg(bag *PkgBag) {
method makePkg (line 99) | func (me *hasElemExtensionSimpleContent) makePkg(bag *PkgBag) {
method makePkg (line 105) | func (me *hasElemField) makePkg(bag *PkgBag) {
method makePkg (line 111) | func (me *hasElemFractionDigits) makePkg(bag *PkgBag) {
method makePkg (line 117) | func (me *hasElemGroup) makePkg(bag *PkgBag) {
method makePkg (line 123) | func (me *hasElemsGroup) makePkg(bag *PkgBag) {
method makePkg (line 129) | func (me *hasElemsImport) makePkg(bag *PkgBag) {
method makePkg (line 135) | func (me *hasElemsKey) makePkg(bag *PkgBag) {
method makePkg (line 141) | func (me *hasElemKeyRef) makePkg(bag *PkgBag) {
method makePkg (line 147) | func (me *hasElemLength) makePkg(bag *PkgBag) {
method makePkg (line 153) | func (me *hasElemList) makePkg(bag *PkgBag) {
method makePkg (line 159) | func (me *hasElemMaxExclusive) makePkg(bag *PkgBag) {
method makePkg (line 165) | func (me *hasElemMaxInclusive) makePkg(bag *PkgBag) {
method makePkg (line 171) | func (me *hasElemMaxLength) makePkg(bag *PkgBag) {
method makePkg (line 177) | func (me *hasElemMinExclusive) makePkg(bag *PkgBag) {
method makePkg (line 183) | func (me *hasElemMinInclusive) makePkg(bag *PkgBag) {
method makePkg (line 189) | func (me *hasElemMinLength) makePkg(bag *PkgBag) {
method makePkg (line 195) | func (me *hasElemsNotation) makePkg(bag *PkgBag) {
method makePkg (line 201) | func (me *hasElemPattern) makePkg(bag *PkgBag) {
method makePkg (line 207) | func (me *hasElemsRedefine) makePkg(bag *PkgBag) {
method makePkg (line 213) | func (me *hasElemRestrictionComplexContent) makePkg(bag *PkgBag) {
method makePkg (line 219) | func (me *hasElemRestrictionSimpleContent) makePkg(bag *PkgBag) {
method makePkg (line 225) | func (me *hasElemRestrictionSimpleType) makePkg(bag *PkgBag) {
method makePkg (line 231) | func (me *hasElemSelector) makePkg(bag *PkgBag) {
method makePkg (line 237) | func (me *hasElemSequence) makePkg(bag *PkgBag) {
method makePkg (line 243) | func (me *hasElemsSequence) makePkg(bag *PkgBag) {
method makePkg (line 249) | func (me *hasElemSimpleContent) makePkg(bag *PkgBag) {
method makePkg (line 255) | func (me *hasElemsSimpleType) makePkg(bag *PkgBag) {
method makePkg (line 261) | func (me *hasElemTotalDigits) makePkg(bag *PkgBag) {
method makePkg (line 267) | func (me *hasElemUnion) makePkg(bag *PkgBag) {
method makePkg (line 273) | func (me *hasElemUnique) makePkg(bag *PkgBag) {
method makePkg (line 279) | func (me *hasElemWhiteSpace) makePkg(bag *PkgBag) {
method beforeMakePkg (line 285) | func (me *hasAttrAbstract) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 288) | func (me *hasAttrBase) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 291) | func (me *hasAttrBlock) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 294) | func (me *hasAttrDefault) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 297) | func (me *hasAttrFinal) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 300) | func (me *hasAttrFixed) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 303) | func (me *hasAttrForm) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 306) | func (me *hasAttrId) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 309) | func (me *hasAttrLang) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 312) | func (me *hasAttrMixed) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 315) | func (me *hasAttrName) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 319) | func (me *hasAttrNamespace) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 322) | func (me *hasAttrNillable) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 325) | func (me *hasAttrPublic) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 328) | func (me *hasAttrRef) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 331) | func (me *hasAttrRefer) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 334) | func (me *hasAttrSource) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 337) | func (me *hasAttrSystem) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 340) | func (me *hasAttrType) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 343) | func (me *hasAttrUse) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 346) | func (me *hasAttrValue) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 349) | func (me *hasAttrVersion) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 352) | func (me *hasAttrXpath) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 355) | func (me *hasAttrBlockDefault) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 358) | func (me *hasAttrFinalDefault) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 361) | func (me *hasAttrItemType) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 364) | func (me *hasAttrMaxOccurs) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 367) | func (me *hasAttrMemberTypes) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 370) | func (me *hasAttrMinOccurs) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 373) | func (me *hasAttrProcessContents) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 376) | func (me *hasAttrSchemaLocation) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 379) | func (me *hasAttrSubstitutionGroup) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 382) | func (me *hasAttrTargetNamespace) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 385) | func (me *hasAttrAttributeFormDefault) beforeMakePkg(bag *PkgBag) {
method beforeMakePkg (line 388) | func (me *hasAttrElementFormDefault) beforeMakePkg(bag *PkgBag) {
method afterMakePkg (line 391) | func (me *hasAttrAbstract) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 394) | func (me *hasAttrBase) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 397) | func (me *hasAttrBlock) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 400) | func (me *hasAttrDefault) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 403) | func (me *hasAttrFinal) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 406) | func (me *hasAttrFixed) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 409) | func (me *hasAttrForm) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 412) | func (me *hasAttrId) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 415) | func (me *hasAttrLang) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 418) | func (me *hasAttrMixed) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 421) | func (me *hasAttrName) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 425) | func (me *hasAttrNamespace) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 428) | func (me *hasAttrNillable) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 431) | func (me *hasAttrPublic) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 434) | func (me *hasAttrRef) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 437) | func (me *hasAttrRefer) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 440) | func (me *hasAttrSource) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 443) | func (me *hasAttrSystem) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 446) | func (me *hasAttrType) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 449) | func (me *hasAttrUse) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 452) | func (me *hasAttrValue) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 455) | func (me *hasAttrVersion) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 458) | func (me *hasAttrXpath) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 461) | func (me *hasAttrBlockDefault) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 464) | func (me *hasAttrFinalDefault) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 467) | func (me *hasAttrItemType) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 470) | func (me *hasAttrMaxOccurs) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 473) | func (me *hasAttrMemberTypes) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 476) | func (me *hasAttrMinOccurs) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 479) | func (me *hasAttrProcessContents) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 482) | func (me *hasAttrSchemaLocation) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 485) | func (me *hasAttrSubstitutionGroup) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 488) | func (me *hasAttrTargetNamespace) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 491) | func (me *hasAttrAttributeFormDefault) afterMakePkg(bag *PkgBag) {
method afterMakePkg (line 494) | func (me *hasAttrElementFormDefault) afterMakePkg(bag *PkgBag) {
FILE: hasparents.go
method initChildren (line 3) | func (me *hasElemAll) initChildren(p element) {
method initChildren (line 9) | func (me *hasElemAnnotation) initChildren(p element) {
method initChildren (line 15) | func (me *hasElemsAny) initChildren(p element) {
method initChildren (line 21) | func (me *hasElemsAnyAttribute) initChildren(p element) {
method initChildren (line 27) | func (me *hasElemsAppInfo) initChildren(p element) {
method initChildren (line 33) | func (me *hasElemsAttribute) initChildren(p element) {
method initChildren (line 39) | func (me *hasElemsAttributeGroup) initChildren(p element) {
method initChildren (line 45) | func (me *hasElemChoice) initChildren(p element) {
method initChildren (line 51) | func (me *hasElemsChoice) initChildren(p element) {
method initChildren (line 57) | func (me *hasElemComplexContent) initChildren(p element) {
method initChildren (line 63) | func (me *hasElemComplexType) initChildren(p element) {
method initChildren (line 69) | func (me *hasElemsComplexType) initChildren(p element) {
method initChildren (line 75) | func (me *hasElemsDocumentation) initChildren(p element) {
method initChildren (line 81) | func (me *hasElemsElement) initChildren(p element) {
method initChildren (line 87) | func (me *hasElemsEnumeration) initChildren(p element) {
method initChildren (line 93) | func (me *hasElemExtensionComplexContent) initChildren(p element) {
method initChildren (line 99) | func (me *hasElemExtensionSimpleContent) initChildren(p element) {
method initChildren (line 105) | func (me *hasElemField) initChildren(p element) {
method initChildren (line 111) | func (me *hasElemFractionDigits) initChildren(p element) {
method initChildren (line 117) | func (me *hasElemGroup) initChildren(p element) {
method initChildren (line 123) | func (me *hasElemsGroup) initChildren(p element) {
method initChildren (line 129) | func (me *hasElemsImport) initChildren(p element) {
method initChildren (line 135) | func (me *hasElemsKey) initChildren(p element) {
method initChildren (line 141) | func (me *hasElemKeyRef) initChildren(p element) {
method initChildren (line 147) | func (me *hasElemLength) initChildren(p element) {
method initChildren (line 153) | func (me *hasElemList) initChildren(p element) {
method initChildren (line 159) | func (me *hasElemMaxExclusive) initChildren(p element) {
method initChildren (line 165) | func (me *hasElemMaxInclusive) initChildren(p element) {
method initChildren (line 171) | func (me *hasElemMaxLength) initChildren(p element) {
method initChildren (line 177) | func (me *hasElemMinExclusive) initChildren(p element) {
method initChildren (line 183) | func (me *hasElemMinInclusive) initChildren(p element) {
method initChildren (line 189) | func (me *hasElemMinLength) initChildren(p element) {
method initChildren (line 195) | func (me *hasElemsNotation) initChildren(p element) {
method initChildren (line 201) | func (me *hasElemPattern) initChildren(p element) {
method initChildren (line 207) | func (me *hasElemsRedefine) initChildren(p element) {
method initChildren (line 213) | func (me *hasElemRestrictionComplexContent) initChildren(p element) {
method initChildren (line 219) | func (me *hasElemRestrictionSimpleContent) initChildren(p element) {
method initChildren (line 225) | func (me *hasElemRestrictionSimpleType) initChildren(p element) {
method initChildren (line 231) | func (me *hasElemSelector) initChildren(p element) {
method initChildren (line 237) | func (me *hasElemSequence) initChildren(p element) {
method initChildren (line 243) | func (me *hasElemsSequence) initChildren(p element) {
method initChildren (line 249) | func (me *hasElemSimpleContent) initChildren(p element) {
method initChildren (line 255) | func (me *hasElemsSimpleType) initChildren(p element) {
method initChildren (line 261) | func (me *hasElemTotalDigits) initChildren(p element) {
method initChildren (line 267) | func (me *hasElemUnion) initChildren(p element) {
method initChildren (line 273) | func (me *hasElemUnique) initChildren(p element) {
method initChildren (line 279) | func (me *hasElemWhiteSpace) initChildren(p element) {
FILE: makepkg.go
type pkgGen (line 26) | type pkgGen struct
type beforeAfterMake (line 33) | type beforeAfterMake interface
type pkgStack (line 38) | type pkgStack
method Pop (line 40) | func (me *pkgStack) Pop() (el interface{}) { sl := *me; el = sl[0]; *m...
method Push (line 42) | func (me *pkgStack) Push(el interface{}) { nu := []interface{}{el}; *m...
type pkgStacks (line 44) | type pkgStacks struct
method CurName (line 48) | func (me *pkgStacks) CurName() (r xsdt.NCName) {
method CurSimpleType (line 55) | func (me *pkgStacks) CurSimpleType() (r *SimpleType) {
method FullName (line 62) | func (me *pkgStacks) FullName() (r string) {
type PkgBag (line 69) | type PkgBag struct
method addType (line 132) | func (me *PkgBag) addType(elem element, n, t string, a ...*Annotation)...
method AnonName (line 142) | func (me *PkgBag) AnonName(n string) (an xsdt.NCName) {
method append (line 153) | func (me *PkgBag) append(lines ...string) {
method appendFmt (line 157) | func (me *PkgBag) appendFmt(addLineAfter bool, format string, fmtArgs ...
method assembleSource (line 164) | func (me *PkgBag) assembleSource() string {
method checkType (line 245) | func (me *PkgBag) checkType(typeSpec string) {
method isParseType (line 260) | func (me *PkgBag) isParseType(typeRef string) bool {
method resolveQnameRef (line 269) | func (me *PkgBag) resolveQnameRef(ref, pref string, noUsageRec *string...
method rewriteTypeSpec (line 293) | func (me *PkgBag) rewriteTypeSpec(typeSpec string) (tn string) {
method safeName (line 303) | func (me *PkgBag) safeName(name string) string {
method xsdStringTypeRef (line 307) | func (me *PkgBag) xsdStringTypeRef() string {
function newPkgBag (line 97) | func newPkgBag(schema *Schema) (bag *PkgBag) {
type declEmbed (line 311) | type declEmbed struct
method render (line 318) | func (me *declEmbed) render(bag *PkgBag, dt *declType) {
type declField (line 331) | type declField struct
method render (line 338) | func (me *declField) render(bag *PkgBag, dt *declType) {
type declMethod (line 348) | type declMethod struct
method render (line 354) | func (me *declMethod) render(bag *PkgBag, dt *declType) {
type declType (line 365) | type declType struct
method addAnnotations (line 376) | func (me *declType) addAnnotations(a ...*Annotation) {
method addField (line 380) | func (me *declType) addField(elem element, n, t, x string, a ...*Annot...
method addEmbed (line 386) | func (me *declType) addEmbed(elem element, name string, a ...*Annotati...
method addMethod (line 392) | func (me *declType) addMethod(elem element, recType, name, retType, bo...
method checkForEquivalents (line 398) | func (me *declType) checkForEquivalents(bag *PkgBag) {
method equivalentTo (line 408) | func (me *declType) equivalentTo(dt *declType) bool {
method render (line 456) | func (me *declType) render(bag *PkgBag) {
FILE: types/xsdtypes.go
type notation (line 7) | type notation struct
type Notations (line 11) | type Notations
method Add (line 13) | func (me Notations) Add(id, name, public, system string) {
type AnySimpleType (line 18) | type AnySimpleType
method Set (line 21) | func (me *AnySimpleType) Set(v string) {
method String (line 26) | func (me AnySimpleType) String() string {
type ToXsdtAnySimpleType (line 31) | type ToXsdtAnySimpleType interface
type AnyType (line 36) | type AnyType
method Set (line 39) | func (me *AnyType) Set(v string) {
method String (line 44) | func (me AnyType) String() string {
type ToXsdtAnyType (line 49) | type ToXsdtAnyType interface
type AnyURI (line 54) | type AnyURI
method Set (line 57) | func (me *AnyURI) Set(v string) {
method String (line 62) | func (me AnyURI) String() string {
type ToXsdtAnyURI (line 67) | type ToXsdtAnyURI interface
type Base64Binary (line 72) | type Base64Binary
method Set (line 75) | func (me *Base64Binary) Set(v string) {
method String (line 80) | func (me Base64Binary) String() string {
type ToXsdtBase64Binary (line 85) | type ToXsdtBase64Binary interface
type Boolean (line 90) | type Boolean
method B (line 93) | func (me Boolean) B() bool {
method Set (line 98) | func (me *Boolean) Set(v string) {
method String (line 112) | func (me Boolean) String() string {
type ToXsdtBoolean (line 117) | type ToXsdtBoolean interface
type Byte (line 122) | type Byte
method N (line 125) | func (me Byte) N() int8 {
method Set (line 130) | func (me *Byte) Set(s string) {
method String (line 136) | func (me Byte) String() string {
type ToXsdtByte (line 141) | type ToXsdtByte interface
type Date (line 147) | type Date
method Set (line 150) | func (me *Date) Set(v string) {
method String (line 155) | func (me Date) String() string {
type ToXsdtDate (line 160) | type ToXsdtDate interface
type DateTime (line 165) | type DateTime
method Set (line 168) | func (me *DateTime) Set(v string) {
method String (line 173) | func (me DateTime) String() string {
type ToXsdtDateTime (line 178) | type ToXsdtDateTime interface
type Time (line 183) | type Time
method Set (line 186) | func (me *Time) Set(v string) {
method String (line 191) | func (me Time) String() string {
type ToXsdtTime (line 196) | type ToXsdtTime interface
type Decimal (line 201) | type Decimal
method Set (line 204) | func (me *Decimal) Set(v string) {
method String (line 209) | func (me Decimal) String() string {
type ToXsdtDecimal (line 214) | type ToXsdtDecimal interface
type Double (line 219) | type Double
method N (line 222) | func (me Double) N() float64 {
method Set (line 227) | func (me *Double) Set(s string) {
method String (line 233) | func (me Double) String() string {
type ToXsdtDouble (line 238) | type ToXsdtDouble interface
type Duration (line 243) | type Duration
method Set (line 246) | func (me *Duration) Set(v string) {
method String (line 251) | func (me Duration) String() string {
type ToXsdtDuration (line 256) | type ToXsdtDuration interface
type Entities (line 261) | type Entities
method Set (line 264) | func (me *Entities) Set(v string) {
method String (line 269) | func (me Entities) String() string {
method Values (line 274) | func (me Entities) Values() (list []Entity) {
type ToXsdtEntities (line 284) | type ToXsdtEntities interface
type Entity (line 289) | type Entity
method Set (line 292) | func (me *Entity) Set(v string) {
method String (line 297) | func (me Entity) String() string {
type ToXsdtEntity (line 302) | type ToXsdtEntity interface
type Float (line 307) | type Float
method N (line 310) | func (me Float) N() float32 {
method Set (line 315) | func (me *Float) Set(s string) {
method String (line 321) | func (me Float) String() string {
type ToXsdtFloat (line 326) | type ToXsdtFloat interface
type GDay (line 331) | type GDay
method Set (line 334) | func (me *GDay) Set(v string) {
method String (line 339) | func (me GDay) String() string {
type ToXsdtGDay (line 344) | type ToXsdtGDay interface
type GMonth (line 349) | type GMonth
method Set (line 352) | func (me *GMonth) Set(v string) {
method String (line 357) | func (me GMonth) String() string {
type ToXsdtGMonth (line 362) | type ToXsdtGMonth interface
type GMonthDay (line 367) | type GMonthDay
method Set (line 370) | func (me *GMonthDay) Set(v string) {
method String (line 375) | func (me GMonthDay) String() string {
type ToXsdtGMonthDay (line 380) | type ToXsdtGMonthDay interface
type GYear (line 385) | type GYear
method Set (line 388) | func (me *GYear) Set(v string) {
method String (line 393) | func (me GYear) String() string {
type ToXsdtGYear (line 398) | type ToXsdtGYear interface
type GYearMonth (line 403) | type GYearMonth
method Set (line 406) | func (me *GYearMonth) Set(v string) {
method String (line 411) | func (me GYearMonth) String() string {
type ToXsdtGYearMonth (line 416) | type ToXsdtGYearMonth interface
type HexBinary (line 421) | type HexBinary
method Set (line 424) | func (me *HexBinary) Set(v string) {
method String (line 429) | func (me HexBinary) String() string {
type ToXsdtHexBinary (line 434) | type ToXsdtHexBinary interface
type Id (line 439) | type Id
method Set (line 442) | func (me *Id) Set(v string) {
method String (line 447) | func (me Id) String() string {
type ToXsdtId (line 452) | type ToXsdtId interface
type Idref (line 457) | type Idref
method Set (line 460) | func (me *Idref) Set(v string) {
method String (line 465) | func (me Idref) String() string {
type ToXsdtIdref (line 470) | type ToXsdtIdref interface
type Idrefs (line 475) | type Idrefs
method Set (line 478) | func (me *Idrefs) Set(v string) {
method String (line 483) | func (me Idrefs) String() string {
method Values (line 488) | func (me Idrefs) Values() (list []Idref) {
type ToXsdtIdrefs (line 498) | type ToXsdtIdrefs interface
type Int (line 503) | type Int
method N (line 506) | func (me Int) N() int32 {
method Set (line 511) | func (me *Int) Set(s string) {
method String (line 517) | func (me Int) String() string {
type ToXsdtInt (line 522) | type ToXsdtInt interface
type Integer (line 527) | type Integer
method N (line 530) | func (me Integer) N() int64 {
method Set (line 535) | func (me *Integer) Set(s string) {
method String (line 541) | func (me Integer) String() string {
type ToXsdtInteger (line 546) | type ToXsdtInteger interface
type Language (line 551) | type Language
method Set (line 554) | func (me *Language) Set(v string) {
method String (line 559) | func (me Language) String() string {
type ToXsdtLanguage (line 564) | type ToXsdtLanguage interface
type Long (line 569) | type Long
method N (line 572) | func (me Long) N() int64 {
method Set (line 577) | func (me *Long) Set(s string) {
method String (line 583) | func (me Long) String() string {
type ToXsdtLong (line 588) | type ToXsdtLong interface
type Name (line 593) | type Name
method Set (line 596) | func (me *Name) Set(v string) {
method String (line 601) | func (me Name) String() string {
type ToXsdtName (line 606) | type ToXsdtName interface
type NCName (line 611) | type NCName
method Set (line 614) | func (me *NCName) Set(v string) {
method String (line 619) | func (me NCName) String() string {
type ToXsdtNCName (line 624) | type ToXsdtNCName interface
type NegativeInteger (line 629) | type NegativeInteger
method N (line 632) | func (me NegativeInteger) N() int64 {
method Set (line 637) | func (me *NegativeInteger) Set(s string) {
method String (line 643) | func (me NegativeInteger) String() string {
type ToXsdtNegativeInteger (line 648) | type ToXsdtNegativeInteger interface
type Nmtoken (line 653) | type Nmtoken
method Set (line 656) | func (me *Nmtoken) Set(v string) {
method String (line 661) | func (me Nmtoken) String() string {
type ToXsdtNmtoken (line 666) | type ToXsdtNmtoken interface
type Nmtokens (line 671) | type Nmtokens
method Set (line 674) | func (me *Nmtokens) Set(v string) {
method String (line 679) | func (me Nmtokens) String() string {
method Values (line 684) | func (me Nmtokens) Values() (list []Nmtoken) {
type ToXsdtNmtokens (line 694) | type ToXsdtNmtokens interface
type NonNegativeInteger (line 699) | type NonNegativeInteger
method N (line 702) | func (me NonNegativeInteger) N() uint64 {
method Set (line 707) | func (me *NonNegativeInteger) Set(s string) {
method String (line 713) | func (me NonNegativeInteger) String() string {
type ToXsdtNonNegativeInteger (line 718) | type ToXsdtNonNegativeInteger interface
type NonPositiveInteger (line 723) | type NonPositiveInteger
method N (line 726) | func (me NonPositiveInteger) N() int64 {
method Set (line 731) | func (me *NonPositiveInteger) Set(s string) {
method String (line 737) | func (me NonPositiveInteger) String() string {
type ToXsdtNonPositiveInteger (line 742) | type ToXsdtNonPositiveInteger interface
type NormalizedString (line 747) | type NormalizedString
method Set (line 750) | func (me *NormalizedString) Set(v string) {
method String (line 755) | func (me NormalizedString) String() string {
type ToXsdtNormalizedString (line 760) | type ToXsdtNormalizedString interface
type Notation (line 765) | type Notation
method Set (line 768) | func (me *Notation) Set(v string) {
method String (line 773) | func (me Notation) String() string {
method Values (line 778) | func (me Notation) Values() (list []Qname) {
type ToXsdtNotation (line 788) | type ToXsdtNotation interface
type PositiveInteger (line 793) | type PositiveInteger
method N (line 796) | func (me PositiveInteger) N() uint64 {
method Set (line 801) | func (me *PositiveInteger) Set(s string) {
method String (line 807) | func (me PositiveInteger) String() string {
type ToXsdtPositiveInteger (line 812) | type ToXsdtPositiveInteger interface
type Qname (line 817) | type Qname
method Set (line 820) | func (me *Qname) Set(v string) {
method String (line 825) | func (me Qname) String() string {
type ToXsdtQname (line 830) | type ToXsdtQname interface
type Short (line 835) | type Short
method N (line 838) | func (me Short) N() int16 {
method Set (line 843) | func (me *Short) Set(s string) {
method String (line 849) | func (me Short) String() string {
type ToXsdtShort (line 854) | type ToXsdtShort interface
type String (line 859) | type String
method Set (line 862) | func (me *String) Set(v string) {
method String (line 867) | func (me String) String() string {
type ToXsdtString (line 872) | type ToXsdtString interface
type Token (line 877) | type Token
method Set (line 880) | func (me *Token) Set(v string) {
method String (line 885) | func (me Token) String() string {
type ToXsdtToken (line 890) | type ToXsdtToken interface
type UnsignedByte (line 895) | type UnsignedByte
method N (line 898) | func (me UnsignedByte) N() uint8 {
method Set (line 903) | func (me *UnsignedByte) Set(s string) {
method String (line 909) | func (me UnsignedByte) String() string {
type ToXsdtUnsignedByte (line 914) | type ToXsdtUnsignedByte interface
type UnsignedInt (line 919) | type UnsignedInt
method N (line 922) | func (me UnsignedInt) N() uint32 {
method Set (line 927) | func (me *UnsignedInt) Set(s string) {
method String (line 933) | func (me UnsignedInt) String() string {
type ToXsdtUnsignedInt (line 938) | type ToXsdtUnsignedInt interface
type UnsignedLong (line 943) | type UnsignedLong
method N (line 946) | func (me UnsignedLong) N() uint64 {
method Set (line 951) | func (me *UnsignedLong) Set(s string) {
method String (line 957) | func (me UnsignedLong) String() string {
type ToXsdtUnsignedLong (line 962) | type ToXsdtUnsignedLong interface
type UnsignedShort (line 967) | type UnsignedShort
method N (line 970) | func (me UnsignedShort) N() uint16 {
method Set (line 975) | func (me *UnsignedShort) Set(s string) {
method String (line 981) | func (me UnsignedShort) String() string {
type ToXsdtUnsignedShort (line 986) | type ToXsdtUnsignedShort interface
function ListValues (line 991) | func ListValues(v string) (spl []string) {
function ListValuesBoolean (line 1042) | func ListValuesBoolean(vals []Boolean) (sl []bool) {
function ListValuesDouble (line 1050) | func ListValuesDouble(vals []Double) (sl []float64) {
function ListValuesLong (line 1058) | func ListValuesLong(vals []Long) (sl []int64) {
function OnWalkError (line 1067) | func OnWalkError(err *error, slice *[]error, breakWalk bool, handler fun...
FILE: xsd-makepkg/main.go
function main (line 45) | func main() {
FILE: xsd-makepkg/tests/tests.go
function verifyDocs (line 19) | func verifyDocs(origData, faksData []byte) (errs []error) {
function verifyNode (line 30) | func verifyNode(orig, faks *xmlx.Node) (errs []error) {
function TestViaRemarshal (line 99) | func TestViaRemarshal(dirPath string, makeEmptyDoc func() interface{}) {
FILE: xsd-makepkg/tests/xsd-test-atom/main.go
type AtomEntryDoc (line 13) | type AtomEntryDoc struct
type AtomFeedDoc (line 18) | type AtomFeedDoc struct
function main (line 23) | func main() {
FILE: xsd-makepkg/tests/xsd-test-collada/main.go
type Col14Doc (line 15) | type Col14Doc struct
type Col15Doc (line 20) | type Col15Doc struct
function main (line 25) | func main() {
FILE: xsd-makepkg/tests/xsd-test-kml/main.go
type KmlDoc (line 13) | type KmlDoc struct
function main (line 18) | func main() {
FILE: xsd-makepkg/tests/xsd-test-rss/main.go
type RssDoc (line 13) | type RssDoc struct
function main (line 18) | func main() {
FILE: xsd-makepkg/tests/xsd-test-svg/main.go
type SvgDoc (line 13) | type SvgDoc struct
function main (line 18) | func main() {
FILE: xsd-schema.go
constant goPkgPrefix (line 20) | goPkgPrefix = ""
constant goPkgSuffix (line 21) | goPkgSuffix = "_go"
constant protSep (line 22) | protSep = "://"
constant xsdNamespaceUri (line 23) | xsdNamespaceUri = "http://www.w3.org/2001/XMLSchema"
type Schema (line 30) | type Schema struct
method allSchemas (line 64) | func (me *Schema) allSchemas(loadedSchemas map[string]bool) (schemas [...
method collectGlobals (line 76) | func (me *Schema) collectGlobals(bag *PkgBag, loadedSchemas map[string...
method globalComplexType (line 101) | func (me *Schema) globalComplexType(bag *PkgBag, name string, loadedSc...
method globalElement (line 122) | func (me *Schema) globalElement(bag *PkgBag, name string) (el *Element) {
method globalSubstitutionElems (line 141) | func (me *Schema) globalSubstitutionElems(el *Element, loadedSchemas m...
method MakeGoPkgSrcFile (line 164) | func (me *Schema) MakeGoPkgSrcFile() (goOutFilePath string, err error) {
method onLoad (line 183) | func (me *Schema) onLoad(rootAtts []xml.Attr, loadUri, localPath strin...
method RootSchema (line 232) | func (me *Schema) RootSchema(pathSchemas []string) *Schema {
function ClearLoadedSchemasCache (line 246) | func ClearLoadedSchemasCache() {
function loadSchema (line 250) | func loadSchema(r io.Reader, loadUri, localPath string) (sd *Schema, err...
function loadSchemaFile (line 274) | func loadSchemaFile(filename string, loadUri string) (sd *Schema, err er...
function LoadSchema (line 283) | func LoadSchema(uri string, localCopy bool) (sd *Schema, err error) {
Copy disabled (too large)
Download .json
Condensed preview — 53 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (38,999K chars).
[
{
"path": "LICENSE.md",
"chars": 1103,
"preview": "The MIT License (MIT)\r\n\r\nCopyright (c) 2014 Phil Schumann\r\n\r\nPermission is hereby granted, free of charge, to any person"
},
{
"path": "README.md",
"chars": 9476,
"preview": "go-xsd\r\n======\r\n\r\n\r\nA Go package for loading ( **xml.Unmarshal()**-ing ) an XML Schema Definition (XSD) document into an"
},
{
"path": "elem.go",
"chars": 10396,
"preview": "package xsd\r\n\r\nimport (\r\n\txsdt \"github.com/metaleap/go-xsd/types\"\r\n)\r\n\r\ntype element interface {\r\n\tbase() *elemBase\r\n\tin"
},
{
"path": "elemmakepkg.go",
"chars": 32257,
"preview": "package xsd\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"path\"\r\n\t\"strings\"\r\n\t\"unicode\"\r\n\r\n\t\"github.com/metaleap/go-util/str\"\r\n\r\n\txsdt \"github."
},
{
"path": "elemparents.go",
"chars": 12337,
"preview": "package xsd\r\n\r\nfunc (me *All) initElement(parent element) {\r\n\tme.elemBase.init(parent, me, \"all\", &me.hasAttrId, &me.has"
},
{
"path": "hasattr.go",
"chars": 2981,
"preview": "package xsd\r\n\r\nimport (\r\n\txsdt \"github.com/metaleap/go-xsd/types\"\r\n)\r\n\r\ntype hasAttrAbstract struct {\r\n\tAbstract bool `x"
},
{
"path": "haselem.go",
"chars": 4227,
"preview": "package xsd\r\n\r\ntype hasCdata struct {\r\n\tCDATA string `xml:\",chardata\"`\r\n}\r\n\r\ntype hasElemAll struct {\r\n\tAll *All `xml:\"a"
},
{
"path": "hasmakepkg.go",
"chars": 10067,
"preview": "package xsd\r\n\r\nfunc (me *hasElemAll) makePkg(bag *PkgBag) {\r\n\tif me.All != nil {\r\n\t\tme.All.makePkg(bag)\r\n\t}\r\n}\r\n\r\nfunc ("
},
{
"path": "hasparents.go",
"chars": 5941,
"preview": "package xsd\r\n\r\nfunc (me *hasElemAll) initChildren(p element) {\r\n\tif me.All != nil {\r\n\t\tme.All.initElement(p)\r\n\t}\r\n}\r\n\r\nf"
},
{
"path": "makepkg.go",
"chars": 18063,
"preview": "package xsd\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"path\"\r\n\t\"strings\"\r\n\r\n\t\"github.com/metaleap/go-util/dev/go\"\r\n\t\"github.com/metaleap/go-"
},
{
"path": "types/README.md",
"chars": 36618,
"preview": "# xsdt\r\n--\r\n import \"github.com/metaleap/go-xsd/types\"\r\n\r\nA tiny package imported by all \"go-xsd\"-generated packages."
},
{
"path": "types/doc.go",
"chars": 754,
"preview": "//\tA tiny package imported by all \"go-xsd\"-generated packages.\r\n//\t\r\n//\tMaps all XSD built-in simple-types to Go types, "
},
{
"path": "types/xsdtypes.go",
"chars": 33529,
"preview": "package xsdt\r\n\r\nimport (\r\n\t\"strconv\"\r\n)\r\n\r\ntype notation struct {\r\n\tId, Name, Public, System string\r\n}\r\n\r\ntype Notations"
},
{
"path": "xsd-makepkg/main.go",
"chars": 3640,
"preview": "package main\r\n\r\nimport (\r\n\t\"flag\"\r\n\t\"log\"\r\n\t\"os/exec\"\r\n\t\"strings\"\r\n\r\n\t\"github.com/metaleap/go-util/dev/go\"\r\n\r\n\txsd \"gith"
},
{
"path": "xsd-makepkg/tests/README.md",
"chars": 804,
"preview": "# tests\r\n--\r\n import \"github.com/metaleap/go-xsd/xsd-makepkg/tests\"\r\n\r\n\tA simple test function shared by the various "
},
{
"path": "xsd-makepkg/tests/doc.go",
"chars": 131,
"preview": "//\tA simple test function shared by the various test programs inside this directory (rss, atom, collada, svg etc.)\r\npack"
},
{
"path": "xsd-makepkg/tests/tests.go",
"chars": 4191,
"preview": "package tests\r\n\r\nimport (\r\n\t\"encoding/xml\"\r\n\t\"fmt\"\r\n\t\"log\"\r\n\t\"path/filepath\"\r\n\t\"strings\"\r\n\r\n\t\"github.com/metaleap/go-uti"
},
{
"path": "xsd-makepkg/tests/xsd-test-atom/feed/infiles/samplefeed.xml",
"chars": 590,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<feed xmlns=\"http://www.w3.org/2005/Atom\">\r\n\r\n <title>Example Feed</title>\r\n <"
},
{
"path": "xsd-makepkg/tests/xsd-test-atom/feed/outfiles/samplefeed.xml",
"chars": 1240,
"preview": "<feed base=\"\" lang=\"\">\r\n\t<link xmlns=\"http://www.w3.org/2005/Atom\" length=\"0\" title=\"\" href=\"http://example.org/\" hrefla"
},
{
"path": "xsd-makepkg/tests/xsd-test-atom/main.go",
"chars": 902,
"preview": "package main\r\n\r\nimport (\r\n\t\"encoding/xml\"\r\n\r\n\t\"github.com/metaleap/go-xsd/xsd-makepkg/tests\"\r\n\r\n\t\"github.com/metaleap/go"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/infiles/cube.dae",
"chars": 11812,
"preview": "<?xml version=\"1.0\" ?><COLLADA version=\"1.4.1\" xmlns=\"http://www.collada.org/2005/11/COLLADASchema\">\r\n <asset>\r\n "
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/infiles/cube_triangulate.dae",
"chars": 11784,
"preview": "<?xml version=\"1.0\" ?><COLLADA version=\"1.4.1\" xmlns=\"http://www.collada.org/2005/11/COLLADASchema\">\r\n <asset>\r\n "
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/infiles/duck.dae",
"chars": 284555,
"preview": "<?xml version=\"1.0\" ?><COLLADA version=\"1.4.1\" xmlns=\"http://www.collada.org/2005/11/COLLADASchema\">\r\n <asset>\r\n "
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/infiles/duck_triangulate.dae",
"chars": 335825,
"preview": "<?xml version=\"1.0\" ?><COLLADA version=\"1.4.1\" xmlns=\"http://www.collada.org/2005/11/COLLADASchema\">\r\n <asset>\r\n "
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/infiles/mgmidget.dae",
"chars": 6145662,
"preview": "<?xml version=\"1.0\" ?><COLLADA version=\"1.4.1\" xmlns=\"http://www.collada.org/2005/11/COLLADASchema\">\r\n <asset>\r\n "
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/outfiles/cube.dae",
"chars": 18713,
"preview": "<COLLADA version=\"1.4.1\" base=\"\">\r\n\t<library_geometries xmlns=\"http://www.collada.org/2005/11/COLLADASchema\" name=\"\" id="
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/outfiles/cube_triangulate.dae",
"chars": 18609,
"preview": "<COLLADA version=\"1.4.1\" base=\"\">\r\n\t<library_geometries xmlns=\"http://www.collada.org/2005/11/COLLADASchema\" name=\"\" id="
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/outfiles/duck.dae",
"chars": 291558,
"preview": "<COLLADA version=\"1.4.1\" base=\"\">\r\n\t<library_geometries xmlns=\"http://www.collada.org/2005/11/COLLADASchema\" name=\"\" id="
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/outfiles/duck_triangulate.dae",
"chars": 342790,
"preview": "<COLLADA version=\"1.4.1\" base=\"\">\r\n\t<library_geometries xmlns=\"http://www.collada.org/2005/11/COLLADASchema\" name=\"\" id="
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.4.1/outfiles/mgmidget.dae",
"chars": 6548693,
"preview": "<COLLADA version=\"1.4.1\" base=\"\">\r\n\t<library_nodes xmlns=\"http://www.collada.org/2005/11/COLLADASchema\" name=\"\" id=\"\">\r\n"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/infiles/berlin.dae",
"chars": 9663133,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<COLLADA version=\"1.5\" xmlns=\"http://www.collada.org/2008/03/CO"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/infiles/cube.dae",
"chars": 8775,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<COLLADA version=\"1.5\" xmlns=\"http://www.collada.org/2008/03/CO"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/infiles/cube_triangulate.dae",
"chars": 8777,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<COLLADA version=\"1.5\" xmlns=\"http://www.collada.org/2008/03/CO"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/infiles/duck.dae",
"chars": 282277,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<COLLADA version=\"1.5\" xmlns=\"http://www.collada.org/2008/03/CO"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/infiles/duck_triangulate.dae",
"chars": 333562,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<COLLADA version=\"1.5\" xmlns=\"http://www.collada.org/2008/03/CO"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/infiles/mgmidget.dae",
"chars": 5951988,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<COLLADA version=\"1.5\" xmlns=\"http://www.collada.org/2008/03/CO"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/outfiles/cube.dae",
"chars": 18436,
"preview": "<COLLADA base=\"\" version=\"1.5\">\r\n\t<asset xmlns=\"http://www.collada.org/2008/03/COLLADASchema\">\r\n\t\t<modified xmlns=\"http:"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/outfiles/cube_triangulate.dae",
"chars": 18332,
"preview": "<COLLADA base=\"\" version=\"1.5\">\r\n\t<asset xmlns=\"http://www.collada.org/2008/03/COLLADASchema\">\r\n\t\t<modified xmlns=\"http:"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/outfiles/duck.dae",
"chars": 290802,
"preview": "<COLLADA base=\"\" version=\"1.5\">\r\n\t<asset xmlns=\"http://www.collada.org/2008/03/COLLADASchema\">\r\n\t\t<modified xmlns=\"http:"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/outfiles/duck_triangulate.dae",
"chars": 342034,
"preview": "<COLLADA base=\"\" version=\"1.5\">\r\n\t<asset xmlns=\"http://www.collada.org/2008/03/COLLADASchema\">\r\n\t\t<modified xmlns=\"http:"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/1.5/outfiles/mgmidget.dae",
"chars": 6543308,
"preview": "<COLLADA base=\"\" version=\"1.5\">\r\n\t<asset xmlns=\"http://www.collada.org/2008/03/COLLADASchema\">\r\n\t\t<modified xmlns=\"http:"
},
{
"path": "xsd-makepkg/tests/xsd-test-collada/main.go",
"chars": 1385,
"preview": "package main\r\n\r\nimport (\r\n\t\"encoding/xml\"\r\n\t\"log\"\r\n\r\n\t\"github.com/metaleap/go-xsd/xsd-makepkg/tests\"\r\n\r\n\t\"github.com/met"
},
{
"path": "xsd-makepkg/tests/xsd-test-kml/infiles/doc.kml",
"chars": 16828,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml"
},
{
"path": "xsd-makepkg/tests/xsd-test-kml/main.go",
"chars": 574,
"preview": "package main\r\n\r\nimport (\r\n\t\"encoding/xml\"\r\n\r\n\t\"github.com/metaleap/go-xsd/xsd-makepkg/tests\"\r\n\r\n\t\"github.com/metaleap/go"
},
{
"path": "xsd-makepkg/tests/xsd-test-kml/outfiles/doc.kml",
"chars": 55504,
"preview": "<kml xmlns=\"http://www.opengis.net/kml/2.2\" hint=\"\">\r\n\t<Folder xmlns=\"http://www.opengis.net/kml/2.2\" targetId=\"\" id=\"\">"
},
{
"path": "xsd-makepkg/tests/xsd-test-rss/infiles/go-ngine-blog.rss",
"chars": 10101,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!--Generated by Site Server v6.0.0 (http://www.squarespace.com) on Mon, 12 Nov "
},
{
"path": "xsd-makepkg/tests/xsd-test-rss/main.go",
"chars": 538,
"preview": "package main\r\n\r\nimport (\r\n\t\"encoding/xml\"\r\n\r\n\t\"github.com/metaleap/go-xsd/xsd-makepkg/tests\"\r\n\r\n\t\"github.com/metaleap/go"
},
{
"path": "xsd-makepkg/tests/xsd-test-rss/outfiles/go-ngine-blog.rss",
"chars": 11296,
"preview": "<rss version=\"2.0\">\r\n\t<channel>\r\n\t\t<generator>Site Server v6.0.0 (http://www.squarespace.com)</generator>\r\n\t\t<item>\r\n\t\t\t"
},
{
"path": "xsd-makepkg/tests/xsd-test-svg/main.go",
"chars": 545,
"preview": "package main\r\n\r\nimport (\r\n\t\"encoding/xml\"\r\n\r\n\t\"github.com/metaleap/go-xsd/xsd-makepkg/tests\"\r\n\r\n\t\"github.com/metaleap/go"
},
{
"path": "xsd-schema.go",
"chars": 8427,
"preview": "package xsd\r\n\r\nimport (\r\n\t\"bytes\"\r\n\t\"encoding/xml\"\r\n\t\"fmt\"\r\n\t\"io\"\r\n\t\"io/ioutil\"\r\n\t\"os\"\r\n\t\"path\"\r\n\t\"path/filepath\"\r\n\t\"str"
}
]
// ... and 3 more files (download for full content)
About this extraction
This page contains the full source code of the metaleap/go-xsd GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 53 files (71.3 MB), approximately 9.4M tokens, and a symbol index with 680 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.