Spec Generator

From Device Description Working Group Wiki
Jump to: navigation, search

Spec Generator

W3C Spec Generator is a tool internally developed by several W3C working groups members in order to create W3C documents (Recommendations, Notes, Working Drafts...), including the possibility of definition of IDL interfaces and their bindings to other languages.

Invoking the Spec Generator

java -jar ../../../scripts/specgenerator.jar --bindings --offline --directory ../../core dom-spec.xml

Spec Generator arguments

--directory indicates where to generate the result. In that directory, it will generate a html directory.
--offline is to generate an offline version of the documents, ie without referencing the style sheets on the W3C website (don't use this option for an official publication)
--bindings will generate java files and idl files in addition to the HTML document.
--map <xmlId> <file-name> is used when generate multiple HTML documents. It associates a specific file to each section identified by xmlId.
--map -IndexFile- <file-name> will do the same but for the generated index.
--map -ObjectIndexFile- will do the same but for the object index.
--strip-references will eliminate references that aren't used in the document 
--strip-glossary will eliminate glossary entries that aren't used in the document
--map-type <language> <DOM IDL type> <language specific type> will map a DOM type into a language specific type, e.g.:
 --map-type ECMAScript "unsigned long" Number  --map-type Java "unsigned long" int

A lot of the options could be included in the processing instruction command-options:

--map Copyright-Notice copyright-notice
--map Introduction     introduction
--map TOC expanded-toc
--map Core core
--map Events events
--map idl idl-definitions
--map ecma-binding ecma-script-binding
--map java-binding java-binding
--map Index def-index
--map Objects object-index
--map References references
--map Errors errors
--map Level-3-AS abstract-schemas
--map Load-Save load-save
--map XPath xpath
--map KeySet keyset

--map -IndexFile-      def-index
--map -OjbectIndexFile-      object-index

--map-type ECMAScript void void
--map-type ECMAScript "unsigned short" Number --map-type ECMAScript "unsigned int" Number --map-type ECMAScript "unsigned long" Number ?> ]]

¤ The next step to follow regarding the use of the spec generator is to translate the first IDL document produced by the DDWG into XML format