Note that there are some explanatory texts on larger screens.

plurals
  1. PONot able to read XML because of spaces in XML file
    primarykey
    data
    text
    <p>I am facing a problem due to spaces in xml file. I want to read data from xml, but I face various problems due to spaces between nodes.</p> <p>Ex.</p> <p><code>If a node has 4 childs, due to the spaces it shows 9 childs to the node. So when I try to display node values in table, some columns without heading and without data are also created.</code></p> <p><code>When I removed these spaces I read my file successfully without any problem.</code></p> <p>So how fix such problem? Because everytime I can not personally remove white spaces from file, as I read multiple xml files. So it will be tedious job of removing spaces from every file.</p> <pre><code>Document doc; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); doc = dBuilder.parse(fp); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("parameter"); nodeName = name; for (int temp = 0; temp &lt; nList.getLength();temp++) { Node nNode = (Node) nList.item(temp); Element eElement = (Element) nNode; String upname1 = getTagValue("name", eElement); System.out.println(nodeName+" UP: "+upname1); if(upname1.equals(nodeName)) { NodeList pvalList = eElement.getElementsByTagName("paramvalues"); for(int l=0; l&lt; pvalList.getLength(); l++) { Node pNode = (Node) pvalList.item(l); NodeList valList = pNode.getChildNodes(); for(int j=0; j&lt;valList.getLength(); j++) { Node valNode = (Node) valList.item(j); if(valNode.getNodeName().equals("value")) { NamedNodeMap att = valNode.getAttributes(); for(int s=0; s&lt;att.getLength(); s++) { Node n1 = att.item(s); System.out.println("len: "+att.getLength()); if(n1.getNodeName().equals("default")) def = n1.getNodeValue(); if(n1.getNodeName().equals("actualvalue")) aval = n1.getNodeValue(); } } } } } } </code></pre> <p>I know this a strange problem, but its becoming irritating while completing my work.</p> <p>Plz help.. Thanks..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload