Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ant.internal.ui.dtd.schema
Class SchemaFactory  view SchemaFactory download SchemaFactory.java

java.lang.Object
  extended byorg.eclipse.ant.internal.ui.dtd.schema.SchemaFactory
All Implemented Interfaces:
org.xml.sax.ext.DeclHandler

public class SchemaFactory
extends java.lang.Object
implements org.xml.sax.ext.DeclHandler

SchemaFactory is a SAX DeclHandler that converts DTD ELEMENT and ATTLIST declarations to schema form on the fly. The only two methods available to external users of SchemaFactory are its constructor and getSchema(). The latter returns the schema built by this process and should not be called until the XML parser to which this handler is attached has finished parsing.


Field Summary
private  char[] fBuf
           
private  Element fElement
           
private  java.lang.Exception fErrorException
           
private  int fLen
           
private  int fPos
           
private  Schema fSchema
           
private static java.util.HashSet fTypes
           
 
Constructor Summary
SchemaFactory()
          Constructor.
 
Method Summary
 void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value)
          Report an attribute type declaration.
private  void checkLen()
           
 void elementDecl(java.lang.String name, java.lang.String model)
          Report an element type declaration.
 void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Report a parsed external entity declaration.
private  Element getElement(java.lang.String eName)
           
 org.eclipse.ant.internal.ui.dtd.ISchema getSchema()
           
 void internalEntityDecl(java.lang.String name, java.lang.String value)
          Report an internal entity declaration.
private  org.eclipse.ant.internal.ui.dtd.IModel parseModel(java.lang.String model)
          Convert model string to IModel.
private  java.lang.String[] parseValues(java.lang.String type, char separator)
           
private  org.eclipse.ant.internal.ui.dtd.IModel scanElement()
          Scan an element name or a parenthesized sub-expression.
private  org.eclipse.ant.internal.ui.dtd.IModel scanExpr()
          Scan a parenthesized expression starting from the left parenthesis or leftmost operator.
private  org.eclipse.ant.internal.ui.dtd.IModel scanExpr(org.eclipse.ant.internal.ui.dtd.IModel term)
          Scan a parenthesized expression with the first term in hand.
 void setErrorException(java.lang.Exception e)
           
private  java.lang.String stripSurroundingParentheses(java.lang.String aString)
          Strips the surrounding parentheses from aString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fBuf

private char[] fBuf

fLen

private int fLen

fPos

private int fPos

fElement

private Element fElement

fSchema

private Schema fSchema

fTypes

private static java.util.HashSet fTypes

fErrorException

private java.lang.Exception fErrorException
Constructor Detail

SchemaFactory

public SchemaFactory()
Constructor.

Method Detail

getSchema

public org.eclipse.ant.internal.ui.dtd.ISchema getSchema()

attributeDecl

public void attributeDecl(java.lang.String eName,
                          java.lang.String aName,
                          java.lang.String type,
                          java.lang.String valueDefault,
                          java.lang.String value)
Description copied from interface: org.xml.sax.ext.DeclHandler
Report an attribute type declaration.

Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group with the separator "|" and all whitespace removed, or the word "NOTATION" followed by a space followed by a parenthesized token group with all whitespace removed.

The value will be the value as reported to applications, appropriately normalized and with entity and character references expanded.

Specified by:
attributeDecl in interface org.xml.sax.ext.DeclHandler

stripSurroundingParentheses

private java.lang.String stripSurroundingParentheses(java.lang.String aString)
Strips the surrounding parentheses from aString.

i.e.: (true|false) -> true|false


getElement

private Element getElement(java.lang.String eName)

parseValues

private java.lang.String[] parseValues(java.lang.String type,
                                       char separator)

elementDecl

public void elementDecl(java.lang.String name,
                        java.lang.String model)
                 throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.DeclHandler
Report an element type declaration.

The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all parameter entities are fully resolved and all whitespace is removed,and will include the enclosing parentheses. Other normalization (such as removing redundant parentheses or simplifying occurrence indicators) is at the discretion of the parser.

Specified by:
elementDecl in interface org.xml.sax.ext.DeclHandler

parseModel

private org.eclipse.ant.internal.ui.dtd.IModel parseModel(java.lang.String model)
                                                   throws org.xml.sax.SAXException
Convert model string to IModel. The fElement variable is an implicit argument to this method, and it sets fBuf, fPos and fLen for use by other parser methods.


scanExpr

private org.eclipse.ant.internal.ui.dtd.IModel scanExpr()
                                                 throws org.xml.sax.SAXException
Scan a parenthesized expression starting from the left parenthesis or leftmost operator.


scanExpr

private org.eclipse.ant.internal.ui.dtd.IModel scanExpr(org.eclipse.ant.internal.ui.dtd.IModel term)
                                                 throws org.xml.sax.SAXException
Scan a parenthesized expression with the first term in hand.


scanElement

private org.eclipse.ant.internal.ui.dtd.IModel scanElement()
                                                    throws org.xml.sax.SAXException
Scan an element name or a parenthesized sub-expression.


checkLen

private void checkLen()
               throws org.xml.sax.SAXException

externalEntityDecl

public void externalEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId)
Description copied from interface: org.xml.sax.ext.DeclHandler
Report a parsed external entity declaration.

Only the effective (first) declaration for each entity will be reported.

If the system identifier is a URL, the parser must resolve it fully before passing it to the application.

Specified by:
externalEntityDecl in interface org.xml.sax.ext.DeclHandler

internalEntityDecl

public void internalEntityDecl(java.lang.String name,
                               java.lang.String value)
Description copied from interface: org.xml.sax.ext.DeclHandler
Report an internal entity declaration.

Only the effective (first) declaration for each entity will be reported. All parameter entities in the value will be expanded, but general entities will not.

Specified by:
internalEntityDecl in interface org.xml.sax.ext.DeclHandler

setErrorException

public void setErrorException(java.lang.Exception e)