|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.web3d.x3d.jaxp.X3DSAVAdapter
public class X3DSAVAdapter
Interface adapter between XML input from a SAX source to the SAV source used by the other parsers.
The implementation is a simplistic way for quickly getting XML content into the normal VRML input sources by adapting the SAX feeds to SAV feeds.
| Field Summary | |
|---|---|
protected static HashSet |
allowedPublicIDs
Set of permitted public IDs |
protected static HashSet |
allowedSystemIDs
Set of permitted system IDs |
protected static java.lang.String |
AS_ATTR
String constant of the AS attribute |
protected static java.util.HashMap |
attributeMap
Mapping of reserved attribute names strings to constants |
protected java.lang.StringBuffer |
characterDataBuffer
The buffer to put all the scripting string into as we're building up CDATA information. |
protected boolean |
checkForSceneTag
Flag to say we need to check next for a valid scene tag |
protected boolean |
checkForX3DNamespace
Flag indicating if the X3D namespace is set as the one that does not need to be prepended. |
protected static java.lang.String |
CLASS_ATTR
String constant of the Class attribute |
protected static int |
CLASS_ATTR_ID
|
protected static int |
COMPONENT_TAG
|
protected static int |
CONNECT_TAG
|
protected static java.lang.String |
CONTAINER_ATTR
String constant of the containerField attribute |
protected static int |
CONTAINER_ATTR_ID
|
protected static java.lang.String |
CONTAINER_PROPS_FILE
Name of the property file holding the default container fields |
protected java.util.Properties |
containerFields
Property for container fields |
protected ContentHandler |
contentHandler
Reference to the registered content handler if we have one |
protected IntStack |
declDepthStack
Stack of fieldDeclDepth counts as we traverse the script and proto instance declarations, particularly field value calls |
protected static java.lang.String |
DEF_ATTR
String constant of the DEF attribute |
protected static int |
DEF_ATTR_ID
|
protected IntStack |
depthCountStack
Stack of protoBodyDepth counts as we traverse the script and proto declarations. |
protected static java.util.HashMap |
elementMap
Mapping of element names strings to constants |
protected java.lang.String |
epUrl
Stored extern proto url to smooth model differences |
protected ErrorReporter |
errorReporter
Reporter instance for handing out errors |
protected static int |
EXPORT_TAG
|
protected static int |
EXTERNPROTO_DECL_TAG
|
protected static int |
FIELD_TAG
|
protected static int |
FIELD_VALUE_TAG
|
protected static java.util.HashMap |
fieldAccessMap
Mapping of field access type strings to constant integers |
protected int |
fieldDeclDepth
Flag to say we're in the processing of any field element right now |
protected java.lang.String |
fullURL
The full URL of the current world |
protected static int |
HEAD_TAG
|
protected static int |
IMPORT_TAG
|
protected boolean |
inScript
Flag to say we're in the processing of a script fields right now |
protected static java.lang.String |
INVALID_DTD_NAME_MSG
Message because the DTD name is wrong |
protected static java.lang.String |
INVALID_PUBLIC_ID_MSG
Message because the PUBLIC ID is wrong |
protected static java.lang.String |
INVALID_SYSTEM_ID_MSG
Message because the SYSTEM ID is wrong |
protected static int |
IS_TAG
|
protected static int |
META_TAG
|
protected static java.lang.String |
NAME_ATTR
String constant of the name attribute |
protected static int |
NAME_ATTR_ID
|
protected HashSet |
namespacePrefixes
A set of prefixes that we know about for the namespace IDs. |
protected static java.lang.String |
NO_PROFILE_MSG
Message when no profile was given |
protected static java.lang.String |
NO_SCENE_TAG_MSG
Message when there was no scene tag provided |
protected boolean |
overrideLex
Should we attempt to makeup for missing lexical events |
protected static int |
PROTO_BODY_TAG
|
protected static int |
PROTO_DECL_TAG
|
protected static int |
PROTO_INSTANCE_TAG
|
protected static int |
PROTO_INTERFACE_TAG
|
protected ProtoHandler |
protoHandler
Reference to the registered proto handler if we have one |
protected static int |
ROUTE_TAG
|
protected RouteHandler |
routeHandler
Reference to the registered route handler if we have one |
protected Locator |
savLocator
The SAV locator to find error information |
protected org.xml.sax.Locator |
saxLocator
The document SAX locator to find error information |
protected static int |
SCENE_TAG
|
protected static int |
SCRIPT_TAG
|
protected BooleanStack |
scriptFlagStack
Stack holding proto and script declaration semantics |
protected ScriptHandler |
scriptHandler
Reference to the registered script handler if we have one |
protected BooleanStack |
scriptUrlStack
Stack of flags on whether a Script had a url. |
protected static java.util.HashMap |
specStringMap
Map the spec version to version string |
protected static java.util.HashMap |
specVersionMap
Map the public ID to the spec version |
protected static HashSet |
systemSchemaIDs
Set of permitted schema IDs |
protected static java.lang.String |
TRANSITIONAL_HEADER_MSG
Message when transitional content detected |
protected static java.lang.String |
UNKNOWN_ACCESS_TYPE_MSG
Message for a bad field access type |
protected static java.lang.String |
UNKNOWN_DTD_MSG
Message when transitional content detected |
protected static java.lang.String |
USE_ATTR
String constant of the USE attribute |
protected static int |
USE_ATTR_ID
|
protected static java.lang.String |
USE_WITH_KIDS_MSG
Message when no profile was given |
protected boolean |
useIsCurrent
Flag to say the previous startNode() was actually a USE |
protected static java.lang.String |
VALUE_ATTR
String constant of the value attribute |
protected static java.lang.String |
VERSION_ATTR
String constant of the version attribute |
protected java.lang.String |
versionString
The version string defined by the spec |
protected java.lang.String |
worldURL
World URL, for passing on to the listener |
protected static int |
X3D_TAG
|
protected java.lang.String |
x3dNamespaceId
The ID string that is associated with the X3D namespace from the incoming document. |
protected static java.lang.String |
XML_ENCODING
Keyword describing the XML encoding for the start doc call |
| Constructor Summary | |
|---|---|
X3DSAVAdapter()
Construct a default instance of this class. |
|
| Method Summary | |
|---|---|
void |
characters(char[] ch,
int start,
int length)
Notification of character data to be added to the document. |
void |
comment(char[] ch,
int start,
int length)
Report an XML comment anywhere in the document. |
void |
endCDATA()
Report the end of a CDATA section. |
void |
endDocument()
End the current document that is being parsed. |
void |
endDTD()
Report the end of DTD declarations. |
void |
endElement(java.lang.String namespace,
java.lang.String name,
java.lang.String qName)
End the element processing. |
void |
endEntity(java.lang.String name)
Report the end of an entity. |
void |
endPrefixMapping(java.lang.String prefix)
End the mapping for the named prefix |
protected void |
endScript()
End a script. |
ContentHandler |
getContentHandler()
Get the currently set ContentHandler instance. |
ProtoHandler |
getProtoHandler()
Get the currently set ProtoHandler instance. |
RouteHandler |
getRouteHandler()
Get the currently set RouteHandler instance. |
ScriptHandler |
getScriptHandler()
Get the currently set ScriptHandler instance. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Notification of ignorable whitespace. |
protected void |
loadContainerProperties(float specVersion)
Load the properties files for the given spec version. |
protected int |
processFieldAccess(java.lang.String type,
java.lang.String fieldName)
Turn the field access type string into one of the standard contents |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Notification that a processing instruction has been added. |
void |
setContentHandler(ContentHandler ch)
Set the node handler to the given instance. |
void |
setDocumentLocator(org.xml.sax.Locator loc)
Set the saxLocator used to report error information back to the user. |
void |
setErrorReporter(ErrorReporter reporter)
Register an error reporter with the manager so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. |
void |
setLoadState(java.lang.String worldURL,
java.lang.String fullURL,
boolean overrideLex)
Set the loading state. |
void |
setProtoHandler(ProtoHandler ph)
Set the proto handler to the given instance. |
void |
setRouteHandler(RouteHandler rh)
Set the route handler to the given instance. |
void |
setScriptHandler(ScriptHandler sh)
Set the script handler to the given instance. |
void |
skippedEntity(java.lang.String name)
Notification of an entity that was skipped during the processing. |
void |
startCDATA()
Report the start of a CDATA section. |
void |
startDocument()
Start a new document to be parsed. |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(java.lang.String namespace,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attribs)
Start the processing of a new element with the given collection of attribute information. |
void |
startEntity(java.lang.String name)
Report the beginning of some internal and external XML entities. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Start the prefix mapping for a particular element or attribute. |
protected void |
startScript()
Start of a script declaration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String CONTAINER_PROPS_FILE
protected static final java.lang.String INVALID_DTD_NAME_MSG
protected static final java.lang.String INVALID_PUBLIC_ID_MSG
protected static final java.lang.String INVALID_SYSTEM_ID_MSG
protected static final java.lang.String TRANSITIONAL_HEADER_MSG
protected static final java.lang.String UNKNOWN_DTD_MSG
protected static final java.lang.String UNKNOWN_ACCESS_TYPE_MSG
protected static final java.lang.String NO_PROFILE_MSG
protected static final java.lang.String NO_SCENE_TAG_MSG
protected static final java.lang.String USE_WITH_KIDS_MSG
protected static final java.lang.String XML_ENCODING
protected static final int X3D_TAG
protected static final int COMPONENT_TAG
protected static final int SCENE_TAG
protected static final int PROTO_DECL_TAG
protected static final int EXTERNPROTO_DECL_TAG
protected static final int IS_TAG
protected static final int FIELD_TAG
protected static final int META_TAG
protected static final int PROTO_INSTANCE_TAG
protected static final int IMPORT_TAG
protected static final int EXPORT_TAG
protected static final int ROUTE_TAG
protected static final int FIELD_VALUE_TAG
protected static final int SCRIPT_TAG
protected static final int CONNECT_TAG
protected static final int HEAD_TAG
protected static final int PROTO_INTERFACE_TAG
protected static final int PROTO_BODY_TAG
protected static final java.lang.String NAME_ATTR
protected static final java.lang.String VERSION_ATTR
protected static final java.lang.String VALUE_ATTR
protected static final java.lang.String DEF_ATTR
protected static final java.lang.String USE_ATTR
protected static final java.lang.String AS_ATTR
protected static final java.lang.String CLASS_ATTR
protected static final java.lang.String CONTAINER_ATTR
protected static final int NAME_ATTR_ID
protected static final int DEF_ATTR_ID
protected static final int USE_ATTR_ID
protected static final int CLASS_ATTR_ID
protected static final int CONTAINER_ATTR_ID
protected static java.util.HashMap specVersionMap
protected static java.util.HashMap specStringMap
protected static HashSet allowedPublicIDs
protected static HashSet allowedSystemIDs
protected static HashSet systemSchemaIDs
protected static java.util.HashMap fieldAccessMap
protected static java.util.HashMap elementMap
protected static java.util.HashMap attributeMap
protected java.lang.String versionString
protected java.util.Properties containerFields
protected ErrorReporter errorReporter
protected org.xml.sax.Locator saxLocator
protected Locator savLocator
protected ContentHandler contentHandler
protected RouteHandler routeHandler
protected ScriptHandler scriptHandler
protected ProtoHandler protoHandler
protected java.lang.String worldURL
protected java.lang.String fullURL
protected boolean useIsCurrent
protected java.lang.StringBuffer characterDataBuffer
protected BooleanStack scriptFlagStack
protected boolean inScript
protected int fieldDeclDepth
protected IntStack depthCountStack
protected IntStack declDepthStack
protected boolean overrideLex
protected boolean checkForSceneTag
protected java.lang.String epUrl
protected BooleanStack scriptUrlStack
protected java.lang.String x3dNamespaceId
protected HashSet namespacePrefixes
protected boolean checkForX3DNamespace
xsd:noNamespaceSchemaLocation attribute on the X3D tag.
We look for one of the matching schema locations.
| Constructor Detail |
|---|
public X3DSAVAdapter()
| Method Detail |
|---|
public void setLoadState(java.lang.String worldURL,
java.lang.String fullURL,
boolean overrideLex)
worldURL - the worldURLfullURL - the full URLoverrideLex - Enable if lexicalHandling not working.
public void comment(char[] ch,
int start,
int length)
comment in interface org.xml.sax.ext.LexicalHandler
public void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
<!DOCTYPE X3D PUBLIC "-//Web3D//DTD X3D 3.0//EN"
"http://www.web3d.org/specification/x3d/x3d-3_0.dtd">
The second type are the transitional DOCTYPEs used during development
of the X3D specification.
<!DOCTYPE X3D PUBLIC
"http://www.web3D.org/TaskGroups/x3d/translation/x3d-compact.dtd"
"/www.web3D.org/TaskGroups/x3d/translation/x3d-compact.dtd">
<!DOCTYPE X3D PUBLIC
"http://www.web3d.org/specifications/x3d-3.0.dtd"
"/www.web3d.org/TaskGroups/x3d/translation/x3d-3.0.dtd">
It is advised that these forms are never used, it is for transitional
content only. When this header is detected, a warning message is
generated on the output, but parsing continues normally.
startDTD in interface org.xml.sax.ext.LexicalHandlername - The DTD name stringpublicId - The Public ID used for the contentsystemId - The system ID used for the content
org.xml.sax.SAXExceptionpublic void endDTD()
endDTD in interface org.xml.sax.ext.LexicalHandlerpublic void startCDATA()
startCDATA in interface org.xml.sax.ext.LexicalHandlerpublic void endCDATA()
endCDATA in interface org.xml.sax.ext.LexicalHandlerpublic void startEntity(java.lang.String name)
startEntity in interface org.xml.sax.ext.LexicalHandlerpublic void endEntity(java.lang.String name)
endEntity in interface org.xml.sax.ext.LexicalHandlerpublic void setDocumentLocator(org.xml.sax.Locator loc)
setDocumentLocator in interface org.xml.sax.ContentHandlerloc - The saxLocator to use or null to clear
public void startDocument()
throws org.xml.sax.SAXException
startDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException - The document is currently being parsed
public void endDocument()
throws org.xml.sax.SAXException
endDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException - Not thrown in this implementation
public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
startPrefixMapping in interface org.xml.sax.ContentHandlerprefix - The prefix string useduri - The namespace URI the prefix is mapped to
org.xml.sax.SAXException - Not thrown in this implementation
public void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
endPrefixMapping in interface org.xml.sax.ContentHandlerprefix - The prefix to stop the URI mapping for
org.xml.sax.SAXException - Not thrown in this implementation
public void startElement(java.lang.String namespace,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attribs)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlernamespace - The namespace for the element. Null if not usedlocalName - The local name of the element to createqName - The qualified name of the element including prefixattribs - The collection of attributes to use
org.xml.sax.SAXException - The element can't be found in the underlying
factory
public void endElement(java.lang.String namespace,
java.lang.String name,
java.lang.String qName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlernamespace - The namespace for the element. Null if not usedname - The local name of the element to createqName - The qualified name of the element including prefix
org.xml.sax.SAXException - Not thrown in this implementation
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlerch - The characters to add as a commentstart - The start position in the character arraylength - The number of characters to use as a comment
org.xml.sax.SAXException - The node containing the characters in is invalid
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ignorableWhitespace in interface org.xml.sax.ContentHandlerch - The characters to add as a commentstart - The start position in the character arraylength - The number of characters to use as a comment
org.xml.sax.SAXException - The node containing the characters in is invalid
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
processingInstruction in interface org.xml.sax.ContentHandlertarget - The target instruction namedata - Data associated with the instruction
org.xml.sax.SAXException - The instruction is invalid
public void skippedEntity(java.lang.String name)
throws org.xml.sax.SAXException
skippedEntity in interface org.xml.sax.ContentHandlername - The name of the entity that was skipped
org.xml.sax.SAXException - Not thrown in this implementationpublic void setErrorReporter(ErrorReporter reporter)
reporter - The instance to use or nullpublic ContentHandler getContentHandler()
ContentHandler instance. If nothing is set
it will return null.
public void setContentHandler(ContentHandler ch)
ch - The content handler instance to usepublic ScriptHandler getScriptHandler()
ScriptHandler instance. If nothing is set
it will return null.
public void setScriptHandler(ScriptHandler sh)
sh - The script handler instance to usepublic ProtoHandler getProtoHandler()
ProtoHandler instance. If nothing is set
it will return null.
public void setProtoHandler(ProtoHandler ph)
ph - The proto handler instance to usepublic RouteHandler getRouteHandler()
RouteHandler instance. If nothing is set
it will return null.
public void setRouteHandler(RouteHandler rh)
rh - The route handler instance to use
protected int processFieldAccess(java.lang.String type,
java.lang.String fieldName)
throws org.xml.sax.SAXException
type - A string representing the access typefieldName - The name of the field to process
org.xml.sax.SAXExceptionprotected void loadContainerProperties(float specVersion)
specVersion - The spec version in floating point formatprotected void startScript()
protected void endScript()
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||