I hope you can help me in my code, i read line by line from text file and write it in XML file.and here is my code:\[code\] try { String strLine; String num=""; String mix=""; DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); // Back element Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("Back"); doc.appendChild(rootElement); // ref-list element Element reflist = doc.createElement("ref-list"); rootElement.appendChild(reflist); while( (strLine = br.readLine()) != null) { if (strLine.equals("")) { continue; } int dotIndex = strLine.indexOf("."); num = strLine.substring(0,dotIndex); mix = strLine.substring(dotIndex+2,strLine.length()); // ref element Element ref= doc.createElement("ref"); reflist.appendChild(ref); // set attribute of ref element Attr attr = doc.createAttribute("id"); attr.setValue(num); ref.setAttributeNode(attr); // label element Element label = doc.createElement("label"); ref.appendChild(label); label.setTextContent(num); // citation-alternatives element Element citationalternatives = doc.createElement("citation-alternatives"); ref.appendChild(citationalternatives); // mixed-citation element Element mixedcitation = doc.createElement("mixed-citation"); citationalternatives.appendChild(mixedcitation); mixedcitation.setTextContent(mix); }\[/code\]the output is: \[code\]<ref id="1"> <label>1</label> <citation-alternatives> <mixed-citation>L.T. Jetter, C. J. McHargue and R. O. Williams, J. Appl. Phys. 27, 363 (1956).</mixed-citation> </citation-alternatives> </ref>\[/code\]but in other cases the input is : \[code\]1. L.T. Jetter, C. J. McHargue and R. O. Williams, J. Appl. Phys. 27, 363 (1956). \[/code\]and the output is: \[code\]<ref id="1"> <label>1</label> <citation-alternatives> <mixed-citation>L.T. Jetter, C. J. McHargue and R. O. Williams, </mixed-citation> </citation-alternatives> </ref> <ref id="1"> <label>1</label> <citation-alternatives> <mixed-citation>J. Appl. Phys. 27, 363 (1956).</mixed-citation> </citation-alternatives> </ref>\[/code\]here the input wrote int two lines not one linereally i am confused and can't fixed it can anyone help me, Thanks