org.eclipse.xsd.test
Class XSDGenerateHTML

java.lang.Object
  extended byorg.eclipse.xsd.test.XSDGenerateHTML
All Implemented Interfaces:
IPlatformRunnable

public class XSDGenerateHTML
extends Object
implements IPlatformRunnable

Generates HTML annotated documentation that summarizes the built-in simple type hierarchy. It implements the method run, which is called just like main during headless workbench invocation.

You can execute this test by running

  xsd-generate-schema-for-schema-html.bat
from the directory:
  plugins/org.eclipse.xsd.test/test/
This script uses the file
  plugins/org.eclipse.xsd.test/SampleMarkup.xml
for annotations. The resultin HTML document is stored in SchemaForSchema.html and an index.html is provided frame-based viewing of the document. The script
  xsd-generate-html.bat
allows you to pass in your own annotations.


Field Summary
static String ALLOWS
          A markup style indicating the feature not required to be supported.
 Map attributeDeclarationMarkupMap
          The map from String keys to documentation for XSDAttributeDeclarations.
 Map contentDocumentationMap
          The map from String keys to documentation.
 Map elementDeclarationMarkupMap
          The map from String keys to documentation for XSDElementDeclaration.
protected  String errata
          The URL for errata.
static String FUTURE
          A markup style indicating the feature will eventually be required to be supported.
static String NEVER
          A markup style indicating the feature will never be required to be supported.
protected  List part1Anchors
          The list of anchors in Part 1.
protected  List part2Anchors
          The list of anchors in Part 2.
protected  List part2Components
          The list of components in Part 2.
static String REQUIRES
          A markup style indicating the feature is required to be supported.
 Map schemaTypeToJavaClassMap
          The map from schema type to Java class.
 Map specialAnchorMap
          The map from XSDElementDeclaration to an anchor string.
 
Fields inherited from interface org.eclipse.core.runtime.IPlatformRunnable
EXIT_OK, EXIT_RELAUNCH, EXIT_RESTART
 
Constructor Summary
XSDGenerateHTML()
          Creates an instance.
 
Method Summary
 String getAttributeDeclarationDocumentation(String key)
          Returns the attribute documentation associated with the key.
 String getAttributeDeclarationMarkup(String key)
          Returns the attribute markup associated with the key.
 String getComponentLinks(XSDElementDeclaration xsdElementDeclaration)
          Returns an href in Part 1 or Part 2 of the component specification for the given element.
 String getContentDocumentation(String key)
          Returns the content documentation associated with the key.
 String getElementDeclarationDocumentation(String key)
          Returns the element documentation associated with the key.
 String getElementDeclarationMarkup(String key)
          Returns the element markup associated with the key.
 String getLocalAnchor(XSDElementDeclaration xsdElementDeclaration)
          Returns an anchor that can be used locally for the given element declaration.
 String getSimpleTypeDefinitionLink(XSDSimpleTypeDefinition xsdSimpleTypeDefinition)
          Returns an href in Part 2 of the component specification for the given simple type definition.
 String getStandardLink(XSDElementDeclaration xsdElementDeclaration)
          Returns an href in Part 1 or Part 2 of the XML specification for the given element.
 void handleMarkup(Map markupMap, Element markupElement)
          Handle a markup element by caching information in a map.
 void loadAndPrint(String xsdFile)
          Load the XML Schema file and print the documentation based on it.
 void printFooter()
          Print the end of the document.
 void printHeader()
          Print the start of the document.
 void printParticle(XSDParticle xsdParticle, String rootElementDeclarationMarkup)
          Print a particle with markup for the document.
 void printSimpleTypeDefinition(XSDSimpleTypeDefinition xsdSimpleTypeDefinition)
          Print a simple type definition for the document.
 void readMarkup(String fileName)
          Read the markup from the .xml input.
 Object run(Object object)
          Generate HTML annotated documentation that summarizes the built-in simple type hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schemaTypeToJavaClassMap

public Map schemaTypeToJavaClassMap
The map from schema type to Java class.


contentDocumentationMap

public Map contentDocumentationMap
The map from String keys to documentation.

See Also:
readMarkup(java.lang.String), handleMarkup(java.util.Map, org.w3c.dom.Element)

elementDeclarationMarkupMap

public Map elementDeclarationMarkupMap
The map from String keys to documentation for XSDElementDeclaration.

See Also:
readMarkup(java.lang.String), handleMarkup(java.util.Map, org.w3c.dom.Element)

attributeDeclarationMarkupMap

public Map attributeDeclarationMarkupMap
The map from String keys to documentation for XSDAttributeDeclarations.

See Also:
readMarkup(java.lang.String), handleMarkup(java.util.Map, org.w3c.dom.Element)

specialAnchorMap

public Map specialAnchorMap
The map from XSDElementDeclaration to an anchor string.


part1Anchors

