我写了xml文件,一切正常,直到我添加了从某个站点生成的dtd代码。现在我有错误。请帮我 此页面包含以下错误:
第2行第3行的错误:StartTag:元素名称无效 下面是第一个错误的页面呈现
javascript@1.0.0 /home/ken/exercism/javascript
└─┬ jasmine-es6@0.4.3
├─┬ babel-runtime@6.26.0
│ ├── core-js@2.5.1
│ └── regenerator-runtime@0.11.0
├─┬ dist-es6@0.2.5
│ ├── babel@6.23.0
│ ├─┬ babel-cli@6.26.0
│ │ ├─┬ babel-polyfill@6.26.0
│ │ │ └── regenerator-runtime@0.10.5
│ │ ├─┬ chokidar@1.7.0
│ │ │ ├─┬ anymatch@1.3.2
│ │ │ │ ├─┬ micromatch@2.3.11
│ │ │ │ │ ├─┬ arr-diff@2.0.0
│ │ │ │ │ │ └── arr-flatten@1.1.0
│ │ │ │ │ ├── array-unique@0.2.1
│ │ │ │ │ ├─┬ braces@1.8.5
│ │ │ │ │ │ ├─┬ expand-range@1.8.2
│ │ │ │ │ │ │ └─┬ fill-range@2.2.3
│ │ │ │ │ │ │ ├── is-number@2.1.0
│ │ │ │ │ │ │ ├── isobject@2.1.0
│ │ │ │ │ │ │ ├─┬ randomatic@1.1.7
│ │ │ │ │ │ │ │ ├─┬ is-number@3.0.0
│ │ │ │ │ │ │ │ │ └── kind-of@3.2.2
│ │ │ │ │ │ │ │ └── kind-of@4.0.0
│ │ │ │ │ │ │ └── repeat-string@1.6.1
│ │ │ │ │ │ ├── preserve@0.2.0
│ │ │ │ │ │ └── repeat-element@1.1.2
│ │ │ │ │ ├─┬ expand-brackets@0.1.5
│ │ │ │ │ │ └── is-posix-bracket@0.1.1
│ │ │ │ │ ├── extglob@0.3.2
│ │ │ │ │ ├── filename-regex@2.0.1
│ │ │ │ │ ├─┬ kind-of@3.2.2
│ │ │ │ │ │ └── is-buffer@1.1.6
│ │ │ │ │ ├─┬ object.omit@2.0.1
│ │ │ │ │ │ ├─┬ for-own@0.1.5
│ │ │ │ │ │ │ └── for-in@1.0.2
│ │ │ │ │ │ └── is-extendable@0.1.1
│ │ │ │ │ ├─┬ parse-glob@3.0.4
│ │ │ │ │ │ ├── glob-base@0.3.0
│ │ │ │ │ │ └── is-dotfile@1.0.3
│ │ │ │ │ └─┬ regex-cache@0.4.4
│ │ │ │ │ └─┬ is-equal-shallow@0.1.3
│ │ │ │ │ └── is-primitive@2.0.0
│ │ │ │ └─┬ normalize-path@2.1.1
│ │ │ │ └── remove-trailing-separator@1.1.0
│ │ │ ├── async-each@1.0.1
│ │ │ ├── UNMET OPTIONAL DEPENDENCY fsevents@^1.0.0
│ │ │ ├── glob-parent@2.0.0
│ │ │ ├─┬ is-binary-path@1.0.1
│ │ │ │ └── binary-extensions@1.10.0
│ │ │ ├─┬ is-glob@2.0.1
│ │ │ │ └── is-extglob@1.0.0
│ │ │ └─┬ readdirp@2.1.0
│ │ │ ├─┬ readable-stream@2.3.3
│ │ │ │ ├── core-util-is@1.0.2
│ │ │ │ ├── isarray@1.0.0
│ │ │ │ ├── process-nextick-args@1.0.7
│ │ │ │ ├── safe-buffer@5.1.1
│ │ │ │ ├── string_decoder@1.0.3
│ │ │ │ └── util-deprecate@1.0.2
│ │ │ └── set-immediate-shim@1.0.1
│ │ ├── commander@2.11.0
│ │ ├── fs-readdir-recursive@1.0.0
│ │ ├─┬ output-file-sync@1.1.2
│ │ │ ├── graceful-fs@4.1.11
│ │ │ └── object-assign@4.1.1
│ │ └─┬ v8flags@2.1.1
│ │ └── user-home@1.1.1
│ ├─┬ babel-core@6.26.0
│ │ ├─┬ babel-code-frame@6.26.0
│ │ │ ├─┬ chalk@1.1.3
│ │ │ │ ├── ansi-styles@2.2.1
│ │ │ │ ├── escape-string-regexp@1.0.5
│ │ │ │ ├─┬ has-ansi@2.0.0
│ │ │ │ │ └── ansi-regex@2.1.1
│ │ │ │ ├── strip-ansi@3.0.1
│ │ │ │ └── supports-color@2.0.0
│ │ │ ├── esutils@2.0.2
│ │ │ └── js-tokens@3.0.2
│ │ ├─┬ babel-generator@6.26.0
│ │ │ ├─┬ detect-indent@4.0.0
│ │ │ │ └─┬ repeating@2.0.1
│ │ │ │ └─┬ is-finite@1.0.2
│ │ │ │ └── number-is-nan@1.0.1
│ │ │ ├── jsesc@1.3.0
│ │ │ └── trim-right@1.0.1
│ │ ├── babel-helpers@6.24.1
│ │ ├── babel-messages@6.23.0
│ │ ├─┬ babel-register@6.26.0
│ │ │ ├─┬ home-or-tmp@2.0.0
│ │ │ │ ├── os-homedir@1.0.2
│ │ │ │ └── os-tmpdir@1.0.2
│ │ │ ├─┬ mkdirp@0.5.1
│ │ │ │ └── minimist@0.0.8
│ │ │ └── source-map-support@0.4.18
│ │ ├── babel-template@6.26.0
│ │ ├─┬ babel-traverse@6.26.0
│ │ │ ├── globals@9.18.0
│ │ │ └─┬ invariant@2.2.2
│ │ │ └── loose-envify@1.3.1
│ │ ├─┬ babel-types@6.26.0
│ │ │ └── to-fast-properties@1.0.3
│ │ ├── babylon@6.18.0
│ │ ├── convert-source-map@1.5.0
│ │ ├─┬ debug@2.6.9
│ │ │ └── ms@2.0.0
│ │ ├── json5@0.5.1
│ │ ├── lodash@4.17.4
│ │ ├─┬ minimatch@3.0.4
│ │ │ └─┬ brace-expansion@1.1.8
│ │ │ ├── balanced-match@1.0.0
│ │ │ └── concat-map@0.0.1
│ │ ├── path-is-absolute@1.0.1
│ │ ├── private@0.1.8
│ │ ├── slash@1.0.0
│ │ └── source-map@0.5.7
│ ├─┬ babel-plugin-transform-decorators-legacy@1.3.4
│ │ └── babel-plugin-syntax-decorators@6.13.0
│ ├── babel-plugin-transform-runtime@6.23.0
│ ├─┬ babel-preset-latest@6.24.1
│ │ ├─┬ babel-preset-es2015@6.24.1
│ │ │ ├── babel-plugin-check-es2015-constants@6.22.0
│ │ │ ├── babel-plugin-transform-es2015-arrow-functions@6.22.0
│ │ │ ├── babel-plugin-transform-es2015-block-scoped-functions@6.22.0
│ │ │ ├── babel-plugin-transform-es2015-block-scoping@6.26.0
│ │ │ ├─┬ babel-plugin-transform-es2015-classes@6.24.1
│ │ │ │ ├── babel-helper-define-map@6.26.0
│ │ │ │ ├── babel-helper-function-name@6.24.1
│ │ │ │ ├── babel-helper-optimise-call-expression@6.24.1
│ │ │ │ └── babel-helper-replace-supers@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-computed-properties@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-destructuring@6.23.0
│ │ │ ├── babel-plugin-transform-es2015-duplicate-keys@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-for-of@6.23.0
│ │ │ ├── babel-plugin-transform-es2015-function-name@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-literals@6.22.0
│ │ │ ├── babel-plugin-transform-es2015-modules-amd@6.24.1
│ │ │ ├─┬ babel-plugin-transform-es2015-modules-commonjs@6.26.0
│ │ │ │ └── babel-plugin-transform-strict-mode@6.24.1
│ │ │ ├─┬ babel-plugin-transform-es2015-modules-systemjs@6.24.1
│ │ │ │ └── babel-helper-hoist-variables@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-modules-umd@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-object-super@6.24.1
│ │ │ ├─┬ babel-plugin-transform-es2015-parameters@6.24.1
│ │ │ │ ├── babel-helper-call-delegate@6.24.1
│ │ │ │ └── babel-helper-get-function-arity@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-shorthand-properties@6.24.1
│ │ │ ├── babel-plugin-transform-es2015-spread@6.22.0
│ │ │ ├─┬ babel-plugin-transform-es2015-sticky-regex@6.24.1
│ │ │ │ └── babel-helper-regex@6.26.0
│ │ │ ├── babel-plugin-transform-es2015-template-literals@6.22.0
│ │ │ ├── babel-plugin-transform-es2015-typeof-symbol@6.23.0
│ │ │ ├─┬ babel-plugin-transform-es2015-unicode-regex@6.24.1
│ │ │ │ └─┬ regexpu-core@2.0.0
│ │ │ │ ├── regenerate@1.3.3
│ │ │ │ ├── regjsgen@0.2.0
│ │ │ │ └─┬ regjsparser@0.1.5
│ │ │ │ └── jsesc@0.5.0
│ │ │ └─┬ babel-plugin-transform-regenerator@6.26.0
│ │ │ └── regenerator-transform@0.10.1
│ │ ├─┬ babel-preset-es2016@6.24.1
│ │ │ └─┬ babel-plugin-transform-exponentiation-operator@6.24.1
│ │ │ ├─┬ babel-helper-builder-binary-assignment-operator-visitor@6.24.1
│ │ │ │ └── babel-helper-explode-assignable-expression@6.24.1
│ │ │ └── babel-plugin-syntax-exponentiation-operator@6.13.0
│ │ └─┬ babel-preset-es2017@6.24.1
│ │ ├── babel-plugin-syntax-trailing-function-commas@6.22.0
│ │ └─┬ babel-plugin-transform-async-to-generator@6.24.1
│ │ ├── babel-helper-remap-async-to-generator@6.24.1
│ │ └── babel-plugin-syntax-async-functions@6.13.0
│ ├─┬ babel-preset-stage-0@6.24.1
│ │ ├─┬ babel-plugin-transform-do-expressions@6.22.0
│ │ │ └── babel-plugin-syntax-do-expressions@6.13.0
│ │ ├─┬ babel-plugin-transform-function-bind@6.22.0
│ │ │ └── babel-plugin-syntax-function-bind@6.13.0
│ │ └─┬ babel-preset-stage-1@6.24.1
│ │ ├─┬ babel-plugin-transform-class-constructor-call@6.24.1
│ │ │ └── babel-plugin-syntax-class-constructor-call@6.18.0
│ │ ├─┬ babel-plugin-transform-export-extensions@6.22.0
│ │ │ └── babel-plugin-syntax-export-extensions@6.13.0
│ │ └─┬ babel-preset-stage-2@6.24.1
│ │ ├── babel-plugin-syntax-dynamic-import@6.18.0
│ │ ├─┬ babel-plugin-transform-class-properties@6.24.1
│ │ │ └── babel-plugin-syntax-class-properties@6.13.0
│ │ ├─┬ babel-plugin-transform-decorators@6.24.1
│ │ │ └─┬ babel-helper-explode-class@6.24.1
│ │ │ └── babel-helper-bindify-decorators@6.24.1
│ │ └─┬ babel-preset-stage-3@6.24.1
│ │ ├─┬ babel-plugin-transform-async-generator-functions@6.24.1
│ │ │ └── babel-plugin-syntax-async-generators@6.13.0
│ │ └─┬ babel-plugin-transform-object-rest-spread@6.26.0
│ │ └── babel-plugin-syntax-object-rest-spread@6.13.0
│ ├── dedent@0.6.0
│ ├─┬ fs-extra-promise-es6@0.1.1
│ │ └─┬ fs-extra@0.26.7
│ │ ├── jsonfile@2.4.0
│ │ ├── klaw@1.3.1
│ │ └── rimraf@2.6.2
│ └── register-module@0.0.2
├── es6-promise@4.1.1
├─┬ esnext-async@0.0.9
│ └── zen-observable@0.3.0
├─┬ jasmine@2.8.0
│ ├── exit@0.1.2
│ ├─┬ glob@7.1.2
│ │ ├── fs.realpath@1.0.0
│ │ ├─┬ inflight@1.0.6
│ │ │ └── wrappy@1.0.2
│ │ ├── inherits@2.0.3
│ │ └── once@1.4.0
│ └── jasmine-core@2.8.0
└── node-promise-es6@0.3.2
我第一次用xml写作:)
答案 0 :(得分:1)
XML的DTD部分中没有<!DOCTYPE collection [ ... ]>
。这应该围绕所有这些定义。
答案 1 :(得分:0)
你的好几点,你刚刚错过了DOCTYPE标签。
在将DTD嵌入到XML文档中时需要DOCTYPE标记,当DTD在其自己的文件中时,您不需要它,请查看XML DOCTYPE reference。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE collection [
<!ELEMENT collection (storage)>
<!ATTLIST collection
xmlns CDATA #FIXED ''>
<!ELEMENT storage (genre)+>
<!ATTLIST storage
xmlns CDATA #FIXED ''>
<!ELEMENT genre (series)+>
<!ATTLIST genre
xmlns CDATA #FIXED ''
domain CDATA #REQUIRED>
<!ELEMENT series (title,author,number,country)>
<!ATTLIST series
xmlns CDATA #FIXED ''>
<!ELEMENT title (#PCDATA)>
<!ATTLIST title
xmlns CDATA #FIXED ''>
<!ELEMENT author (#PCDATA)>
<!ATTLIST author
xmlns CDATA #FIXED ''>
<!ELEMENT number (#PCDATA)>
<!ATTLIST number
xmlns CDATA #FIXED ''>
<!ELEMENT country (#PCDATA)>
<!ATTLIST country
xmlns CDATA #FIXED ''>
]>
<collection>
...