Hello, 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.
The XML which is stored in a String variable:
<carGarage>
<car>
<make>Chrysler</make>
<color>Red</color>
</car>
<car>
<make>Musano</make>
<color>Blue</color>
</car>
</carGarage>
My Java class where I want to extract the XML values and store them in the local attributes:
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();
...
}
}
What is the best way to approach this? I have looked at StringBufferInputStream but that is deprecated. I am truly quite lost.
Thankyou, Lucas.