(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:

(http://www.w3schools.com/schema/schema_howto.asp)

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

XML:

<?xml version="1.0"?>
<note>
     <to>Tove</to>
     <from>Jani</from>
     <heading>Reminder</heading>
     <body>Don't forget me this weekend!</body>
</note>


------------------

Generated IDEA SCHEMA:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
            xmlns:xs=
"http://www.w3.org/2001/XMLSchema">

<xs:element name="note" type="noteType"/>
<xs:complexType name="noteType">
     <xs:sequence>
         <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"/>
     </xs:sequence>
</xs:complexType>
</xs:schema>

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.

Thanks,

- M



Attachment(s):
nonvalid.png
1 comment

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

0

Please sign in to leave a comment.