regex - issue with regular expression in java -


i have string in format of xml

 <?xml version="1.0" encoding="utf-8"?>n   <objecta>n   <command>existing</command>n   <status>ok</status>n   <values>a lot of values....</values>n   </objecta> 

i want split array of string value , content

     [0] objecta = ""      [1] command = existing      [2] status = ok      [3] values = lot of values.... 

i tried

 result = result.replaceall(">n<", "><"); //$non-nls-1$ //$non-nls-2$  pattern pattern = pattern.compile("<*?>*?</*?>"); //$non-nls-1$ 

but is not working me

why not use xml parser?

element docelem = document.getdocumentelement();  nodelist children = docelem.getchildnodes();  list<string> values = new arraylist<string>();  for(int x = 0; x < children.getlength(); x++) {      // want children. came out wrong. } 

Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -