public void getDataDTD ( Writer output ) throws DataTaskException { try { output . write ( "<!ELEMENT dataset (\n" ) ; for ( Iterator it = _preparedModel . getElementNames ( ) ; it . hasNext ( ) ; ) { String elementName = ( String ) it . next ( ) ; output . write ( " " ) ; output . write ( elementName ) ; output . write ( "*" ) ; output . write ( it . hasNext ( ) ? " |\n" : "\n" ) ; } output . write ( ")>\n<!ATTLIST dataset\n name CDATA #REQUIRED\n>\n" ) ; for ( Iterator it = _preparedModel . getElementNames ( ) ; it . hasNext ( ) ; ) { String elementName = ( String ) it . next ( ) ; List classDescs = _preparedModel . getClassDescriptorsMappingTo ( elementName ) ; if ( classDescs == null ) { output . write ( "\n<!-- Indirection table" ) ; } else { output . write ( "\n<!-- Mapped to : " ) ; for ( Iterator classDescIt = classDescs . iterator ( ) ; classDescIt . hasNext ( ) ; ) { ClassDescriptor classDesc = ( ClassDescriptor ) classDescIt . next ( ) ; output . write ( classDesc . getClassNameOfObject ( ) ) ; if ( classDescIt . hasNext ( ) ) { output . write ( "\n " ) ; } } } output . write ( " -->\n<!ELEMENT " ) ; output . write ( elementName ) ; output . write ( " EMPTY>\n<!ATTLIST " ) ; output . write ( elementName ) ; output . write ( "\n" ) ; for ( Iterator attrIt = _preparedModel . getAttributeNames ( elementName ) ; attrIt . hasNext ( ) ; ) { String attrName = ( String ) attrIt . next ( ) ; output . write ( " " ) ; output . write ( attrName ) ; output . write ( " CDATA #" ) ; output . write ( _preparedModel . isRequired ( elementName , attrName ) ? "REQUIRED" : "IMPLIED" ) ; output . write ( "\n" ) ; } output . write ( ">\n" ) ; } } catch ( IOException ex ) { throw new DataTaskException ( ex ) ; } }
Writes a DTD that can be used for data XML files matching the current model to the given writer .