mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
1 parent
d3a713f504
commit
528162a276
16 files changed
+3998
-254
No files matched your search
+7
-3
@@ -30,7 +30,7 @@ const structureTypeOfficial = "od"
|
||||
const structureNamespaceEGov2013 = "http://www.nits.org.cn/eGovDoc/2013"
|
||||
|
||||
// Structure 保存自定义标引入口及结构树,单个文件解析失败时通过Error报告,不影响其他标引
|
||||
// CanBind表示已识别标引引用规则,包括公文标引及本库富文本标引,具体节点和目标仍由绑定接口校验
|
||||
// CanBind表示已识别标引引用规则,包括公文、富文本及发票标引,具体节点和目标仍由绑定接口校验
|
||||
// Internal标记本库内部编辑标引,不删除或重排入口;界面跳过此项时必须保留原始数组索引
|
||||
// 此标记不限制通用低级编辑接口,也不表示内部元数据内容已通过有效性校验
|
||||
type Structure struct {
|
||||
@@ -45,7 +45,7 @@ type Structure struct {
|
||||
|
||||
// StructureNode 保存标引节点的名称、属性、直接文本和有序子节点,不改变原始XML
|
||||
// Text按文档顺序汇总直接文本并保留空白,不包含子节点文本
|
||||
// References仅解释已识别公文标引或本库富文本标引中的ObjectRef;未知扩展保留结构,不推定其引用语义
|
||||
// References仅解释已识别公文、富文本或发票标引中的ObjectRef;未知扩展保留结构,不推定其引用语义
|
||||
type StructureNode struct {
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
@@ -124,6 +124,7 @@ func (r *Reader) readStructureContext(ctx context.Context, tag CustomTag) (Struc
|
||||
}
|
||||
item.CanBind = structureOfficial(tag, item.Root.Namespace)
|
||||
item.Internal = tag.TypeID == richTextTagType && tag.NameSpace == richTextNamespace && item.Root.Namespace == richTextNamespace && item.Root.Name == "RichText"
|
||||
item.Internal = item.Internal || tag.TypeID == invoiceTagType && tag.NameSpace == invoiceNamespace && item.Root.Namespace == invoiceNamespace && item.Root.Name == "Invoice"
|
||||
return item, nil
|
||||
}
|
||||
|
||||
@@ -215,10 +216,13 @@ func parseStructure(ctx context.Context, data []byte, tag CustomTag) (*Structure
|
||||
return root, nil
|
||||
}
|
||||
|
||||
// structureOfficial 识别公文和本库富文本标引的明确引用规则,不推断未知行业语义
|
||||
// structureOfficial 识别公文、富文本及发票标引的明确引用规则,不推断未知行业语义
|
||||
// 入参: tag 标引入口, namespace 内容根节点命名空间
|
||||
// 返回: bool 是否使用公文引用规则
|
||||
func structureOfficial(tag CustomTag, namespace string) bool {
|
||||
if tag.TypeID == invoiceTagType && tag.NameSpace == invoiceNamespace && namespace == invoiceNamespace {
|
||||
return true
|
||||
}
|
||||
if tag.TypeID == richTextTagType && tag.NameSpace == richTextNamespace && namespace == richTextNamespace {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user