I an newbee need you your help.
I am converting a text in to XML (with some extra attributes)
my text is SPLINE(N, -1.151,1.002, -0.161,0.997, 0.840,-0.004, OUTLINED)
i need to have in XML using JDOM like following
<SPLINE n="3" x1="0.840" y1="-1.004" x2 ="-0.161" y2 ="0.997" x3 ="0.840" y3"-0.004" prim_style="OUTLINED" />
I can convert simply if N is fixed , in the above example N= 3 , so therefore has 3 x and 3 y coordinates. But If I am using for loop as below the result is not as excepted . any help will be great
root.addContent(child);
document.setContent(root);
int i = Integer.parseInt(temp_token[2]);
int count = i * 2 + i + 4;
for (int j = 0; j <= count - 5; j = j + 3) {
String x = null;
String y = null;
Element SPLINE = new Element("SPLINE")
.setAttribute("n", temp_token[2])
.setAttribute("x", temp_token[j + 4])
.setAttribute("y", temp_token[j + 5])
.setAttribute("prim_style",
temp_token[count]);
child.addContent(SPLINE);
From the above code