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) IsScalar() bool
- 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) Values(name string) []string
- 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
// XMLAttrs are the attributes of the XML namespace itself (xml:space,
// xml:lang), metadata about the text rather than properties of the element.
XMLAttrs 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
// contains filtered or unexported fields
}
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) Attr ¶
Attr returns the property named by its local name, or "" when absent: the XML attribute, else the text of the first child element serializing it (`<name>Vehicle</name>`, XMI 2.5.1 § 9.4.4), the attribute taking precedence.
func (*Element) Descendants ¶
Descendants returns every descendant (not the element itself) in document order.
func (*Element) IsScalar ¶ added in v0.12.0
IsScalar reports whether the element serializes a property value of its parent rather than an owned element: no xmi:type or xmi:id, no attribute other than XML's own (so no idref or href) and no child elements, only text.
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. |