org.eclipse.xsd.example
Class XSDGenerateHTML

java.lang.Object
  extended by org.eclipse.xsd.example.XSDGenerateHTML
All Implemented Interfaces:
IApplication

public class XSDGenerateHTML
extends java.lang.Object
implements IApplication

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 example by running

  xsd-generate-schema-for-schema-html.bat
from the directory:
  plugins/org.eclipse.xsd.example/data/
This script uses the file
  plugins/org.eclipse.xsd.example/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 java.lang.String ALLOWS
          A markup style indicating the feature not required to be supported.
 java.util.Map<java.lang.String,java.lang.String> attributeDeclarationMarkupMap
          The map from String keys to documentation for XSDAttributeDeclarations.
 java.util.Map<java.lang.String,java.lang.String> contentDocumentationMap
          The map from String keys to documentation.
 java.util.Map<java.lang.String,java.lang.String> elementDeclarationMarkupMap
          The map from String keys to documentation for XSDElementDeclaration.
protected  java.lang.String errata
          The URL for errata.
static java.lang.String FUTURE
          A markup style indicating the feature will eventually be required to be supported.
static java.lang.String NEVER
          A markup style indicating the feature will never be required to be supported.
protected  java.util.List<java.lang.String> part1Anchors
          The list of anchors in Part 1.
protected  java.util.List<java.lang.String> part2Anchors
          The list of anchors in Part 2.
protected  java.util.List<java.lang.String> part2Components
          The list of components in Part 2.
static java.lang.String REQUIRES
          A markup style indicating the feature is required to be supported.
 java.util.Map<java.lang.String,java.lang.String> schemaTypeToJavaClassMap
          The map from schema type to Java class.
 java.util.Map<XSDElementDeclaration,XSDElementDeclaration> specialAnchorMap
          The map from XSDElementDeclaration to an anchor string.
 
Fields inherited from interface org.eclipse.equinox.app.IApplication
EXIT_OK, EXIT_RELAUNCH, EXIT_RESTART
 
Constructor Summary
XSDGenerateHTML()
          Creates an instance.
 
Method Summary
 java.lang.String getAttributeDeclarationDocumentation(java.lang.String key)
          Returns the attribute documentation associated with the key.
 java.lang.String getAttributeDeclarationMarkup(java.lang.String key)
          Returns the attribute markup associated with the key.
 java.lang.String getComponentLinks(XSDElementDeclaration xsdElementDeclaration)
          Returns an href in Part 1 or Part 2 of the component specification for the given element.
 java.lang.String getContentDocumentation(java.lang.String key)
          Returns the content documentation associated with the key.
 java.lang.String getElementDeclarationDocumentation(java.lang.String key)
          Returns the element documentation associated with the key.
 java.lang.String getElementDeclarationMarkup(java.lang.String key)
          Returns the element markup associated with the key.
 java.lang.String getLocalAnchor(XSDElementDeclaration xsdElementDeclaration)
          Returns an anchor that can be used locally for the given element declaration.
 java.lang.String getSimpleTypeDefinitionLink(XSDSimpleTypeDefinition xsdSimpleTypeDefinition)
          Returns an href in Part 2 of the component specification for the given simple type definition.
 java.lang.String getStandardLink(XSDElementDeclaration xsdElementDeclaration)
          Returns an href in Part 1 or Part 2 of the XML specification for the given element.
 void handleMarkup(java.util.Map<java.lang.String,java.lang.String> markupMap, org.w3c.dom.Element markupElement)
          Handle a markup element by caching information in a map.
 void loadAndPrint(java.lang.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, java.lang.String rootElementDeclarationMarkup)
          Print a particle with markup for the document.
 void printSimpleTypeDefinition(XSDSimpleTypeDefinition xsdSimpleTypeDefinition)
          Print a simple type definition for the document.
 void readMarkup(java.lang.String fileName)
          Read the markup from the .xml input.
 java.lang.Object run(java.lang.Object object)
          Generate HTML annotated documentation that summarizes the built-in simple type hierarchy.
 java.lang.Object start(IApplicationContext context)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schemaTypeToJavaClassMap

public java.util.Map<java.lang.String,java.lang.String> schemaTypeToJavaClassMap
The map from schema type to Java class.


contentDocumentationMap

public java.util.Map<java.lang.String,java.lang.String> contentDocumentationMap
The map from String keys to documentation.

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

elementDeclarationMarkupMap

public java.util.Map<java.lang.String,java.lang.String> 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 java.util.Map<java.lang.String,java.lang.String> 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 java.util.Map<XSDElementDeclaration,XSDElementDeclaration> specialAnchorMap
The map from XSDElementDeclaration to an anchor string.


part1Anchors

protected java.util.List<java.lang.String> part1Anchors
The list of anchors in Part 1.


part2Anchors

protected java.util.List<java.lang.String> part2Anchors
The list of anchors in Part 2.


part2Components

protected java.util.List<java.lang.String> part2Components
The list of components in Part 2.


errata

protected java.lang.String errata
The URL for errata.


REQUIRES

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

See Also:
Constant Field Values

ALLOWS

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

See Also:
Constant Field Values

FUTURE

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

See Also:
Constant Field Values

NEVER

public static final java.lang.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(java.lang.String fileName)
Read the markup from the .xml input.

Parameters:
fileName - the name of an XML file.

handleMarkup

public void handleMarkup(java.util.Map<java.lang.String,java.lang.String> markupMap,
                         org.w3c.dom.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 java.lang.String getContentDocumentation(java.lang.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 java.lang.String getElementDeclarationMarkup(java.lang.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 java.lang.String getElementDeclarationDocumentation(java.lang.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 java.lang.String getAttributeDeclarationMarkup(java.lang.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 java.lang.String getAttributeDeclarationDocumentation(java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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.

start

public java.lang.Object start(IApplicationContext context)
                       throws java.lang.Exception
Specified by:
start in interface IApplication
Throws:
java.lang.Exception

stop

public void stop()
Specified by:
stop in interface IApplication

run

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

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(java.lang.String xsdFile)
                  throws java.lang.Exception
Load the XML Schema file and print the documentation based on it.

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

printParticle

public void printParticle(XSDParticle xsdParticle,
                          java.lang.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-2006 IBM Corporation and others.
All Rights Reserved.