Documentation
¶
Overview ¶
Package parser parses XSD documents into raw symbolic components. References remain unresolved at this phase.
Index ¶
- func HasPlaceholders(schema *Schema) bool
- func ImportContextKey(fsKey, location string) string
- func ImportContextLocation(key string) string
- type Directive
- type DirectiveKind
- type Form
- type GlobalDecl
- type GlobalDeclKind
- type ImportContext
- type ImportInfo
- type IncludeInfo
- type ParseError
- type ParseResult
- func ParseWithImportsOptions(r io.Reader, opts ...xmlstream.Option) (*ParseResult, error)
- func ParseWithImportsOptionsWithPool(r io.Reader, pool *xmltree.DocumentPool, opts ...xmlstream.Option) (*ParseResult, error)
- func ParseWithOptions(r io.Reader, opts ...xmlstream.Option) (*ParseResult, error)
- func ParseWithOptionsWithPool(r io.Reader, pool *xmltree.DocumentPool, opts ...xmlstream.Option) (*ParseResult, error)
- type Parser
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasPlaceholders ¶ added in v0.0.23
HasPlaceholders reports whether unresolved type placeholders remain.
func ImportContextKey ¶ added in v0.0.16
ImportContextKey combines a filesystem key and location into a stable lookup key.
func ImportContextLocation ¶ added in v0.0.16
ImportContextLocation extracts the original location from an import context key.
Types ¶
type Directive ¶ added in v0.0.16
type Directive struct {
Import ImportInfo
Include IncludeInfo
Kind DirectiveKind
}
Directive preserves the document order for include/import directives.
type DirectiveKind ¶ added in v0.0.16
type DirectiveKind uint8
DirectiveKind represents an include/import directive in document order.
const ( DirectiveInclude DirectiveKind = iota DirectiveImport )
type Form ¶ added in v0.0.4
type Form int
Form represents qualified/unqualified element/attribute forms
type GlobalDecl ¶ added in v0.0.16
type GlobalDecl struct {
Name model.QName
Kind GlobalDeclKind
}
GlobalDecl tracks a top-level declaration in document order.
type GlobalDeclKind ¶ added in v0.0.16
type GlobalDeclKind int
GlobalDeclKind identifies top-level schema declarations in document order.
const ( // GlobalDeclElement represents a top-level element declaration. GlobalDeclElement GlobalDeclKind = iota // GlobalDeclType represents a top-level type declaration (complex or simple). GlobalDeclType // GlobalDeclAttribute represents a top-level attribute declaration. GlobalDeclAttribute // GlobalDeclAttributeGroup represents a top-level attributeGroup declaration. GlobalDeclAttributeGroup // GlobalDeclGroup represents a top-level model group declaration. GlobalDeclGroup // GlobalDeclNotation represents a top-level notation declaration. GlobalDeclNotation )
type ImportContext ¶ added in v0.0.4
type ImportContext struct {
Imports map[model.NamespaceURI]bool
TargetNamespace model.NamespaceURI
}
ImportContext tracks import namespaces for a specific schema document.
type ImportInfo ¶
ImportInfo represents an import directive from an XSD schema. Imports allow referencing components from a different namespace.
type IncludeInfo ¶
IncludeInfo represents an include directive from an XSD schema. Includes allow referencing components from the same namespace or no namespace.
type ParseError ¶
ParseError represents a schema parsing error with an error code
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Error implements the error interface.
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error
Unwrap returns the wrapped error, if any.
type ParseResult ¶
type ParseResult struct {
Schema *Schema
Directives []Directive
Imports []ImportInfo
Includes []IncludeInfo
}
ParseResult contains the parsed schema and import/include directives
func ParseWithImportsOptions ¶ added in v0.0.22
ParseWithImportsOptions parses an XSD schema with XML reader options.
func ParseWithImportsOptionsWithPool ¶ added in v0.0.24
func ParseWithImportsOptionsWithPool(r io.Reader, pool *xmltree.DocumentPool, opts ...xmlstream.Option) (*ParseResult, error)
ParseWithImportsOptionsWithPool parses an XSD schema with XML reader options and an explicit document pool.
func ParseWithOptions ¶ added in v0.0.25
ParseWithOptions parses one schema and returns directive metadata.
func ParseWithOptionsWithPool ¶ added in v0.0.25
func ParseWithOptionsWithPool(r io.Reader, pool *xmltree.DocumentPool, opts ...xmlstream.Option) (*ParseResult, error)
ParseWithOptionsWithPool parses one schema with an explicit document pool.
type Parser ¶ added in v0.0.25
type Parser struct {
// contains filtered or unexported fields
}
Parser parses schemas with reusable parse options and document pool.
type Schema ¶ added in v0.0.4
type Schema struct {
ImportContexts map[string]ImportContext
Groups map[model.QName]*model.ModelGroup
ElementOrigins map[model.QName]string
TypeDefs map[model.QName]model.Type
TypeOrigins map[model.QName]string
AttributeDecls map[model.QName]*model.AttributeDecl
SubstitutionGroups map[model.QName][]model.QName
AttributeGroups map[model.QName]*model.AttributeGroup
AttributeGroupOrigins map[model.QName]string
ImportedNamespaces map[model.NamespaceURI]map[model.NamespaceURI]bool
ElementDecls map[model.QName]*model.ElementDecl
GroupOrigins map[model.QName]string
AttributeOrigins map[model.QName]string
NotationOrigins map[model.QName]string
NotationDecls map[model.QName]*model.NotationDecl
IDAttributes map[string]string
NamespaceDecls map[string]string
Location string
TargetNamespace model.NamespaceURI
GlobalDecls []GlobalDecl
FinalDefault model.DerivationSet
AttributeFormDefault Form
ElementFormDefault Form
BlockDefault model.DerivationSet
}
Schema represents a compiled XSD schema
Source Files
¶
- annotation_rule_kernel.go
- attribute_group_ref.go
- attribute_group_top_level.go
- attribute_local.go
- attribute_parsing.go
- attribute_profiles.go
- attribute_reference.go
- attribute_top_level.go
- attribute_uses.go
- bool.go
- complex_content_derivation.go
- complex_content_helpers.go
- complex_content_parse.go
- complex_handlers_attributes.go
- complex_handlers_content.go
- complex_handlers_guards.go
- complex_tables.go
- complex_type_inline.go
- complex_type_parse.go
- complex_type_state.go
- components_parsing.go
- content_derivation_kernel.go
- derivation_set.go
- directives_parsing.go
- doc.go
- element_attribute_scan.go
- element_attribute_validation.go
- element_children_validation.go
- element_declaration_kernel.go
- element_local_constraints.go
- element_local_parse.go
- element_local_type.go
- element_local_validation.go
- element_namespace_prefix.go
- element_qname_namespace.go
- element_qname_resolution.go
- element_reference_parsing.go
- element_top_level_attributes.go
- element_top_level_parse.go
- element_top_level_type.go
- element_type_kernel.go
- id_validation.go
- identity_constraints.go
- import_context.go
- model_group_children.go
- model_group_parse.go
- model_group_top_level.go
- occurs.go
- parse.go
- parser_stateful.go
- placeholders_content_particle.go
- placeholders_schema.go
- placeholders_type.go
- schema.go
- schema_attributes_shared.go
- simple_content_extension.go
- simple_content_parse.go
- simple_content_restriction.go
- simple_derivation_list_union.go
- simple_derivation_restriction.go
- simple_facets_enumeration.go
- simple_facets_flow.go
- simple_facets_numeric.go
- simple_facets_ordered.go
- simple_facets_registry.go
- simple_facets_whitespace.go
- simple_type_definitions.go
- validation.go
- wildcard.go
- wildcard_any.go
- wildcard_attribute.go
- xmlns.go