2017-11-25 111 views
0

我在对我的RelaxNG模式验证XML时遇到了问题。我有点新的放松,所以如果错误是显而易见的,请原谅我。使用RelaxNG模式验证XML的问题

荆产生验证时,三种类型的错误:

错误1:“元素‘的文章’这里不允许使用,预计元素‘章’,”

错误2:“元素‘的文章’这里不允许;预计元素结束标签”

错误2‘元素‘一章’这里不允许使用,预计元素结束标签’

的XML文件:

<?xml-model href="publications.rng" type="application/xml" 
schematypens="http://relaxng.org/ns/structure/1.0"?> 
<publications> 
<book> 
    <title>group agency: the possibility, design, and status of corporate 
agents</title> 
    <author>c list</author> 
    <author>p pettit</author> 
    <publisher>oxford university press</publisher> 
    <cited>598</cited> 
    <published>2011</published> 
</book> 

<article> 
    <title>aggregating sets of judgments: an impossibility result</title> 
    <author>c list</author> 
    <author>p pettit</author> 
    <journal>economics and philosophy</journal> 
    <volume>18</volume> 
    <number>(1)</number> 
    <pages>89-110</pages> 
    <cited>558</cited> 
    <published>2002</published> 
</article> 

<article> 
    <title>social choice theory and deliberative democracy: a reconciliation</title> 
    <author>js dryzek</author> 
    <author>c list</author> 
    <journal>british journal of political science</journal> 
    <volume>33</volume> 
    <number>(1)</number> 
    <pages>1-28</pages> 
    <cited>479</cited> 
    <published>2003</published> 
</article> 

<article> 
    <title>epistemic democracy: generalizing the condorcet jury theorem</title> 
    <author>c list</author> 
    <author>re goodin</author> 
    <journal>journal of political philosophy</journal> 
    <volume>9</volume> 
    <number>(3)</number> 
    <pages>277-306</pages> 
    <cited>409</cited> 
    <published>2001</published> 
</article> 

<chapter> 
    <title>judgment aggregation: a survey</title> 
    <author>c list</author> 
    <author>c puppe</author> 
    <collection>handbook of rational and social choice</collection> 
    <cited>240</cited> 
    <published>2009</published> 
</chapter> 

<article> 
    <title>arrow’s theorem in judgment aggregation</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>social choice and welfare</journal> 
    <volume>29</volume> 
    <number>(1)</number> 
    <pages>19-33</pages> 
    <cited>220</cited> 
    <published>2007</published> 
</article> 

<article> 
    <title>aggregating sets of judgments: two impossibility results compared</title> 
    <author>c list</author> 
    <author>p pettit</author> 
    <journal>synthese</journal> 
    <volume>140</volume> 
    <number>(1)</number> 
    <pages>207-235</pages> 
    <cited>203</cited> 
    <published>2004</published> 
</article> 

<article> 
    <title>the discursive dilemma and public reason</title> 
    <author>c list</author> 
    <journal>ethics</journal> 
    <volume>116</volume> 
    <number>(2)</number> 
    <pages>362-402</pages> 
    <cited>154</cited> 
    <published>2006</published> 
</article> 

<article> 
    <title>deliberation, single-peakedness, and the possibility of meaningful democracy: evidence from deliberative polls</title> 
    <author>c list</author> 
    <author>rc luskin</author> 
    <author>js fishkin</author> 
    <author>i mclean</author> 
    <journal>journal of politics</journal> 
    <volume>75</volume> 
    <number>(01)</number> 
    <pages>80-95</pages> 
    <cited>143</cited> 
    <published>2013</published> 
</article> 

<article> 
    <title>judgment aggregation by quota rules: majority voting generalized</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>journal of theoretical politics</journal> 
    <volume>19</volume> 
    <number>(4)</number> 
    <pages>391-424</pages> 
    <cited>130</cited> 
    <published>2007</published> 
</article> 

<article> 
    <title>disaggregating deliberation's effects: an experiment within a deliberative poll</title> 
    <author>c farrar</author> 
    <author>js fishkin</author> 
    <author>dp green</author> 
    <author>c list</author> 
    <author>rc luskin</author> 
    <author>el paluck</author> 
    <journal>british journal of political science</journal> 
    <volume>40</volume> 
    <number>(2)</number> 
    <pages>333-47</pages> 
    <cited>129</cited> 
    <published>2010</published> 
