libxml2获取节点的xsd定义
我有一个.xml文件和.xsd 在使用libxml2解析和验证文件之后,如何从模式中获取节点定义(限制、注释…)libxml2获取节点的xsd定义,xsd,libxml2,Xsd,Libxml2,我有一个.xml文件和.xsd 在使用libxml2解析和验证文件之后,如何从模式中获取节点定义(限制、注释…) xmlInitParser(); xmlSchemaPtr schema = NULL; xmlSchemaParserCtxtPtr schema_parser_ctxt = NULL; int has_schema_errors = 0; int ret = -1; xmlSchemaValidCtxtPtr valid_ctxt = NULL; schema_parser_ct
xmlInitParser();
xmlSchemaPtr schema = NULL;
xmlSchemaParserCtxtPtr schema_parser_ctxt = NULL;
int has_schema_errors = 0;
int ret = -1;
xmlSchemaValidCtxtPtr valid_ctxt = NULL;
schema_parser_ctxt = xmlSchemaNewParserCtxt("test.xsd");
xmlTextReaderPtr reader = NULL;
const char* filename = "file.xml";
reader = xmlReaderForFile(filename, NULL, 0);
if (reader != NULL)
{
if (valid_ctxt)
xmlTextReaderSchemaValidateCtxt(reader, valid_ctxt, 0);
ret = xmlTextReaderRead(reader);
while (ret == 1 && !has_schema_errors)
{
ret = xmlTextReaderRead(reader);
xmlNodePtr node;
node = xmlTextReaderCurrentNode(reader);
// here i want get node definition from xsd
}
}
这在libxml2中是不可能的