Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xerces.domx
Class XGrammarWriter

    java.lang.Object
      |
      +--org.apache.xerces.domx.XGrammarWriter

public class XGrammarWriter
extends java.lang.Object

This program allows you to print the grammar of a document either in XML Schema format or the standard DTD format.

Inner Class Summary
`static class` | `XGrammarWriter.OutputFormat` Output format enumeration.

Field Summary
`protected boolean` | `canonical` Canonical output.
`protected static java.lang.String[]` | `CONTENT_MODEL_ELEMENT_NAMES` Content model element names.
`protected static XGrammarWriter.OutputFormat` | `DEFAULT_OUTPUT_FORMAT` Default output format.
`protected java.lang.String` | `encoding` Encoding.
`protected XGrammarWriter.OutputFormat` | `format` Output format.
`protected int` | `indent` Indent level.
`protected java.io.PrintWriter` | `out` Output writer.
`protected boolean` | `verbose` Verbose.

Constructor Summary
`XGrammarWriter()` Default constructor.
`XGrammarWriter(java.io.OutputStream stream)` Constructs a grammar writer with the specified writer.
`XGrammarWriter(java.io.PrintWriter writer)` Constructs a grammar writer with the specified print writer.
`XGrammarWriter(java.io.Writer writer, java.lang.String encoding)` Constructs a grammar writer with the specified writer.

Method Summary
`protected boolean` | `containsMoreThanOneChildOfType(Element node, java.lang.String[] names)` Returns true if the specified element has more than one child with any of the given names.
`protected Node` | `getFirstChildOfType(Node node, short type)` Returns the first child of the given node type.
`protected Node` | `getNextSiblingOfType(Node node, short type)` Returns the next sibling of the given node type.
`XGrammarWriter.OutputFormat` | `getOutputFormat()` Returns the output format.
`protected boolean` | `isBasicAttributeType(java.lang.String type)` Returns true if the attribute type is basic.
`protected boolean` | `isBasicOccurrenceCount(java.lang.String minOccurs, java.lang.String maxOccurs)` Returns true if the occurrence count is basic.
`boolean` | `isCanonical()` Returns true if the output is canonical.
`protected boolean` | `isEmpty(Element element)` Returns true if the element is "empty".
`boolean` | `isVerbose()` Returns true if the output is verbose.
`static void` | `main(java.lang.String[] argv)` Main program.
`protected java.lang.String` | `normalize(java.lang.String s)` Normalizes the given string.
`protected int` | `parseInt(java.lang.String s, int defaultValue)` Parses a string and returns the integer value.
`void` | `printAttribute(Attr attribute)` Prints an attribute.
`void` | `printAttributeDecl(java.lang.String elemName, Element attribute)` Prints a DTD attribute declaration.
`void` | `printCloseElement(Element element)` Prints a close element.
`void` | `printComment(Element comment)` Prints a comment.
`void` | `printElement(Element element)` Prints the given element.
`void` | `printElementDecl(Element element)` Prints a DTD element declaration.
`void` | `printElementDeclContentModel(Element archetype)` Prints a DTD element declaration content model.
`void` | `printElementDeclContentModelChildren(Element archetype)` Prints a DTD element declaration children content model.
`void` | `printElementDeclContentModelMixed(Element archetype)` Prints a DTD element declaration mixed content model.
`void` | `printEmptyElement(Element element)` Prints an empty element.
`void` | `printEntityDecl(Element entity)` Prints a DTD entity declaration.
`void` | `printGrammar(java.lang.String systemId, DocumentType doctype)` Prints the given grammar with the specified output format.
`void` | `printIndent(int level)` Prints an indent level.
`void` | `printNotationDecl(Element notation)` Prints a DTD notation declaration.
`void` | `printOpenElement(Element element)` Prints an open element.
`protected void` | `printOpenElement(Element element, boolean empty)` Prints an open or empty element.
`void` | `printText(Text text)` Prints text.
`void` | `setCanonical(boolean canonical)` Sets whether the output is canonical.
`void` | `setOutputFormat(XGrammarWriter.OutputFormat format)` Sets the output format.
`void` | `setVerbose(boolean verbose)` Sets whether the output is verbose.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_OUTPUT_FORMAT

    protected static final XGrammarWriter.OutputFormat DEFAULT_OUTPUT_FORMAT

  Default output format.

### CONTENT_MODEL_ELEMENT_NAMES

    protected static final java.lang.String[] CONTENT_MODEL_ELEMENT_NAMES

  Content model element names.