</article> 

<article> 
    <title>the theory of judgment aggregation: an introductory review</title> 
    <author>c list</author> 
    <journal>synthese</journal> 
    <volume>187</volume> 
    <number>(1)</number> 
    <pages>179-207</pages> 
    <cited>124</cited> 
    <published>2012</published> 
</article> 

<article> 
    <title>a model of path-dependence in decisions over multiple propositions</title> 
    <author>c list</author> 
    <journal>american political science review</journal> 
    <volume>98</volume> 
    <pages>495-514</pages> 
    <cited>124</cited> 
    <published>2004</published> 
</article> 

<article> 
    <title>strategy-proof judgment aggregation</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>economics and philosophy</journal> 
    <volume>23</volume> 
    <number>(3)</number> 
    <pages>269</pages> 
    <cited>123</cited> 
    <published>2007</published> 
</article> 

<article> 
    <title>non-reductive physicalism and the limits of the exclusion principle</title> 
    <author>c list</author> 
    <author>p menzies</author> 
    <journal>journal of philosophy</journal> 
    <volume>106</volume> 
    <number>(9)</number> 
    <pages>475-502</pages> 
    <cited>106</cited> 
    <published>2009</published> 
</article> 

<article> 
    <title>democracy in animal groups: a political science perspective</title> 
    <author>c list</author> 
    <journal>trends in ecology and evolution</journal> 
    <volume>19</volume> 
    <number>(4)</number> 
    <pages>168-169</pages> 
    <cited>98</cited> 
    <published>2004</published> 
</article> 

<article> 
    <title>a reason‐based theory of rational choice</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>nous</journal> 
    <volume>47</volume> 
    <number>(1)</number> 
    <pages>104-134</pages> 
    <cited>95</cited> 
    <published>2013</published> 
</article> 

<article> 
    <title>judgment aggregation without full rationality</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>social choice and welfare</journal> 
    <volume>31</volume> 
    <number>(1)</number> 
    <pages>15-39</pages> 
    <cited>95</cited> 
    <published>2008</published> 
</article> 

<article> 
    <title>group agency and supervenience</title> 
    <author>c list</author> 
    <author>p pettit</author> 
    <journal>the southern journal of philosophy</journal> 
    <volume>44</volume> 
    <number>(s1)</number> 
    <pages>85-105</pages> 
    <cited>87</cited> 
    <published>2006</published> 
</article> 

<article> 
    <title>the probability of inconsistencies in complex collective decisions</title> 
    <author>c list</author> 
    <journal>social choice and welfare</journal> 
    <volume>24</volume> 
    <number>(1)</number> 
    <pages>3-32</pages> 
    <cited>82</cited> 
    <published>2005</published> 
</article> 

<article> 
    <title>group knowledge and group rationality: a judgment aggregation perspective</title> 
    <author>c list</author> 
    <journal>episteme</journal> 
    <volume>2</volume> 
    <number>(1)</number> 
    <pages>25-38</pages> 
    <cited>79</cited> 
    <published>2005</published> 
</article> 

<article> 
    <title>a model of jury decisions where all jurors have the same evidence</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>synthese</journal> 
    <volume>142</volume> 
    <number>(2)</number> 
    <pages>175-202</pages> 
    <cited>77</cited> 
    <published>2004</published> 
</article> 

<article> 
    <title>corrigendum to "a possibility theorem on aggregation over multiple interconnected propositions" [mathematical social sciences 45 (2003), 1-13]</title> 
    <author>c list</author> 
    <journal>mathematical social sciences</journal> 
    <volume>52</volume> 
    <number>(1)</number> 
    <pages>109-110</pages> 
    <cited>73</cited> 
    <published>2006</published> 
</article> 

<article> 
    <title>a possibility theorem on aggregation over multiple interconnected propositions</title> 
    <author>c list</author> 
    <journal>mathematical social sciences</journal> 
    <volume>45</volume> 
    <number>(1)</number> 
    <pages>1-13</pages> 
    <cited>73</cited> 
    <published>2003</published> 
</article> 

<article> 
    <title>two concepts of agreement</title> 
    <author>c list</author> 
    <journal>the good society</journal> 
    <volume>11</volume> 
    <number>(1)</number> 
    <pages>72-79</pages> 
    <cited>73</cited> 
    <published>2002</published> 
</article> 

<article> 
    <title>methodological individualism and holism in political science: a reconciliation</title> 
    <author>c list</author> 
    <author>k spiekermann</author> 
    <journal>american political science review</journal> 
    <volume>107</volume> 
    <number>(4)</number> 
    <pages>629-643</pages> 
    <cited>71</cited> 
    <published>2013</published> 
</article> 

<article> 
    <title>introduction to judgment aggregation</title> 
    <author>c list</author> 
    <author>b polak</author> 
    <journal>journal of economic theory</journal> 
    <volume>145</volume> 
    <number>(2)</number> 
    <pages>441-466</pages> 
    <cited>71</cited> 
    <published>2010</published> 
</article> 

<article> 
    <title>on the many as one: a reply to kornhauser and sager</title> 
    <author>c list</author> 
    <author>p pettit</author> 
    <journal>philosophy and public affairs</journal> 
    <volume>33</volume> 
    <number>(4)</number> 
    <pages>377-390</pages> 
    <cited>62</cited> 
    <published>2005</published> 
</article> 

<article> 
    <title>where do preferences come from?</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>international journal of game theory</journal> 
    <volume>42</volume> 
    <number>(3)</number> 
    <pages>613-637</pages> 
    <cited>61</cited> 
    <published>2013</published> 
</article> 

<article> 
    <title>can there be a global demos? an agency‐based approach</title> 
    <author>c list</author> 
    <author>m koenig-archibugi</author> 
    <journal>philosophy and public affairs</journal> 
    <volume>38</volume> 
    <number>(1)</number> 
    <pages>76-110</pages> 
    <cited>57</cited> 
    <published>2010</published> 
</article> 

<article> 
    <title>majority voting on restricted domains</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>journal of economic theory</journal> 
    <volume>145</volume> 
    <number>(2)</number> 
    <pages>512-543</pages> 
    <cited>56</cited> 
    <published>2010</published> 
</article> 

<article> 
    <title>a conditional defense of plurality rule: generalizing may's theorem in a restricted informational environment</title> 
    <author>re goodin</author> 
    <author>c list</author> 
    <journal>american journal of political science</journal> 
    <volume>50</volume> 
    <number>(4)</number> 
    <pages>940-949</pages> 
    <cited>54</cited> 
    <published>2006</published> 
</article> 

<article> 
    <title>in defence of voting power analysis: responses to albert</title> 
    <author>ds felsenthal</author> 
    <author>d leech</author> 
    <author>c list</author> 
    <author>m machover</author> 
    <journal>european union politics</journal> 
    <volume>4</volume> 
    <number>(4)</number> 
    <pages>473-497</pages> 
    <cited>46</cited> 
    <published>2003</published> 
</article> 

<article> 
    <title>free will, determinism, and the possibility of doing otherwise</title> 
    <author>c list</author> 
    <journal>noûs</journal> 
    <volume>48</volume> 
    <number>(1)</number> 
    <pages>156-178</pages> 
    <cited>43</cited> 
    <published>2014</published> 
</article> 

<article> 
    <title>a liberal paradox for judgment aggregation</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>social choice and welfare</journal> 
    <volume>31</volume> 
    <number>(1)</number> 
    <pages>59-78</pages> 
    <cited>42</cited> 
    <published>2008</published> 
</article> 

<chapter> 
    <title>social choice theory</title> 
    <author>c list</author> 
    <collection>stanford encyclopedia of philosophy</collection> 
    <cited>40</cited> 
    <published>2013</published> 
</chapter> 

<article> 
    <title>group communication and the transformation of judgments: an impossibility result</title> 
    <author>c list</author> 
    <journal>journal of political philosophy</journal> 
    <volume>19</volume> 
    <number>(1)</number> 
    <pages>1-27</pages> 
    <cited>39</cited> 
    <published>2011</published> 
</article> 

<chapter> 
    <title>the causal autonomy of the special sciences</title> 
    <author>p menzies</author> 
    <author>c list</author> 
    <collection>emergence in mind</collection> 
    <editors> 
     edited by: c. mcdonald and g. mcdonald</editors> 
    <cited>39</cited> 
    <published>2010</published> 
</chapter> 

<article> 
    <title>republican freedom and the rule of law</title> 
    <author>c list</author> 
    <journal>politics, philosophy and economics</journal> 
    <volume>5</volume> 
    <number>(2)</number> 
    <pages>201-220</pages> 
    <cited>39</cited> 
    <published>2006</published> 
