This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parsing an XML for given input

 
Rakesh Bagaria
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<PROJECT_NAME NAME="POSTPAID_GLB">
<DB_PROFILE PROFILE="UAT19">
<DB_CONNECT_CODE CONNECT_CODE="USAGE1">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>[size=9] [/size]
<DB_CONNECT_CODE CONNECT_CODE="USAGE2">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>
<DB_CONNECT_CODE CONNECT_CODE="USAGE3">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>
</DB_PROFILE>
<DB_PROFILE PROFILE="UAT17">
<DB_CONNECT_CODE CONNECT_CODE="USAGE1">
<DB_HOST>indlin007</DB_HOST>
<DB_INSTANCE>GLBABP7</DB_INSTANCE>
<DB_PORT>1528</DB_PORT>
<DB_USER>DB17</DB_USER>
<DB_PASSWORD>DB17</DB_PASSWORD>
</DB_CONNECT_CODE>
</DB_PROFILE>
</PROJECT_NAME>


I want to write a parser like i will have PROFILE name and CONNECT_CODE as input and function should parse corresponding tags .
like for profile "UAT19" and CONNECT_CODE "USAGE1"

below should get parser
<DB_PROFILE PROFILE="UAT19">
<DB_CONNECT_CODE CONNECT_CODE="USAGE1">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>

like for USAGE2

DB_CONNECT_CODE CONNECT_CODE="USAGE2">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>


please help i know little bit about SAX parser.



 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I search for "sax tutorial", I get a whole lot of results, starting with a chapter from Oracle's Java Tutorial (which should always be your first stop for learning Java). Have you worked through any of those?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47261
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a “beginning” question. Moving.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic