title: Most effective way to process a string containing XML, in JAVA
body: <p>I have a String which contains XML nodes within it, and am seeking to use DOM parsing to process this string to extract node values and store them in local variables.</p>
  
  <p>The XML which is stored in a String variable:</p>
  
  <pre><code>&lt;carGarage&gt;
     &lt;car&gt;
        &lt;make&gt;Chrysler&lt;/make&gt;
        &lt;color&gt;Red&lt;/color&gt;
     &lt;/car&gt;
     &lt;car&gt;
        &lt;make&gt;Musano&lt;/make&gt;
        &lt;color&gt;Blue&lt;/color&gt;
     &lt;/car&gt;
  &lt;/carGarage&gt;
  </code></pre>
  
  <p>My Java class where I want to extract the XML values and store them in the local attributes:</p>
  
  <pre><code>public class CarGarage
  {   String make, color;
  
      public void setMake(String make)
      { this.make = make; }
  
      public void setColor(String color)
      { this.color = color; }
  
      public void DOMparsingMethod(Node thisNode)
      { int typeOfNode = thisNode.getNodeType();
        ...
      }
  }
  </code></pre>
  
  <p>What is the best way to approach this? 
  I have looked at StringBufferInputStream but that is deprecated. 
  I am truly quite lost.</p>
  
  <p>Thankyou,
  Lucas.</p>