</article> 

<article> 
    <title>on the significance of the absolute margin</title> 
    <author>c list</author> 
    <journal>the british journal for the philosophy of science</journal> 
    <volume>55</volume> 
    <number>(3)</number> 
    <pages>521-544</pages> 
    <cited>33</cited> 
    <published>2004</published> 
</article> 

<article> 
    <title>propositionwise judgment aggregation: the general case</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>social choice and welfare</journal> 
    <volume>40</volume> 
    <number>(4)</number> 
    <pages>1067-1095</pages> 
    <cited>32</cited> 
    <published>2013</published> 
</article> 

<book> 
    <title>deliberation and decision: economics, constitutional theory and deliberative democracy</title> 
    <author>a van aaken</author> 
    <author>c list</author> 
    <author>c luetge</author> 
    <publisher>ashgate pub ltd</publisher> 
    <cited>31</cited> 
    <published>2004</published> 
</book> 

<article> 
    <title>are interpersonal comparisons of utility indeterminate?</title> 
    <author>c list</author> 
    <journal>erkenntnis</journal> 
    <volume>58</volume> 
    <number>(2)</number> 
    <pages>229-260</pages> 
    <cited>30</cited> 
    <published>2003</published> 
</article> 

<chapter> 
    <title>mentalism versus behaviourism in economics: a philosophy-of-science perspective</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <collection>economics and philosophy</collection> 
    <cited>27</cited> 
    <published>2016</published> 
</chapter> 

<article> 
    <title>a simple proof of sen's possibility theorem on majority decisions</title> 
    <author>c elsholtz</author> 
    <author>c list</author> 
    <journal>elemente der mathematik</journal> 
    <volume>60</volume> 
    <number>(2)</number> 
    <pages>45-56</pages> 
    <cited>19</cited> 
    <published>2005</published> 
</article> 

<article> 
    <title>aggregating causal judgements</title> 
    <author>r bradley</author> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>philosophy of science</journal> 
    <volume>81</volume> 
    <number>(4)</number> 
    <pages>491-515</pages> 
    <cited>17</cited> 
    <published>2014</published> 
</article> 

<article> 
    <title>emergent chance</title> 
    <author>c list</author> 
    <author>m pivato</author> 
    <journal>the philosophical review</journal> 
    <volume>124</volume> 
    <number>(1)</number> 
    <pages>119-152</pages> 
    <cited>15</cited> 
    <published>2015</published> 
</article> 

<article> 
    <title>the impossibility of unbiased judgment aggregation</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>theory and decision</journal> 
    <volume>68</volume> 
    <number>(3)</number> 
    <pages>281-299</pages> 
    <cited>15</cited> 
    <published>2010</published> 
</article> 

<article> 
    <title>reason-based choice and context-dependence: an explanatory framework</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>economics and philosophy</journal> 
    <volume>32</volume> 
    <number>(2)</number> 
    <pages>175-229</pages> 
    <cited>14</cited> 
    <published>2016</published> 
</article> 

<chapter> 
    <title>collective wisdom: lessons from the theory of judgment aggregation</title> 
    <author>c list</author> 
    <collection>ccollective wisdom: principles and mechanisms</collection> 
    <cited>14</cited> 
    <published>2012</published> 
</chapter> 

<article> 
    <title>multidimensional welfare aggregation</title> 
    <author>c list</author> 
    <journal>public choice</journal> 
    <volume>119</volume> 
    <number>(1-2)</number> 
    <pages>119-142</pages> 
    <cited>14</cited> 
    <published>2004</published> 
</article> 

<article> 
    <title>craig's theorem and the empirical underdetermination thesis reassessed</title> 
    <author>c list</author> 
    <journal>disputatio</journal> 
    <volume>7</volume> 
    <pages>28-39</pages> 
    <cited>14</cited> 
    <published>1999</published> 
</article> 

<chapter> 
    <title>when to defer to supermajority testimony—and when not</title> 
    <author>c list</author> 
    <collection>essays in collective epistemology</collection> 
    <cited>13</cited> 
    <published>2014</published> 
</chapter> 

<article> 
    <title>"deliberative polling" als methode zum erlernen des demokratischen sprechens</title> 
    <author>c list</author> 
    <author>a sliwka</author> 
    <journal>zeitschrift für politik</journal> 
    <volume>51</volume> 
    <number>(1)</number> 
    <pages>87-105</pages> 
    <cited>10</cited> 
    <published>2004</published> 
    <language>german</language> 
