Class FileSurfaceRefXML_J3D.SurfaceRefXMLHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- gov.nih.mipav.view.renderer.J3D.model.file.FileSurfaceRefXML_J3D.SurfaceRefXMLHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler
- Enclosing class:
- FileSurfaceRefXML_J3D
private class FileSurfaceRefXML_J3D.SurfaceRefXMLHandler extends org.xml.sax.helpers.DefaultHandlerUsed by the XML Parser to parse the Surface.XML header.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.StringcurrentKeyCurrent XML keyword:.(package private) java.lang.StringelementBufferCurrent buffer:.(package private) FileInfoSurfaceRefXML_J3DfileInfofileInfo data structure for reading the surface information into:.
-
Constructor Summary
Constructors Constructor Description SurfaceRefXMLHandler(FileInfoSurfaceRefXML_J3D fInfo)Creates a new SurfaceXMLHandler object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)Text data callback from parser.voidendDocument()Do nothing.voidendElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)Called by parser when the end of an element is reached in the document.private javax.vecmath.Color3fgetColor(java.lang.String kParseString)Called when reading the input surface.xml file: Parses the input string into a Color3f variable:java.lang.StringgetColorString(javax.vecmath.Color3f kColor)Called when writing the surface.xml file: Converts the input Color3f to a String for writing:voidskippedEntity(java.lang.String name)Do nothing but show the entity we skipped.voidstartElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)Parser calls this for the beginning of each element in the document.
-
-
-
Field Detail
-
currentKey
java.lang.String currentKey
Current XML keyword:.
-
elementBuffer
java.lang.String elementBuffer
Current buffer:.
-
fileInfo
FileInfoSurfaceRefXML_J3D fileInfo
fileInfo data structure for reading the surface information into:.
-
-
Constructor Detail
-
SurfaceRefXMLHandler
public SurfaceRefXMLHandler(FileInfoSurfaceRefXML_J3D fInfo)
Creates a new SurfaceXMLHandler object.- Parameters:
fInfo- FileInfo for storing the file data into.
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length)Text data callback from parser. If the parser is not validating, this method can report whitespace. We ignore strings that are entirely whitespace.- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin classorg.xml.sax.helpers.DefaultHandler- Parameters:
ch- Character arraystart- Start of data in array.length- Length of data in array.
-
endDocument
public void endDocument() throws org.xml.sax.SAXExceptionDo nothing.- Specified by:
endDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
endDocumentin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException- never happens
-
endElement
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXExceptionCalled by parser when the end of an element is reached in the document.- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classorg.xml.sax.helpers.DefaultHandler- Parameters:
namespaceURI- the namespace urilocalName- the element nameqName- the qualified name- Throws:
org.xml.sax.SAXException- if a problem is encountered during parsing
-
skippedEntity
public void skippedEntity(java.lang.String name)
Do nothing but show the entity we skipped.- Specified by:
skippedEntityin interfaceorg.xml.sax.ContentHandler- Overrides:
skippedEntityin classorg.xml.sax.helpers.DefaultHandler- Parameters:
name- the skipped entity name
-
startElement
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXExceptionParser calls this for the beginning of each element in the document.- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classorg.xml.sax.helpers.DefaultHandler- Parameters:
namespaceURI- the namespace urilocalName- the element nameqName- the qualified nameatts- the attached attributes- Throws:
org.xml.sax.SAXException- if a problem is encountered during parsing
-
getColorString
public java.lang.String getColorString(javax.vecmath.Color3f kColor)
Called when writing the surface.xml file: Converts the input Color3f to a String for writing:- Parameters:
kColor- color object- Returns:
- the color in string format
-
getColor
private javax.vecmath.Color3f getColor(java.lang.String kParseString)
Called when reading the input surface.xml file: Parses the input string into a Color3f variable:- Parameters:
kParseString- input string containing the material color- Returns:
- the material color in Color3f format
-
-