Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrayList<String>textcomment = new ArrayList<String>();
- for(int i = 0;i<nl.getLength();i++)
- {
- Element e = (Element)nl.item(i);
- // crash on this string find first time a value and second time find </no_of_comments>
- String noOfcomment = e.getElementsByTagName("no_of_comments").item(0).getFirstChild ().getNodeValue();
- aryNoOfcomment.add(i, noOfcomment);
- }
- String noOfcomment = e.getElementsByTagName ("no_of_comments"). item (0). getFirstChild (). getNodeValue ();
- List<String> yourList = new ArrayList<String>();
- NodeList nl = e.getElementsByTagName ("no_of_comments");
- if(nl != null){
- for(int i = 0;i<nl.getLength();i++)
- {
- Node n = nl.item(i).getFirstChild();
- if(n!=null){
- String value = n.getNodeValue();
- yourList.add(value);
- }
- }
- }
- FileInputStream fi = new FileInputStream(dir);
- builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- doc = builder.parse(fi);
- NodeList nlorgid = doc.getElementsByTagName("Organization");
- String orgidfromxml = ((Element)nlorgid.item(0)).getAttribute("id");
- System.out.println(" organization id from xml is "+orgidfromxml);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement