schema

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package schema 提供内置 OFD XSD 模式的加载和查询能力。

Index

Constants

This section is empty.

Variables

View Source
var Files embed.FS

Files 保存校验器使用的 OFD XSD 集合。文件名和相对路径保持不变, 因为这些模式文件通过 xs:include 相互引用。

Functions

This section is empty.

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set 是按根元素索引的已编译模式集合。

byRoot 是 GB/T 33190—2016 发布的官方模式,原样保留;profileByRoot 是 profile overlay,只在文档声明了非基础 DocType 时使用。两者按需选择, 因此基础 profile 的一致性检查不受 overlay 影响。

func Default

func Default() (*Set, error)

Default 返回内置且已编译的 OFD 模式。由于 xsd.Schema 加载后不可变且可安全共享, 因此只编译一次。

func (*Set) Schema

func (s *Set) Schema(root string) (*xsd.Schema, bool)

Schema 返回指定 OFD XML 根元素对应的官方模式,等价于以基础 DocType 调用 SchemaFor。

func (*Set) SchemaFor added in v0.1.4

func (s *Set) SchemaFor(root string, docType string) (*xsd.Schema, bool)

SchemaFor 返回指定根元素对应的模式。docType 为空或为基础 profile 时用官方 GB/T 33190 模式,其余已知 profile 改用 overlay——GB/T 42133 与电子病历标准 把 DocType 收紧为 "OFD-A"/"OFD-H",直接用官方模式校验会把合规文件判为错误。

overlay 只负责不产生假阳性,profile 的具体要求由校验器的 profile 规则负责。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL