(The Most) Basic XSD Conversion from XML Fails To Validate in 12.0.4

I used a very, very simple XML file to try to create an XSD (XML Schema) from within IDEA 12.0.4 - using the IDEA conversion available. The Schema that IDEA created, when then referenced back in the XML file, failed to validate!

Using the same XML file, I was able to create a validating XSD using a $40 third-party program.

Therefore, I'm confused why IDEA doesn't get this right. At least, that's what seems to be happening.

Here's the XML:


Here's an example in IDEA showing what I mean:


<?xml version="1.0"?>
     <body>Don't forget me this weekend!</body>


Generated IDEA SCHEMA:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"

<xs:element name="note" type="noteType"/>
<xs:complexType name="noteType">
         <xs:element type="xs:string" name="to"/>
         <xs:element type="xs:string" name="from"/>
         <xs:element type="xs:string" name="heading"/>
         <xs:element type="xs:string" name="body"/>

So far, so good (it seems)....

But, if I now insert a reference to the schema in to the note.xml file, I get a red indicator around the top and bottom note elements (see attached image file).

Validation Failed.

Again, I'm confused why IDEA itself can't create a validating XSD file when a $40 third-pary gets it right.

Perhaps I'm missing something?  If this is failure to create a validating XML Schema (XSD file) a bug, then it seems obvious that nobody has tested this conversion feature at all.

Look forward to any suggestions or replies.


- M

1 comment
Comment actions Permalink

Indeed, generated XSD misses "targetNamespace" attribute. Could you please
submit a ticket for that?


Please sign in to leave a comment.