protected List part1Anchors
The list of anchors in Part 1.


part2Anchors

protected List part2Anchors
The list of anchors in Part 2.


part2Components

protected List part2Components
The list of components in Part 2.


errata

protected String errata
The URL for errata.


REQUIRES

public static final String REQUIRES
A markup style indicating the feature is required to be supported.

See Also:
Constant Field Values

ALLOWS

public static final String ALLOWS
A markup style indicating the feature not required to be supported.

See Also:
Constant Field Values

FUTURE

public static final String FUTURE
A markup style indicating the feature will eventually be required to be supported.

See Also:
Constant Field Values

NEVER

public static final String NEVER
A markup style indicating the feature will never be required to be supported.

See Also:
Constant Field Values
Constructor Detail

XSDGenerateHTML

public XSDGenerateHTML()
Creates an instance.

Method Detail

readMarkup

public void readMarkup(String fileName)
Read the markup from the .xml input.

Parameters:
fileName - the name of an XML file.

handleMarkup

public void handleMarkup(Map markupMap,
                         Element markupElement)
Handle a markup element by caching information in a map.

Parameters:
markupMap - the map to contain the markup.
markupElement - the element specifying the markup.

getContentDocumentation

public String getContentDocumentation(String key)
Returns the content documentation associated with the key.

Parameters:
key - the key to look up.
Returns:
the associated content documentation.
See Also:
handleMarkup(java.util.Map, org.w3c.dom.Element)

getElementDeclarationMarkup

public String getElementDeclarationMarkup(String key)
Returns the element markup associated with the key.

Parameters:
key - the key to look up.
Returns:
the associated element markup.
See Also:
handleMarkup(java.util.Map, org.w3c.dom.Element)

getElementDeclarationDocumentation

public String getElementDeclarationDocumentation(String key)
Returns the element documentation associated with the key.

Parameters:
key - the key to look up.
Returns:
the associated element documentation.
See Also:
handleMarkup(java.util.Map, org.w3c.dom.Element)

getAttributeDeclarationMarkup

public String getAttributeDeclarationMarkup(String key)
Returns the attribute markup associated with the key.

Parameters:
key - the key to look up.
Returns:
the associated attribute markup.
See Also:
handleMarkup(java.util.Map, org.w3c.dom.Element)

getAttributeDeclarationDocumentation

public String getAttributeDeclarationDocumentation(String key)
Returns the attribute documentation associated with the key.

Parameters:
key - the key to look up.
Returns:
the associated attribute documentation.
See Also:
handleMarkup(java.util.Map, org.w3c.dom.Element)

getStandardLink

public String getStandardLink(XSDElementDeclaration xsdElementDeclaration)
Returns an href in Part 1 or Part 2 of the XML specification for the given element.

Parameters:
xsdElementDeclaration - an element declaration in the schema for schema.
Returns:
an href.

getComponentLinks

public String getComponentLinks(XSDElementDeclaration xsdElementDeclaration)
Returns an href in Part 1 or Part 2 of the component specification for the given element.

Parameters:
xsdElementDeclaration - a simple type defintion in the schema for schema.
Returns:
an href.

getSimpleTypeDefinitionLink

public String getSimpleTypeDefinitionLink(XSDSimpleTypeDefinition xsdSimpleTypeDefinition)
Returns an href in Part 2 of the component specification for the given simple type definition.

Parameters:
xsdSimpleTypeDefinition - an element declaration in the schema for schema.
Returns:
an href.

getLocalAnchor

public String getLocalAnchor(XSDElementDeclaration xsdElementDeclaration)
Returns an anchor that can be used locally for the given element declaration.

Parameters:
xsdElementDeclaration - an element declaration in the schema for schema.
Returns:
an anchor.

run

public Object run(Object object)
Generate HTML annotated documentation that summarizes the built-in simple type hierarchy.

Specified by:
run in interface IPlatformRunnable
Parameters:
object - an array of Strings.
Returns:
0 indicating success, or 1 indicating failure.

printHeader

public void printHeader()
Print the start of the document.


printFooter

public void printFooter()
Print the end of the document.


loadAndPrint

public void loadAndPrint(String xsdFile)
                  throws Exception
Load the XML Schema file and print the documentation based on it.

Parameters:
xsdFile - the name of an XML Schema file.
Throws:
Exception

printParticle

public void printParticle(XSDParticle xsdParticle,
                          String rootElementDeclarationMarkup)
Print a particle with markup for the document.

Parameters:
xsdParticle - a particle.
rootElementDeclarationMarkup - the markup.

printSimpleTypeDefinition

public void printSimpleTypeDefinition(XSDSimpleTypeDefinition xsdSimpleTypeDefinition)
Print a simple type definition for the document.

Parameters:
xsdSimpleTypeDefinition - a simple type definition in the schema for schema.

Copyright 2001-2004 IBM Corporation and others.
All Rights Reserved.