title: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Vector
body: <p>I have XML parsed data that I am trying to add into a DefaultTableModel.
  The DefaultTableModel takes in Vectors or Object[] as argument according to the documentation.</p>
  
  <p>But when I use a Vector I get this exception :</p>
  
  <pre><code>java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Vector
  </code></pre>
  
  <p>This is the class I am using to parse and add into the vector .</p>
  
  <pre><code>public class PropXMLParsing {
  
      static PropXMLParsing instance = null;
  
      private Vector&lt;String&gt; header = new Vector&lt;String&gt;();
      private Vector&lt;String&gt; data = new Vector&lt;String&gt;();
  
      public static PropXMLParsing getInstance() {
  
          if (instance == null) {
  
              instance = new PropXMLParsing();
              try {
                  instance.ParserForObjectTypes();
              } catch (SAXException e) {
  
                  e.printStackTrace();
              } catch (IOException e) {
  
                  e.printStackTrace();
              } catch (ParserConfigurationException e) {
  
                  e.printStackTrace();
              }
  
          }
  
          return instance;
  
      }
  
      public void ParserForObjectTypes() throws SAXException, IOException,
              ParserConfigurationException {
  
          try {
              FileInputStream file = new FileInputStream(new File(
                      "xmlFiles/CoreDatamodel.xml"));
  
              DocumentBuilderFactory builderFactory = DocumentBuilderFactory
                      .newInstance();
  
              DocumentBuilder builder = builderFactory.newDocumentBuilder();
  
              Document xmlDocument = builder.parse(file);
  
              XPath xPath = XPathFactory.newInstance().newXPath();
  
              String expression = "//prop/*";
              NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(
                      xmlDocument, XPathConstants.NODESET);
              for (int i = 0; i &lt; nodeList.getLength(); i++) {
  
                  System.out.println(nodeList.item(i).getFirstChild()
                          .getNodeValue());
  
                  data.addElement(nodeList.item(i).getFirstChild().getNodeValue());
                  header.addElement(nodeList.item(i).getFirstChild()
                          .getNodeValue());
  
              }
  
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (SAXException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          } catch (ParserConfigurationException e) {
              e.printStackTrace();
          } catch (XPathExpressionException e) {
              e.printStackTrace();
          }
      }
  
      public Vector&lt;String&gt; getHeader() {
  
          return header;
      }
  
      public Vector&lt;String&gt; getData() {
          return data;
      }
  
  }
  </code></pre>
  
  <p>And this last line of code is where it cast exception. This is from my GUI class :</p>
  
  <pre><code>model = new DefaultTableModel(PropXMLParsing.getInstance().getHeader(),
                  PropXMLParsing.getInstance().getData());
  
          table = new JTable(model);
  </code></pre>
  
  <p>Help me please</p>