Tag: xmllint

没有匹配的全局声明可用于validation根目录

背景 使用模式validationXML文档。 问题 问题的最简单forms显示在两个文件中。 XML文档 <?xml version="1.0"?> <recipe xmlns:r="http://www.namespace.org/recipe"> <r:description> <r:title>sugar cookies</r:title> </r:description> </recipe> XSD文档 <?xml version="1.0" encoding="utf-8"?> <xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:r="http://www.namespace.org/recipe"> <xsd:complexType name="recipe"> <xsd:choice> <xsd:element name="description" type="descriptionType" minOccurs="1" maxOccurs="1" /> </xsd:choice> </xsd:complexType> <xsd:complexType name="descriptionType"> <xsd:all> <xsd:element name="title"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:minLength value="5" /> <xsd:maxLength value="55" /> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:all> </xsd:complexType> </xsd:schema> 错误 来自xmllint的完整错误信息: […]

xmllint无法正确查询xpath

我试图查询由adium生成的xml文件。 xmlwf说这是很好的forms。 通过使用xmllint的debugging选项,我得到以下内容: $ xmllint –debug doc.xml DOCUMENT version=1.0 encoding=UTF-8 URL=doc.xml standalone=true ELEMENT chat default namespace href=http://purl.org/net/ulf/ns/0.4-02 ATTRIBUTE account TEXT content=foo@bar.com ATTRIBUTE service TEXT compact content=MSN TEXT compact content= ELEMENT event ATTRIBUTE type 一切似乎parsing就好了。 但是,当我试图查询最简单的东西时,我什么也得不到: $ xmllint –xpath '/chat' doc.xml XPath set is empty 发生了什么? 使用xpath运行完全相同的查询返回正确的结果(但结果之间没有换行符)。 我做错了什么或者是xmllint只是不正常工作? 下面是一个较短的匿名版本的xml,显示了相同的行为: <?xml version="1.0" encoding="UTF-8" ?> <chat xmlns="http://purl.org/net/ulf/ns/0.4-02" account="foo@bar.com" […]