Interface NonWeb3DFileParser
- All Known Implementing Classes:
AC3DFileParser
,ColladaFileParser
,STLFileParser
,ThreeMFFileParser
The implied contract of implementing this interface is that the non-X3D/VRML file format parser implementation knows how to convert it's own knowledge into something that exactly replicates the X3D or VRML97 file format. It is required that the implementor knows how to transform this foreign format to X3D/VRML97 and issues the correct stream of events to make this happen. Remember that the receiver of the stream is assuming correctly formated file syntax, so if you give it an invalid ordering of callbacks, something is bound to die rather horribly.
Instances of this class are created using reflection. Each implementation requires a public no-argument constructor to be present.
- Version:
- Grammar $Revision: 1.3 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionFetch the locator used by this parser.void
Initialise the internals of the parser at start up.parse
(InputSource input, String[] style) Parse the input now.void
Set the content handler instance.void
setDocumentUrl
(String url) Set the base URL of the document that is about to be parsed.void
Set the error handler instance.void
setErrorReporter
(org.j3d.util.ErrorReporter eh) Set the error reporter instance.void
Set the proto handler instance.void
Set the route handler instance.void
Set the script handler instance.
-
Method Details
-
initialize
void initialize()Initialise the internals of the parser at start up. If you are not using the detailed constructors, this needs to be called to ensure that all internal state is correctly set up. -
setDocumentUrl
Set the base URL of the document that is about to be parsed. Users should always call this to make sure we have correct behaviour for the ContentHandler'sstartDocument()
call.The URL is cleared at the end of each document run. Therefore it is imperative that it gets called each time you use the parser.
- Parameters:
url
- The document url to set
-
getDocumentLocator
DocumentLocator getDocumentLocator()Fetch the locator used by this parser. This is here so that the user of this parser can ask for it and set it before calling startDocument(). Once the scene has started parsing in this class it is too late for the locator to be set. This parser does set it internally when asked for aX3DRelaxedParser.Scene()
but there may be other times when it is not set.- Returns:
- The locator used for syntax errors
-
setContentHandler
Set the content handler instance.- Parameters:
ch
- The content handler instance to use
-
setRouteHandler
Set the route handler instance.- Parameters:
rh
- The route handler instance to use
-
setScriptHandler
Set the script handler instance.- Parameters:
sh
- The script handler instance to use
-
setProtoHandler
Set the proto handler instance.- Parameters:
ph
- The proto handler instance to use
-
setErrorHandler
Set the error handler instance.- Parameters:
eh
- The error handler instance to use
-
setErrorReporter
void setErrorReporter(org.j3d.util.ErrorReporter eh) Set the error reporter instance. If this is also an ErrorHandler instance, the document locator will also be set.- Parameters:
eh
- The error handler instance to use
-
parse
Parse the input now.- Parameters:
input
- The stream to read fromstyle
- The style or null for no styling- Returns:
- Null if no parsing issues or a messages detailing the issues
- Throws:
IOException
- An I/O error while reading the streamImportFileFormatException
- A parsing error occurred in the file
-