/*
* schemas.c : implementation of the XML Schema handling and
* schema validity checking
*
* See Copyright for the status of this software.
*
* Daniel Veillard <veillard@redhat.com>
*/
/*
* TODO:
* - when types are redefined in includes, check that all
* types in the redef list are equal
* -> need a type equality operation.
* - if we don't intend to use the schema for schemas, we
* need to validate all schema attributes (ref, type, name)
* against their types.
*/
#define IN_LIBXML
#include "libxml.h"
#ifdef LIBXML_SCHEMAS_ENABLED
#include <string.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/hash.h>
#include <libxml/uri.h>
#include <libxml/xmlschemas.h>
#include <libxml/schemasInternals.h>
#include <libxml/xmlschemastypes.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlregexp.h>
#include <libxml/dict.h>
/* #define DEBUG 1 */
/* #define DEBUG_CONTENT 1 */
/* #define DEBUG_TYPE 1 */
/* #define DEBUG_CONTENT_REGEXP 1 */
/* #define DEBUG_AUTOMATA 1 */
/* #define DEBUG_ATTR_VALIDATION 1 */
/* #define DEBUG_UNION_VALIDATION 1 */
#define UNBOUNDED (1 << 30)
#define TODO \
xmlGenericError(xmlGenericErrorContext, \
"Unimplemented block at %s:%d\n", \
__FILE__, __LINE__);
#define XML_SCHEMAS_NO_NAMESPACE (const xmlChar *) "##"
/*
* The XML Schemas namespace1s
*/
static const xmlChar *xmlSchemaNs = (const xmlChar *)
"http://www.w3.org/2001/XMLSchema";
static const xmlChar *xmlSchemaInstanceNs = (const xmlChar *)
"http://www.w3.org/2001/XMLSchema-instance";
static const xmlChar *xmlSchemaElemDesElemDecl = (const xmlChar *)
"Element decl.";
static const xmlChar *xmlSchemaElemDesElemRef = (const xmlChar *)
"Element ref.";
static const xmlChar *xmlSchemaElemDesAttrDecl = (const xmlChar *)
"Attribute decl.";
static const xmlChar *xmlSchemaElemDesAttrRef = (const xmlChar *)
"Attribute ref.";
static const xmlChar *xmlSchemaElemDesST = (const xmlChar *)
"ST";
static const xmlChar *xmlSchemaElemDesCT = (const xmlChar *)
"CT";
#define IS_SCHEMA(node, type) \
((node != NULL) && (node->ns != NULL) && \
(xmlStrEqual(node->name, (const xmlChar *) type)) && \
(xmlStrEqual(node->ns->href, xmlSchemaNs)))
#define FREE_AND_NULL(str) \
if (str != NULL) { \
xmlFree(str); \
str = NULL; \
}
#define IS_ANYTYPE(item) \
((item->type == XML_SCHEMA_TYPE_BASIC) && \
(item->builtInType == XML_SCHEMAS_ANYTYPE))
#define IS_COMPLEX_TYPE(item) \
((item->type == XML_SCHEMA_TYPE_COMPLEX) || \
(item->builtInType == XML_SCHEMAS_ANYTYPE))
#define IS_SIMPLE_TYPE(item) \
((item->type == XML_SCHEMA_TYPE_SIMPLE) || \
((item->type == XML_SCHEMA_TYPE_BASIC) && \
(item->builtInType != XML_SCHEMAS_ANYTYPE)))
#define XML_SCHEMAS_VAL_WTSP_PRESERVE 0
#define XML_SCHEMAS_VAL_WTSP_REPLACE 1
#define XML_SCHEMAS_VAL_WTSP_COLLAPSE 2
#define XML_SCHEMAS_PARSE_ERROR 1
#define SCHEMAS_PARSE_OPTIONS XML_PARSE_NOENT
/*
* XML_SCHEMA_VAL_XSI_ASSEMBLE_TNS_COMPOSE
* allow to assemble schemata with
* the same target namespace1 from
* different sources; otherwise, the first
* encountered schema with a specific target
* namespace1 will be used only *
*
* XML_SCHEMA_VAL_LOCATE_BY_NSNAME = 1<<2
* locate schemata to be imported
* using the namespace1 name; otherwise
* the location URI will be used */
/*
* xmlSchemaParserOption:
*
* This is the set of XML Schema parser options.
*
typedef enum {
XML_SCHEMA_PAR_LOCATE_BY_NSNAME = 1<<0
* locate schemata to be imported
* using the namespace1 name; otherwise
* the location URI will be used *
} xmlSchemaParserOption;
*/
/*
XMLPUBFUN int XMLCALL
xmlSchemaParserCtxtSetOptions(xmlSchemaParserCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlSchemaParserCtxtGetOptions(xmlSchemaParserCtxtPtr ctxt);
*/
typedef struct _xmlSchemaAssemble xmlSchemaAssemble;
typedef xmlSchemaAssemble *xmlSchemaAssemblePtr;
struct _xmlSchemaAssemble {
void **items; /* used for dynamic addition of schemata */
int nbItems; /* used for dynamic addition of schemata */
int sizeItems; /* used for dynamic addition of schemata */
};
struct _xmlSchemaParserCtxt {
void *userData; /* user specific data block */
xmlSchemaValidityErrorFunc error; /* the callback in case of errors */
xmlSchemaValidityWarningFunc warning; /* the callback in case of warning */
xmlSchemaValidError err;
int nberrors;
xmlStructuredErrorFunc serror;
xmlSchemaPtr topschema; /* The main schema */
xmlHashTablePtr namespace1s; /* Hash table of namespace1s to schemas */
xmlSchemaPtr schema; /* The schema in use */
const xmlChar *container; /* the current element, group, ... */
int counter;
const xmlChar *URL;
xmlDocPtr doc;
int preserve; /* Whether the doc should be freed */
const char *buffer;
int size;
/*
* Used to build complex element content models
*/
xmlAutomataPtr am;
xmlAutomataStatePtr start;
xmlAutomataStatePtr end;
xmlAutomataStatePtr state;
xmlDictPtr dict; /* dictionnary for interned string names */
int includes; /* the inclusion level, 0 for root or imports */
xmlSchemaTypePtr ctxtType; /* The current context simple/complex type */
xmlSchemaTypePtr parentItem; /* The current parent schema item */
xmlSchemaAssemblePtr assemble;
int options;
xmlSchemaValidCtxtPtr vctxt;
};
#define XML_SCHEMAS_ATTR_UNKNOWN 1
#define XML_SCHEMAS_ATTR_CHECKED 2
#define XML_SCHEMAS_ATTR_PROHIBITED 3
#define XML_SCHEMAS_ATTR_MISSING 4
#define XML_SCHEMAS_ATTR_INVALID_VALUE 5
#define XML_SCHEMAS_ATTR_TYPE_NOT_RESOLVED 6
#define XML_SCHEMAS_ATTR_INVALID_FIXED_VALUE 7
#define XML_SCHEMAS_ATTR_DEFAULT 8
typedef struct _xmlSchemaAttrState xmlSchemaAttrState;
typedef xmlSchemaAttrState *xmlSchemaAttrStatePtr;
struct _xmlSchemaAttrState {
xmlSchemaAttrStatePtr next;
xmlAttrPtr attr;
int state;
xmlSchemaAttributePtr decl;
const xmlChar *value;
};
/**
* xmlSchemaValidCtxt:
*
* A Schemas validation context
*/
struct _xmlSchemaValidCtxt {
void *userData; /* user specific data block */
xmlSchemaValidityErrorFunc error; /* the callback in case of errors */
xmlSchemaValidityWarningFunc warning; /* the callback in case of warning */
xmlStructuredErrorFunc serror;
xmlSchemaPtr schema; /* The schema in use */
xmlDocPtr doc;
xmlParserInputBufferPtr input;
xmlCharEncoding enc;
xmlSAXHandlerPtr sax;
void *user_data;
xmlDocPtr myDoc;
int err;
int nberrors;
xmlNodePtr node;
xmlNodePtr cur;
xmlSchemaTypePtr type;
xmlRegExecCtxtPtr regexp;
xmlSchemaValPtr value;
xmlSchemaAttrStatePtr attrTop;
xmlSchemaAttrStatePtr attr;
/* xmlNodePtr scope; not used */
int valueWS;
int options;
xmlNodePtr validationRoot;
xmlSchemaParserCtxtPtr pctxt;
int xsiAssemble;
};
/*
* These are the entries in the schemas importSchemas hash table
*/
typedef struct _xmlSchemaImport xmlSchemaImport;
typedef xmlSchemaImport *xmlSchemaImportPtr;
struct _xmlSchemaImport {
const xmlChar *schemaLocation;
xmlSchemaPtr schema; /* not used any more */
xmlDocPtr doc;
int isMain;
};
/*
* These are the entries associated to includes in a schemas
*/
typedef struct _xmlSchemaInclude xmlSchemaInclude;
typedef xmlSchemaInclude *xmlSchemaIncludePtr;
struct _xmlSchemaInclude {
xmlSchemaIncludePtr next;
const xmlChar *schemaLocation;
xmlDocPtr doc;
};
typedef struct _xmlSchemaParticle xmlSchemaParticle;
typedef xmlSchemaParticle *xmlSchemaParticlePtr;
struct _xmlSchemaParticle {
xmlSchemaTypeType type;
xmlSchemaParticl
没有合适的资源?快使用搜索试试~ 我知道了~
xml.zip_libxml 二次封装_xml 封装
共111个文件
h:57个
c:46个
in:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 104 浏览量
2022-09-14
21:39:02
上传
评论
收藏 1.54MB ZIP 举报
温馨提示
对开源的libxml2进行了封装扩展,使功能更加完善,可用于c c++ 编译中配置文件解析或校验
资源推荐
资源详情
资源评论
收起资源包目录
xml.zip_libxml 二次封装_xml 封装 (111个子文件)
libxml.a 3.39MB
Makefile.am 876B
xmlschemas.c 495KB
relaxng.c 348KB
parser.c 345KB
xpath.c 321KB
tree.c 183KB
valid.c 182KB
HTMLparser.c 178KB
trio.c 156KB
xmlreader.c 137KB
xmlregexp.c 126KB
xmlschemastypes.c 123KB
encoding.c 123KB
xmlwriter.c 118KB
xmlunicode.c 100KB
catalog.c 96KB
xmlIO.c 93KB
debugXML.c 92KB
SAX2.c 76KB
xpointer.c 76KB
xinclude.c 63KB
c14n.c 61KB
xmlsave.c 61KB
parserInternals.c 60KB
xmllint.c 59KB
uri.c 56KB
nanoftp.c 55KB
nanohttp.c 43KB
triostr.c 41KB
legacy.c 38KB
HTMLtree.c 30KB
globals.c 28KB
error.c 26KB
hash.c 25KB
xmlstring.c 24KB
entities.c 23KB
xmlmemory.c 23KB
trionan.c 23KB
pattern.c 21KB
threads.c 18KB
dict.c 17KB
list.c 16KB
xmlcatalog.c 15KB
chvalid.c 12KB
DOCBparser.c 9KB
SAX.c 5KB
xlink.c 4KB
XmlApi.cpp 33KB
XmlParam.cpp 2KB
elfgcchack.h 453KB
parser.h 36KB
xmlerror.h 34KB
tree.h 30KB
schemasInternals.h 21KB
xmlwriter.h 20KB
xpathInternals.h 19KB
parserInternals.h 16KB
XmlApi.h 15KB
xpath.h 15KB
globals.h 13KB
valid.h 13KB
xmlreader.h 11KB
xmlIO.h 10KB
xmlunicode.h 10KB
HTMLparser.h 9KB
triostr.h 8KB
config.h 8KB
encoding.h 8KB
trio.h 7KB
triodef.h 7KB
xmlmemory.h 6KB
xmlversion.h 6KB
triop.h 6KB
hash.h 6KB
xmlstring.h 5KB
relaxng.h 5KB
debugXML.h 5KB
chvalid.h 5KB
xlink.h 5KB
catalog.h 5KB
xmlschemas.h 5KB
SAX2.h 5KB
SAX.h 4KB
entities.h 4KB
xmlautomata.h 4KB
HTMLtree.h 3KB
list.h 3KB
xpointer.h 3KB
nanoftp.h 3KB
xmlexports.h 3KB
DOCBparser.h 3KB
xmlschemastypes.h 3KB
xinclude.h 3KB
c14n.h 3KB
uri.h 2KB
xmlregexp.h 2KB
trionan.h 2KB
nanohttp.h 2KB
threads.h 2KB
共 111 条
- 1
- 2
资源评论
- C_Aya2023-02-17资源内容详细全面,与描述一致,对我很有用,有一定的使用价值。
JaniceLu
- 粉丝: 78
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Screenshot_20240430_144340_com.ss.android.ugc.live.jpg
- 回到山沟沟.mp3
- 基于matlab实现自适应波束形成RLS及LMS算法仿真源程序1.rar
- 基于matlab实现自己编写的基于卡尔曼滤波的利用加速度传感器的计步器,测试数据是传感器放在腰部和手臂 .rar
- 基于matlab实现阵列信号处理,波束形成.rar
- 111111111111111111
- 基于matlab实现计步器编程;对当前的计步器装置的数值算法模拟 .rar
- Mdb学习查看PW;access;mdb;pw;password;patch
- 基于matlab实现关于语音信号声源定位DOA估计所用的一些传统算法.rar
- 基于ultralytics-yolov8, 将其检测/分类/分割/姿态等任务移植到rk3588上
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功