Skip to main content

Posts

Showing posts from February, 2013

Parsing XML with namespace in Java

Introduction Yesterday, again, I needed parser a XML stream using Java. Then I went to Google try to find a exemple code. Because I needed the value of two specific fields, TAGs, I decided use XPATH to get directly this values. How ever, I needed do several tried until get a result. Keywords JAVA, XML, NAMESPACE, XML PARSE; Article I will show how to read XML without namespace and after we will read a XML streams with namespaces. This is the first XML that I have used in this example without namespaces <?xml version="1.0" encoding="UTF-8"?> <root>   <head>     <title>My Book</title>   </head>   <bookreview>     <title>This is a book about special girls</title>     <girls>       <girl>         <name>Mata Hari</name>       </girl>       <girl>          <name>Belle de Jour</name>       </girl>       <girl>          <name&