我正在使用node.js express框架开发应用程序,并且需要连接到sybase ASE数据库.我做了足够的搜索,找不到node.js的sybase驱动程序.node.js不支持sybase,还是应该使用通用驱动程序?
命令行 xmllint --schema 验证失败,但 $? 返回 0
我的输入.xml:
<myinput><header>mytestvalue</header></myinput>
Run Code Online (Sandbox Code Playgroud)
myschema.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="myinput" type="xsd:string"/>
</xsd:schema>
Run Code Online (Sandbox Code Playgroud)
命令:
$xmllint --schema myschema.xsd myinput.xml
Run Code Online (Sandbox Code Playgroud)
结果:
Element myinput: child header should not be present
myinput.xml fails to validate
Run Code Online (Sandbox Code Playgroud)
命令:
$echo $?
Run Code Online (Sandbox Code Playgroud)
结果:
0
Run Code Online (Sandbox Code Playgroud)
有人能告诉我为什么 xmllint 模式验证失败不会作为错误返回吗?或者建议我如何在我的 shell 脚本中将其捕获为错误?在我的 shell 脚本中,当前我正在“if”块中验证上述 xmllint 命令,它仅在 xml 格式良好时失败,但在模式验证失败时成功。
如果以上没有作为错误返回,我是否应该在 xmllint 输出上执行“grep 失败”的丑陋方式来确定模式验证是成功还是失败?有什么想法吗?