</article> 

<chapter> 
    <title>the methodology of political theory</title> 
    <author>c list</author> 
    <author> 
     valentini</author> 
    <collection>the oxford handbook of philosophical methodology</collection> 
    <cited>8</cited> 
    <published>2016</published> 
</chapter> 

<article> 
    <title>introduction to the special issue of economics and philosophy on neuroeconomics</title> 
    <author>g bonanno</author> 
    <author>c list</author> 
    <author>b tungodden</author> 
    <author>p vallentyne</author> 
    <journal>economics and philosophy</journal> 
    <volume>24</volume> 
    <number>(3)</number> 
    <pages>301-302</pages> 
    <cited>8</cited> 
    <published>2008</published> 
</article> 

<article> 
    <title>social choice theory and deliberative democracy: a response to aldred</title> 
    <author>js dryzek</author> 
    <author>c list</author> 
    <journal>british journal of political science</journal> 
    <volume>34</volume> 
    <number>(4)</number> 
    <pages>752-758</pages> 
    <cited>8</cited> 
    <published>2004</published> 
</article> 

<article> 
    <title>a note on introducing a “zero‐line” of welfare as an escape route from arrow’s theorem</title> 
    <author>c list</author> 
    <journal>pacific economic review</journal> 
    <volume>6</volume> 
    <number>(2)</number> 
    <pages>223-238</pages> 
    <cited>7</cited> 
    <published>2001</published> 
</article> 

<article> 
    <title>episteme symposium on group agency: replies to gaus, cariani, sylvan, and briggs</title> 
    <author>c list</author> 
    <author>p pettit</author> 
    <journal>episteme</journal> 
    <volume>9</volume> 
    <number>(3)</number> 
    <pages>293</pages> 
    <cited>5</cited> 
    <published>2012</published> 
</article> 

<article> 
    <title>probabilistic opinion pooling generalized: part two: the premise-based approach</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>social choice and welfare</journal> 
    <volume>48</volume> 
    <number>(4)</number> 
    <pages>787–814</pages> 
    <cited>4</cited> 
    <published>2017</published> 
</article> 

<article> 
    <title>two intuitions about free will: alternative possibilities and intentional endorsement</title> 
    <author>c list</author> 
    <author>w rabinowicz</author> 
    <journal>philosophical perspectives</journal> 
    <volume>28</volume> 
    <number>(1)</number> 
    <pages>155-172</pages> 
    <cited>4</cited> 
    <published>2014</published> 
</article> 

<article> 
    <title>independence and interdependence: lessons from the hive</title> 
    <author>c list</author> 
    <author>a vermeule</author> 
    <journal>rationality and society</journal> 
    <volume>26</volume> 
    <number>(2)</number> 
    <pages>170-207</pages> 
    <cited>4</cited> 
    <published>2014</published> 
</article> 

<article> 
    <title>reasons for (prior) belief in bayesian epistemology</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>synthese</journal> 
    <volume>190</volume> 
    <number>(5)</number> 
    <pages>787-808</pages> 
    <cited>4</cited> 
    <published>2013</published> 
</article> 

<article> 
    <title>freedom as independence</title> 
    <author>c list</author> 
    <author>l valentini</author> 
    <journal>ethics</journal> 
    <volume>126</volume> 
    <number>(4)</number> 
    <pages>1043-1074</pages> 
    <cited>3</cited> 
    <published>2016</published> 
</article> 

<article> 
    <title>belief revision generalized: a joint characterization of bayes' and jeffrey's rules</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <author>r bradley</author> 
    <journal>journal of economic theory</journal> 
    <volume>162</volume> 
    <pages>352–371</pages> 
    <cited>3</cited> 
    <published>2016</published> 
</article> 

<chapter> 
    <title>my brain made me do it: the exclusion argument against free will, and what’s wrong with it</title> 
    <author>c list</author> 
    <author>p menzies</author> 
    <collection>making a difference</collection> 
    <editors> 
     edited by: h. beebee, c. hitchcock, and h. price</editors> 
    <cited>3</cited> 
    <published>2016</published> 
</chapter> 

