Documentation
¶
Overview ¶
Package xmi parses XMI documents into an immutable element tree indexed by xmi:id. The fUML and PSSM test-suite readers in tools/referee and sysmlv1 interpret that tree for their respective models.
Index ¶
- func IsUMLNamespace(ns string) bool
- func IsXMINamespace(ns string) bool
- type Document
- type Element
- func (e *Element) Attr(name string) string
- func (e *Element) Descendants() []*Element
- func (e *Element) Describe() string
- func (e *Element) First(tag string) *Element
- func (e *Element) Href() string
- func (e *Element) Name() string
- func (e *Element) Namespace(prefix string) string
- func (e *Element) Ref(name string) string
- func (e *Element) Refs(name string) []string
- func (e *Element) Tagged(tag string) []*Element
- func (e *Element) Walk(fn func(*Element) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUMLNamespace ¶
IsUMLNamespace reports whether ns is a UML metamodel namespace.
func IsXMINamespace ¶
IsXMINamespace reports whether ns is an XMI namespace.
Types ¶
type Document ¶
type Document struct {
Root *Element
// contains filtered or unexported fields
}
Document is a parsed XMI file: its root and an index of every xmi:id.
type Element ¶
type Element struct {
Tag string
Space string
Type string
ID string
Attrs map[string]string
XMIAttrs map[string]string
// Namespaces are the xmlns declarations on this element, prefix to URI;
// the default namespace is under "".
Namespaces map[string]string
Text string
Children []*Element
Parent *Element
Line int
}
Element is one XML element of an XMI document: its local tag, its xmi:type and xmi:id, its non-XMI and XMI attributes by local name, the namespaces it declares, and its children in document order. A parsed document is never modified after Parse returns.
func (*Element) Descendants ¶
Descendants returns every descendant (not the element itself) in document order.
func (*Element) Namespace ¶
Namespace resolves a prefix to the URI declared for it on this element or the nearest ancestor, or "" when none declares it.
func (*Element) Ref ¶
Ref returns the xmi:id a reference names, whether written as an attribute (`guard="_x"`) or as a child element (`<guard xmi:idref="_x"/>`), or "".
func (*Element) Refs ¶
Refs returns every xmi:id a multi-valued reference names: the attribute's space-separated ids and each child element's idref.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sysmlv1 interprets the element tree of internal/translate/xmi as the UML model with stereotype applications that SysML v1 tools export.
|
Package sysmlv1 interprets the element tree of internal/translate/xmi as the UML model with stereotype applications that SysML v1 tools export. |