Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用erlsom编写XML的问题_Xml_Xsd_Erlang - Fatal编程技术网

使用erlsom编写XML的问题

使用erlsom编写XML的问题,xml,xsd,erlang,Xml,Xsd,Erlang,我正忙于一个使用大量XML的Erlang项目,并试图学习如何使用erlsom在Erlang中编写XML。在苦苦挣扎了整整两天之后,我现在开始紧张起来,我读得越多,就越感到困惑 XSD文件(csta.XSD)的摘录,其中包含代码停止工作的部分: <?xml version="1.0" encoding="UTF-8"?> <!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Thomas Miller (Si

我正忙于一个使用大量XML的Erlang项目,并试图学习如何使用erlsom在Erlang中编写XML。在苦苦挣扎了整整两天之后,我现在开始紧张起来,我读得越多,就越感到困惑

XSD文件(csta.XSD)的摘录,其中包含代码停止工作的部分:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Thomas Miller (Siemens Enterprise Networks) -->
<xsd:schema targetNamespace="http://www.ecma-international.org/standards/ecma-323/csta/ed3" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="my_envelope.xsd"/>
  <xsd:annotation>
    <xsd:documentation>csta</xsd:documentation>
  </xsd:annotation>
  <xsd:annotation>
    <xsd:documentation>Capability Exchange Services</xsd:documentation>
  </xsd:annotation>
  <xsd:include schemaLocation="get-csta-features.xsd"/>
  <xsd:include schemaLocation="get-logical-device-information.xsd"/>
  <xsd:include schemaLocation="get-physical-device-information.xsd"/>
  <xsd:include schemaLocation="get-switching-function-capabilities.xsd"/>
  <xsd:include schemaLocation="get-switching-function-devices.xsd"/>
  <xsd:include schemaLocation="switching-function-devices.xsd"/>
  <xsd:annotation>
    <xsd:documentation>System Services</xsd:documentation>
  </xsd:annotation>
获取错误:

{error,"Include file not found my_envelope.xsd"}
** exception throw: {'EXIT',{function_clause,[{filename,join,
                                                        [47,"my_envelope.xsd"],
                                                        [{file,"filename.erl"},{line,409}]},
                                              {filename,join,1,[{file,"filename.erl"},{line,396}]},
                                              {erlsom_lib,findFileInDirs,2,
                                                          [{file,"erlsom_lib.erl"},{line,864}]},
                                              {erlsom_lib,findFile,4,[{file,"erlsom_lib.erl"},{line,828}]},
                                              {erlsom_compile,processImports,2,
                                                              [{file,"erlsom_compile.erl"},{line,306}]},
                                              {erlsom_compile,transform,2,
                                                              [{file,"erlsom_compile.erl"},{line,278}]},
                                              {erlsom_compile,compile_parsed_xsd,10,
                                                              [{file,"erlsom_compile.erl"},{line,250}]},
                                              {erlsom,compile_xsd,2,[{file,"erlsom.erl"},{line,142}]}]}}
     in function  erlsom:compile_xsd/2 (erlsom.erl, line 144)
我可以(以某种方式)接受,因此我尝试:

erlsom:compile_xsd_file(XsdFile, [{include_dirs, XsdDir}]).
Erlang返回以下错误:

{error,"Include file not found my_envelope.xsd"}
** exception throw: {'EXIT',{function_clause,[{filename,join,
                                                        [47,"my_envelope.xsd"],
                                                        [{file,"filename.erl"},{line,409}]},
                                              {filename,join,1,[{file,"filename.erl"},{line,396}]},
                                              {erlsom_lib,findFileInDirs,2,
                                                          [{file,"erlsom_lib.erl"},{line,864}]},
                                              {erlsom_lib,findFile,4,[{file,"erlsom_lib.erl"},{line,828}]},
                                              {erlsom_compile,processImports,2,
                                                              [{file,"erlsom_compile.erl"},{line,306}]},
                                              {erlsom_compile,transform,2,
                                                              [{file,"erlsom_compile.erl"},{line,278}]},
                                              {erlsom_compile,compile_parsed_xsd,10,
                                                              [{file,"erlsom_compile.erl"},{line,250}]},
                                              {erlsom,compile_xsd,2,[{file,"erlsom.erl"},{line,142}]}]}}
     in function  erlsom:compile_xsd/2 (erlsom.erl, line 144)
my_envelope.xsd
csta.xsd


我做错了什么?

include\u dirs
接受一个字符串列表,而不是一个字符串

由于库没有提前检查类型,最终会出现一个神秘的错误,这大致可以解释为
erlsom_lib:findFileInDirs/2
最终调用了
filename:join(47,“my_envelope.xsd”)
(可能是因为
include_dirs
参数的第一个元素是
47
,即
/
的ASCII值)

这将修复您最近的错误:

erlsom:compile_xsd_file(XsdFile, [{include_dirs, [XsdDir]}]).

那正是我的问题。谢谢。