Class MyXMLHandler

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    class MyXMLHandler
    extends org.xml.sax.helpers.DefaultHandler
    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

      Fields 
      Modifier and Type Field Description
      private java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> contourVector
      The contours of the VOI we are building.
      private java.lang.String currentKey
      The current XML tag we are parsing.
      private java.lang.String elementBuffer
      The data for the current element being parsed.
      private int sliceNumber
      The slice the VOI contour should be on.
    • Constructor Summary

      Constructors 
      Constructor Description
      MyXMLHandler()
      Construct our custom XML data handler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] ch, int start, int length)
      DOCUMENT ME!
      void endElement​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
      Parser calls this when the end tag of each element is reached.
      java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> getContourVector()
      Get the whole contour vector generated from the xml file.
      void startElement​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.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, warning
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • contourVector

        private final java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> contourVector
        The contours of the VOI we are building.
      • currentKey

        private java.lang.String currentKey
        The current XML tag we are parsing.
      • elementBuffer

        private java.lang.String elementBuffer
        The data for the current element being parsed.
      • sliceNumber

        private int sliceNumber
        The slice the VOI contour should be on.
    • Constructor Detail

      • MyXMLHandler

        public MyXMLHandler()
        Construct our custom XML data handler.
        Parameters:
        voi - the VOI we should build from the XML file data
    • Method Detail

      • getContourVector

        public java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> 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:
        characters in interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        ch - char[]
        start - int
        length - int
      • endElement

        public void endElement​(java.lang.String namespaceURI,
                               java.lang.String localName,
                               java.lang.String qName)
                        throws org.xml.sax.SAXException
        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:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        namespaceURI - the namespace (not used)
        localName - the current tag we are parsing
        qName - ? (not used)
        Throws:
        org.xml.sax.SAXException - if there is a problem with the parser
      • 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.SAXException
        Parser calls this for each element in a document.
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        namespaceURI - the namespace (not used)
        localName - the current tag we are parsing
        qName - ? (not used)
        atts - attributes for the current tag
        Throws:
        org.xml.sax.SAXException - if there is a problem with the parser