### out

    protected java.io.PrintWriter out

  Output writer.

### indent

    protected int indent

  Indent level.

### format

    protected XGrammarWriter.OutputFormat format

  Output format.

### verbose

    protected boolean verbose

  Verbose.

### encoding

    protected java.lang.String encoding

  Encoding.

### canonical

    protected boolean canonical

  Canonical output.

Constructor Detail

### XGrammarWriter

    public XGrammarWriter()

  Default constructor.

### XGrammarWriter

    public XGrammarWriter(java.io.PrintWriter writer)

  Constructs a grammar writer with the specified print writer.

### XGrammarWriter

    public XGrammarWriter(java.io.OutputStream stream)

  Constructs a grammar writer with the specified writer.

### XGrammarWriter

    public XGrammarWriter(java.io.Writer writer,
                          java.lang.String encoding)

  Constructs a grammar writer with the specified writer.

Method Detail

### main

    public static void main(java.lang.String[] argv)

  Main program.

### setOutputFormat

    public void setOutputFormat(XGrammarWriter.OutputFormat format)

  Sets the output format.

### getOutputFormat

    public XGrammarWriter.OutputFormat getOutputFormat()

  Returns the output format.

### setVerbose

    public void setVerbose(boolean verbose)

  Sets whether the output is verbose.

### isVerbose

    public boolean isVerbose()

  Returns true if the output is verbose.

### setCanonical

    public void setCanonical(boolean canonical)

  Sets whether the output is canonical.

### isCanonical

    public boolean isCanonical()

  Returns true if the output is canonical.

### printGrammar

    public void printGrammar(java.lang.String systemId,
                             DocumentType doctype)

  Prints the given grammar with the specified output format.

### printComment

    public void printComment(Element comment)

  Prints a comment.

### printElement

    public void printElement(Element element)

  Prints the given element.

### printIndent

    public void printIndent(int level)

  Prints an indent level.

### printOpenElement

    public void printOpenElement(Element element)

  Prints an open element.

### printEmptyElement

    public void printEmptyElement(Element element)

  Prints an empty element.

### printCloseElement

    public void printCloseElement(Element element)

  Prints a close element.

### printAttribute

    public void printAttribute(Attr attribute)

  Prints an attribute.

### printText

    public void printText(Text text)

  Prints text.

### printElementDecl

    public void printElementDecl(Element element)

  Prints a DTD element declaration.

### printElementDeclContentModel

    public void printElementDeclContentModel(Element archetype)

  Prints a DTD element declaration content model.

### printElementDeclContentModelMixed

    public void printElementDeclContentModelMixed(Element archetype)

  Prints a DTD element declaration mixed content model.

### printElementDeclContentModelChildren

    public void printElementDeclContentModelChildren(Element archetype)

  Prints a DTD element declaration children content model.

### printAttributeDecl

    public void printAttributeDecl(java.lang.String elemName,
                                   Element attribute)

  Prints a DTD attribute declaration.

### printEntityDecl

    public void printEntityDecl(Element entity)

  Prints a DTD entity declaration.

### printNotationDecl

    public void printNotationDecl(Element notation)

  Prints a DTD notation declaration.

### printOpenElement

    protected void printOpenElement(Element element,
                                    boolean empty)

  Prints an open or empty element.

### isEmpty

    protected boolean isEmpty(Element element)

  Returns true if the element is "empty". In other words, if it does not contain element or text node children.

### isBasicAttributeType

    protected boolean isBasicAttributeType(java.lang.String type)

  Returns true if the attribute type is basic.

### isBasicOccurrenceCount

    protected boolean isBasicOccurrenceCount(java.lang.String minOccurs,
                                             java.lang.String maxOccurs)

  Returns true if the occurrence count is basic.

### parseInt

    protected int parseInt(java.lang.String s,
                           int defaultValue)

  Parses a string and returns the integer value.

### containsMoreThanOneChildOfType

    protected boolean containsMoreThanOneChildOfType(Element node,
                                                     java.lang.String[] names)

  Returns true if the specified element has more than one child with any of the given names.

### getFirstChildOfType

    protected Node getFirstChildOfType(Node node,
                                       short type)

  Returns the first child of the given node type.

### getNextSiblingOfType

    protected Node getNextSiblingOfType(Node node,
                                        short type)

  Returns the next sibling of the given node type.

### normalize

    protected java.lang.String normalize(java.lang.String s)

  Normalizes the given string.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2001 Apache XML Project. All Rights Reserved.