2
我正忙於使用大量XML的Erlang項目,並試圖學習如何使用erlsom編寫Erlang中的XML。在掙扎了整整兩天之後,我現在把我的頭髮拉出來,現在我讀的越多,我越感到困惑。使用erlsom編寫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>
在Erlang中我做如下:
XsdFile = "/home/renato/projects/rnlib-erl/rnlib-erl/dmcc/xsd/csta-schemas/csta.xsd".
XsdDir = filename:dirname(XsdFile).
erlsom:compile_xsd_file(XsdFile).
獲取錯誤:
{error,"Include file not found my_envelope.xsd"}
我可以(不知何故)接受,所以然後我嘗試:
erlsom:compile_xsd_file(XsdFile, [{include_dirs, XsdDir}]).
賴以二郎返回以下錯誤:
** 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
我在做什麼錯?
這正是我的問題。謝謝。 – CodeWarrior