esgee85 / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
0 stars 0 forks source link

Approximate one or more on mixed content to zero or more when converting to DTD #180

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When converting from XML samples to different schema types (and in particular 
to DTD) with Trang there is a very common situation that is not handled well. 
Here it is a simple example:

<test>  
    <a>
        <x>some text</x>
        and
        <y>some other text</y>
    </a>
</test>

The inferred content for the "a" element is 
one or more of (element x, element y, text)
and the conversion to DTD stops and fails with a message that says:
***sorry, cannot handle this kind of "oneOrMore"***

This, basically makes the support for generating a DTD from XML unusable for 
many cases, when an element contains mixed content.

A possible fix will be to "approximate" oneOrMore to zeroOrMore when converting 
to DTD.

I am not sure if we should issue a warning (similar to the other approximate.. 
errors) or not when we make this approximation, because <text/> matches an 
empty element, so basically one or more on mixed content is equivalent to zero 
or more on mixed content.

Original issue reported on code.google.com by georgebina76 on 27 Mar 2014 at 12:52

GoogleCodeExporter commented 8 years ago
Fixed in r2368. No warning is issued. We just handle one or more on mixed 
content as if it was zero or more.

Original comment by georgebina76 on 28 Mar 2014 at 10:14