Package gov.nih.mipav.view.dialogs
Class MyXMLHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
gov.nih.mipav.view.dialogs.MyXMLHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
Handle events generated while parsing the XML file. This MyXMLHandler is a special one. We just need to save the Pts
from the VOI xml file into one chunk vector. We don't need to save the point coordinates into the VOI structure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Vector<WildMagic.LibFoundation.Mathematics.Vector3f> The contours of the VOI we are building.private StringThe current XML tag we are parsing.private StringThe data for the current element being parsed.private intThe slice the VOI contour should be on. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) DOCUMENT ME!voidendElement(String namespaceURI, String localName, String qName) Parser calls this when the end tag of each element is reached.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> Get the whole contour vector generated from the xml file.voidstartElement(String namespaceURI, String localName, String qName, Attributes atts) Parser calls this for each element in a document.Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
contourVector
The contours of the VOI we are building. -
currentKey
The current XML tag we are parsing. -
elementBuffer
The data for the current element being parsed. -
sliceNumber
private int sliceNumberThe slice the VOI contour should be on.
-
-
Constructor Details
-
MyXMLHandler
public MyXMLHandler()Construct our custom XML data handler.- Parameters:
voi- the VOI we should build from the XML file data
-
-
Method Details
-
getContourVector
Get the whole contour vector generated from the xml file.- Returns:
- contour vector
-
characters
public void characters(char[] ch, int start, int length) DOCUMENT ME!- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Parameters:
ch- char[]start- intlength- int
-
endElement
Parser calls this when the end tag of each element is reached. Data collected in the elementbuffer is generally saved to the image info.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
namespaceURI- the namespace (not used)localName- the current tag we are parsingqName- ? (not used)- Throws:
SAXException- if there is a problem with the parser
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException Parser calls this for each element in a document.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
namespaceURI- the namespace (not used)localName- the current tag we are parsingqName- ? (not used)atts- attributes for the current tag- Throws:
SAXException- if there is a problem with the parser
-