Right-clicking an XML file in NetBeans includes the menu option, "Generate DTD..."
In Altova XMLSpy, right-clicking an XML file includes a menu option, "Generate DTD/Schema..."
The attached images shows the dialog that is opened in XMLSpy.
The recommended enhancement is to provide similar functionality as has been done with XMLSpy.
Created attachment 97761 [details]
Generate DTD/Schema Image
FYI... Another Option:
IntelliJ IDEA Case Study:
Right-click XML file, Generate XSD Schemas from XML File.
*** Bug 29178 has been marked as a duplicate of this bug. ***
This is new feature. Not defect.
Use Cases: W3C XML Schemas can be generated from instance documents with the Relaxer tool. This tool can be used by NetBeans to perform the conversion.
Reference: "Generating DTDs from XML Instance Documents" from "Java & XML, 3rd Edition (O'Reilly). Note that the Relaxer link has changed.
Oops... last section header should have said "Generating XML Schemas from Instance Documents" from page 30 of Java & XML, third edition.
relaxer -xsd [file].xml
DTDs can also be generated with relaxer:
"Generating DTDs from XML Instance Documents", page 25.
relaxer -dtd [file].xml
Note: I'm sure that relaxer isn't the only tool to perform these generations... I just don't know the other tools/APIs at this time.