xmllint

No matching global declaration available for the validation root

不羁岁月 提交于 2019-11-30 01:44:12
Background Validate an XML document using a schema. Problem The simplest form of the problem is shown in two files. XML Document <?xml version="1.0"?> <recipe xmlns:r="http://www.namespace.org/recipe"> <r:description> <r:title>sugar cookies</r:title> </r:description> </recipe> XSD Document <?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

Linux Bash XMLLINT with XPATH

一笑奈何 提交于 2019-11-29 17:10:35
问题 Today I get to learn how to use xmllint properly. It does not seem to be well covered or explained. I plan to use a single language resource file to run my entire system. I have a mixture of bash scripts and php pages that must read from this language file. Currently I am using the following format in my xml file en.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <item id="index.php"> <label>LABEL</label> <value>VALUE</value> <description>DESCRIPTION</description> </item> <item id=

xmllint validation error “no DTD found” while using XSD

五迷三道 提交于 2019-11-29 03:32:36
I'm trying to use xmllint to check my work while developing a basic XSD i.e. XML Schema schema. However it's giving me an error Validation failed: no DTD found. What am I doing wrong? My xmllint command: xmllint --noout --valid --schema simple.xsd lucas-basic.xml lucas-basic.xml:5: validity error : Validation failed: no DTD found ! > ^ lucas-basic.xml validates Test XSD file: <?xml version = "1.0" encoding = "UTF-8"?> <!--Generated by XML Authority. Conforms to w3c http://www.w3.org/2001/XMLSchema--> <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"> <xsd:element name = "vehicles">

xmllint unknown option '--xpath'

↘锁芯ラ 提交于 2019-11-28 10:45:39
I've seen this syntax several places (eg, here ): xmllint --xpath '/plist/array/string/text()' tmp.xml , used to query a particular XML node using an xpath selector. However, I'm getting the error Unknown option --xpath when I try to execute this on my machine (mac os x snow leopard). Looking more closely at the man page for xmllint, I don't see the --xpath option documented... Am I just totally missing something here? xmllint --shell tmp.xml <<<'xpath /plist/array/string/text()' If you need to make xmllint to read stdin: cat /tmp/tmp.xml | xmllint --shell <(cat) <<<'xpath /plist/array/string

xmllint validation error “no DTD found” while using XSD

天涯浪子 提交于 2019-11-27 21:40:24
问题 I'm trying to use xmllint to check my work while developing a basic XSD i.e. XML Schema schema. However it's giving me an error Validation failed: no DTD found. What am I doing wrong? My xmllint command: xmllint --noout --valid --schema simple.xsd lucas-basic.xml lucas-basic.xml:5: validity error : Validation failed: no DTD found ! > ^ lucas-basic.xml validates Test XSD file: <?xml version = "1.0" encoding = "UTF-8"?> <!--Generated by XML Authority. Conforms to w3c http://www.w3.org/2001

xmllint unknown option '--xpath'

ⅰ亾dé卋堺 提交于 2019-11-27 03:46:19
问题 I've seen this syntax several places (eg, here): xmllint --xpath '/plist/array/string/text()' tmp.xml , used to query a particular XML node using an xpath selector. However, I'm getting the error Unknown option --xpath when I try to execute this on my machine (mac os x snow leopard). Looking more closely at the man page for xmllint, I don't see the --xpath option documented... Am I just totally missing something here? 回答1: xmllint --shell tmp.xml <<<'xpath /plist/array/string/text()' If you

xmllint failing to properly query with xpath

点点圈 提交于 2019-11-26 11:51:46
I'm trying to query an xml file generated by adium. xmlwf says that it's well formed. By using xmllint's debug option i get the following: $ 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 Everything seems to parse just fine. However, when I try to query even the simplest things, I don't get anything: $ xmllint --xpath '/chat' doc.xml XPath set is

xmllint failing to properly query with xpath

妖精的绣舞 提交于 2019-11-26 02:37:28
问题 I\'m trying to query an xml file generated by adium. xmlwf says that it\'s well formed. By using xmllint\'s debug option i get the following: $ 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 Everything seems to parse just fine. However, when I try