<article> 

    <title>what matters and how it matters: a choice-theoretic representation of moral theories</title> 
    <author>f dietrich</author> 
    <author>c list</author> 
    <journal>philosophical review</journal> 
    <volume>0</volume> 
    <pages>0</pages> 
    <cited>2</cited> 
    <published>2017</published> 
</article> 

<chapter> 
    <title>the condorcet jury theorem and voter-specific truth</title> 
    <author>c list</author> 
    <author>k spiekermann</author> 
    <collection>goldman and his critics</collection> 
    <cited>2</cited> 
    <published>2016</published> 
</chapter> 

<article> 
    <title>introduction to the special issue of economics and philosophy on ambiguity aversion</title> 
    <author>g bonanno</author> 
    <author>m van hees</author> 
    <author>c list</author> 
    <author>b tungodden</author> 
    <journal>economics and philosophy</journal> 
    <volume>25</volume> 
    <number>(3)</number> 
    <pages>247-248</pages> 
    <cited>2</cited> 
    <published>2009</published> 
</article> 

</publications> 

的Relaxng架构的XML

<?xml version="1.0" encoding="UTF-8"?> 
<grammar 
xmlns="http://relaxng.org/ns/structure/1.0" 
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" 
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> 
<start> 
     <element name="publications"> 

        <element name="book"> 
         <element name="title"><text/></element>                         
           <oneOrMore> 
            <element name="author"><text/></element>       
           </oneOrMore>          
         <element name="publisher"><text/></element>       
         <element name="cited"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="int"/></element> 
         <element name="published"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="gYear"/></element> 
         <zeroOrMore> 
          <element name="language"><text/></element> 
         </zeroOrMore>       
        </element> 

        <element name="article"> 
         <element name="title"><text/></element>      
           <oneOrMore> 
            <element name="author"><text/></element>       
           </oneOrMore>         
         <element name="journal"><text/></element>  
         <element name="volume"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="int"/></element> 
         <optional> 
         <element name="number"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="string"></data></element> 
         </optional> 
         <element name="pages"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="string"/></element> 
         <element name="cited"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="int"/></element> 
         <element name="published"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="int"/></element> 
         <zeroOrMore> 
          <element name="language"><text/></element> 
         </zeroOrMore> 
        </element> 

      <element name="chapter"> 

       <element name="title"><text/></element> 
       <oneOrMore>  
        <element name="author"><text/></element>    
       </oneOrMore> 
       <element name="collection"><text/></element> 
       <zeroOrMore> 
        <element name="editors"><text/></element> 
       </zeroOrMore> 
       <element name="cited"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="int"/></element> 
       <element name="published"><data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="int"/></element> 
       <zeroOrMore> 
        <element name="language"><text/></element> 
       </zeroOrMore>        
      </element>      
     </element>   
</start> 

+1

请将所有相关文件*在这里*。没有代码片断的外部链接,这些代码片断并不是问题的一部分,因为如果外部链接不成问题而且答案对未来的读者来说变得毫无用处。 – Tomalak

+0

脚垫,正如Tomalak指出的那样,请添加一个代码snipper与您尝试使用的模式。包含版本和功能示例以重现错误。 –

+0

对不起。我添加了一些XML,但该文件对于整个片段来说太大了。希望这可以帮助。 –

回答

1

好像你的XML不匹配,因为架构:

  1. 元素的顺序定义为 “书”, “文章”,“章节” - 你有无序的元素。

  2. 我对RelaxNG-schema并不熟悉,但在传统的XSD模式中,必须定义元素出现次数(默认最小= 1最大= 1)。看起来你的模式只允许一本书,然后是一篇文章,然后是一章。

所以,

错误1: “元素 ”的文章“ 这里不允许使用,预计元素 ”章“,”

出现,因为没有第二<article>第一,但<chapter>预期后。

Error 2: "element "article" not allowed here; expected the element end-tag" 
Error 2 "element "chapter" not allowed here; expected the element end-tag" 

出现,因为有第一本书和第一篇文章后,许多文章,章节和书籍...

建议:

  1. 使用无序的元素 - 使用XML选择书籍,文章,章节
  2. 将该选项的出现定义为“许多”

我知道如何在XSD中做到这点,但对于RelaxNG来说,这取决于您...

+0

现在就工作吧!不得不围绕每本书,文章和章节对 -tag进行重构。然后,我为一个或更多的出版物设置约束条件,并在每本书,文章和章节之间进行选择。非常感谢! –