jeffreycwitt / tei-web-editor

GNU General Public License v3.0
23 stars 5 forks source link

validator does not work #16

Open lb42 opened 6 years ago

lb42 commented 6 years ago

I made a few changes to the sample TEI file, so that it looked like this :

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_lite.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_lite.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>Title</title>
      </titleStmt>
      <publicationStmt>
        <p>Publication information</p>
      </publicationStmt>
      <sourceDesc>
        <p>Information about the source</p>
      </sourceDesc>
    </fileDesc>
  </teiHeader>
  <text>
    <body>
      <p>Some text here.
      would be nice but what if I want to add a whole file?</p>
      <lb/><div n="foo"><p>inside a div</p></div><p>This is not valid!</p>
    </body>
  </text>
</TEI>

This is not valid against the TEI Lite schema, of course. Your validator didn't seem to mind.

jeffreycwitt commented 6 years ago

thanks @lb42

At the present, I don't actually think there is any schema validation going on at all.

An error only really shows if the document is not well-formed xml.

But I'll definitely put "adding a validator" on the to do list. That would be extremely useful.

jeffreycwitt commented 6 years ago

Note for future reference: this library might help with in browser xml schema validation: https://github.com/kripken/xml.js

See also: http://syssgx.github.io/xml.js/ and http://blog.askjoelit.com/2014/02/xml-validation-in-client-side-javascript.html