Skip to content

Instantly share code, notes, and snippets.

@ae6rt
Created February 20, 2015 23:19
Show Gist options
  • Save ae6rt/a37c97e9af4dc0d9a62b to your computer and use it in GitHub Desktop.
Save ae6rt/a37c97e9af4dc0d9a62b to your computer and use it in GitHub Desktop.
Partial modelling of a Maven POM in Go. There's a lot here, including namespaces, attribute namespaces, and dynamic elements.
type Project struct {
XMLName struct{} `xml:"http://maven.apache.org/POM/4.0.0 project"`
SchemaLocation string `xml:"http://www.w3.org/2001/XMLSchema-instance schemaLocation,attr"`
ModelVersion string `xml:"modelVersion"`
GroupID string `xml:"groupId"`
ArtifactID string `xml:"artifactId"`
Version string `xml:"version"`
Packaging string `xml:"packaging"`
Properties Properties `xml:"properties"`
DependencyManagement DependencyManagement `xml:"dependencyManagement"`
Dependencies Dependencies `xml:"dependencies"`
Build Build `xml:"build"`
Repositories Repositories `xml:"repositories"`
PluginRepositories PluginRepositories `xml:"pluginRepositories"`
DistributionManagement DistributionManagement `xml:"distributionManagement"`
}
type Build struct {
V string `xml:",innerxml"`
}
type Repositories struct {
V string `xml:",innerxml"`
}
type DistributionManagement struct {
V string `xml:",innerxml"`
}
type PluginRepositories struct {
V string `xml:",innerxml"`
}
type Property struct {
XMLName xml.Name `xml:""`
Value string `xml:",chardata"`
}
type Properties struct {
Values []Property `xml:",any"`
}
type DependencyManagement struct {
V string `xml:",innerxml"`
}
type Dependencies struct {
V string `xml:",innerxml"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment