relaxng / jing-trang

Schema validation and conversion based on RELAX NG
http://www.thaiopensource.com/relaxng/
Other
228 stars 69 forks source link

trang does not handle escaped quotes in strings properly #228

Open chrispitude opened 6 years ago

chrispitude commented 6 years ago

When there are escaped quotes in a string (the a:longName attribute here):

<?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">
 <start>
  <element name="xmlnsname" a:longName="XML namespace name (aka &quot;namespace URI&quot;)">
   <text/>
  </element>
 </start>
</grammar>

trang does not re-escape them to preserve them properly:

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="xmlnsname" a:longName="XML namespace name (aka "namespace URI")">
      <text/>
    </element>
  </start>
</grammar>

The resulting output is no longer valid:

$ jing y.rng
/home/chrispy/dita-ot-3.1.3/plugins/org.oasis-open.dita.v1_3/rng/technicalContent/rng/y.rng:4:68: fatal: Element type "element" must be followed by either attribute specifications, ">" or "/>".
sideshowbarker commented 6 years ago

Thanks for reporting this. I am planning to do a new release soon (see #231) but I unfortunately can’t make time myself to investigate and fix this issue any time soon. So if it’s important for you that a fix for this gets into the release, then we’re gonna need for somebody to make time to write up a patch.