Advertisement
Guest User

Untitled

a guest
Sep 13th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.27 KB | None | 0 0
  1. <service name="GETME2" min="1" max="10" idleTime="300" backend="ABC">
  2. <handlerContainer className="com.abc.xyz.wqere.abcqwere">
  3. <handler className="com.abc.xyz.qweqweqwe.werwerwerwer"/>
  4. </handlerContainer>
  5. <mqListener queue="ABC.getme2" suggExpiry="30" minExpiry="4" maxExpiry="500" copyMessageId="true"/>
  6. </service>
  7.  
  8. <?xml version="1.0" encoding="UTF-8"?>
  9. <deploymentconfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  10. <configfile>sample.xml</configfile>
  11. <exceptionsFilterConfigFile>asdasd.xml</exceptionsFilterConfigFile>
  12. <keyInfoConfigFile>asdasd.xml</keyInfoConfigFile>
  13. <services>
  14.  
  15. <service name="GETME" min="1" max="10" idleTime="300" backend="ABC">
  16. <handlerContainer className="com.abc.xyz.wqere.abcqwere">
  17. <handler className="com.abc.xyz.qweqweqwe.werwerwerwer"/>
  18. </handlerContainer>
  19. <mqListener queue="ABC.getme" suggExpiry="30" minExpiry="4" maxExpiry="500" copyMessageId="true"/>
  20. </service>
  21.  
  22. <service name="GETME2" min="1" max="10" idleTime="300" backend="ABC">
  23. <handlerContainer className="com.abc.xyz.wqere.abcqwere">
  24. <handler className="com.abc.xyz.qweqweqwe.werwerwerwer"/>
  25. </handlerContainer>
  26. <mqListener queue="ABC.getme2" suggExpiry="30" minExpiry="4" maxExpiry="500" copyMessageId="true"/>
  27. </service>
  28. . . . .a lot of services like this . . . .
  29. . . . .a lot of services like this . . . .
  30. . . . .a lot of services like this . . . .
  31. . . . .a lot of services like this . . . .
  32. </services>
  33. <batchServices>
  34. <batchService name="batch1">
  35. <executor className="com.abc.xyz.qwer.qweqwewqe.ffdsdfsdfsdfsdf" />
  36. </batchService>
  37. <batchService name="batch2">
  38. <executor className="com.abc.xyz.qwer.qweqwewqe.zxcsadsad" />
  39. </batchService>
  40. . . . .a lot of batch services like this . . . .
  41. . . . .a lot of batch services like this . . . .
  42. . . . .a lot of batch services like this . . . .
  43. . . . .a lot of batch services like this . . . .
  44. </batchServices>
  45.  
  46. <timerservices>
  47. <timerservice> - a lot of timeservice
  48. </timerservices>
  49.  
  50. <connectionPools>
  51. <pool>
  52. <name>asdasd</name>
  53. <driver>oracle.jdbc.driver.OracleDriver</driver>
  54. <url>$asdasd_URL</url>
  55. <userId>$asdasd_USER</userId>
  56. <password>$asdasd_PASSWORD</password>
  57. <minConnections>0</minConnections>
  58. <maxConnections>10</maxConnections>
  59. <poolUrl>jdbc:asdsad:asdasdsad</poolUrl>
  60. <testSql>select * from abc</testSql>
  61. </pool>
  62.  
  63. . . a lot of pools. . .
  64.  
  65. </connectionpools>
  66.  
  67. </deploymentconfig>
  68.  
  69. <service name="GETME" min="1" max="10" idleTime="300" backend="ABC">
  70. <handlerContainer className="com.abc.xyz.wqere.abcqwere">
  71. <handler className="com.abc.xyz.qweqweqwe.werwerwerwer"/>
  72. </handlerContainer>
  73. <mqListener queue="ABC.getme" suggExpiry="30" minExpiry="4" maxExpiry="500" copyMessageId="true"/>
  74. </service>
  75.  
  76. QUEUENAME=INSERT_HERE
  77. grep ______________ $QUEUENAME. . .
  78.  
  79. Usage : xmllint [options] XMLfiles ...
  80. Parse the XML files and output the result of the parsing
  81. --version : display the version of the XML library used
  82. --debug : dump a debug tree of the in-memory document
  83. --shell : run a navigating shell
  84. --debugent : debug the entities defined in the document
  85. --copy : used to test the internal copy implementation
  86. --recover : output what was parsable on broken XML documents
  87. --noent : substitute entity references by their value
  88. --noout : don't output the result tree
  89. --path 'paths': provide a set of paths for resources
  90. --load-trace : print trace of all external entites loaded
  91. --nonet : refuse to fetch DTDs or entities over network
  92. --nocompact : do not generate compact text nodes
  93. --htmlout : output results as HTML
  94. --nowrap : do not put HTML doc wrapper
  95. --valid : validate the document in addition to std well-formed check
  96. --postvalid : do a posteriori validation, i.e after parsing
  97. --dtdvalid URL : do a posteriori validation against a given DTD
  98. --dtdvalidfpi FPI : same but name the DTD with a Public Identifier
  99. --timing : print some timings
  100. --output file or -o file: save to a given file
  101. --repeat : repeat 100 times, for timing or profiling
  102. --insert : ad-hoc test for valid insertions
  103. --compress : turn on gzip compression of output
  104. --html : use the HTML parser
  105. --xmlout : force to use the XML serializer when using --html
  106. --push : use the push mode of the parser
  107. --memory : parse from memory
  108. --maxmem nbbytes : limits memory allocation to nbbytes bytes
  109. --nowarning : do not emit warnings from parser/validator
  110. --noblanks : drop (ignorable?) blanks spaces
  111. --nocdata : replace cdata section with text nodes
  112. --format : reformat/reindent the input
  113. --encode encoding : output in the given encoding
  114. --dropdtd : remove the DOCTYPE of the input docs
  115. --c14n : save in W3C canonical format (with comments)
  116. --exc-c14n : save in W3C exclusive canonical format (with comments)
  117. --nsclean : remove redundant namespace declarations
  118. --testIO : test user I/O support
  119. --catalogs : use SGML catalogs from $SGML_CATALOG_FILES
  120. otherwise XML Catalogs starting from
  121. file:///etc/xml/catalog are activated by default
  122. --nocatalogs: deactivate all catalogs
  123. --auto : generate a small doc on the fly
  124. --xinclude : do XInclude processing
  125. --noxincludenode : same but do not generate XInclude nodes
  126. --loaddtd : fetch external DTD
  127. --dtdattr : loaddtd + populate the tree with inherited attributes
  128. --stream : use the streaming interface to process very large files
  129. --walker : create a reader and walk though the resulting doc
  130. --pattern pattern_value : test the pattern support
  131. --chkregister : verify the node registration code
  132. --relaxng schema : do RelaxNG validation against the schema
  133. --schema schema : do validation against the WXS schema
  134. --schematron schema : do validation against a schematron
  135. --sax1: use the old SAX1 interfaces for processing
  136. --sax: do not build a tree but work just at the SAX level
  137.  
  138. Libxml project home page: http://xmlsoft.org/
  139. To report bugs or get some help check: http://xmlsoft.org/bugs.html
  140.  
  141. xmllint: using libxml version 20626
  142.  
  143. print -j queue.services.[@name]
  144.  
  145. GETME
  146.  
  147. print -j queue.services[1].[@name]
  148.  
  149. GETME2
  150.  
  151. read -m json queue <<<"$(xsel -bo)"
  152.  
  153. print -j queue
  154.  
  155. {
  156. "batchServices": [
  157. {
  158. "@name": "batch1",
  159. "executor": {
  160. "@className": "com.abc.xyz.qwer.qweqwewqe.ffdsdfsdfsdfsdf"
  161. }
  162. },
  163. {
  164. "@name": "batch2",
  165. "executor": {
  166. "@className": "com.abc.xyz.qwer.qweqwewqe.zxcsadsad"
  167. }
  168. }
  169. ],
  170. "configfile": "sample.xml",
  171. "connectionPools": [
  172. {
  173. "driver": "oracle.jdbc.driver.OracleDriver",
  174. "maxConnections": "10",
  175. "minConnections": "0",
  176. "name": "asdasd",
  177. "password": "$asdasd_PASSWORD",
  178. "poolUrl": "jdbc:asdsad:asdasdsad",
  179. "testSql": "select * from abc",
  180. "url": "$asdasd_URL",
  181. "userId": "$asdasd_USER"
  182. }
  183. ],
  184. "exceptionsFilterConfigFile": "asdasd.xml",
  185. "keyInfoConfigFile": "asdasd.xml",
  186. "services": [
  187. {
  188. "@backend": "ABC",
  189. "@idleTime": "300",
  190. "@max": "10",
  191. "@min": "1",
  192. "@name": "GETME",
  193. "handlerContainer": {
  194. "@className": "com.abc.xyz.wqere.abcqwere",
  195. "handler": {
  196. "@className": "com.abc.xyz.qweqweqwe.werwerwerwer"
  197. }
  198. },
  199. "mqListener": {
  200. "@copyMessageId": "true",
  201. "@maxExpiry": "500",
  202. "@minExpiry": "4",
  203. "@queue": "ABC.getme",
  204. "@suggExpiry": "30"
  205. }
  206. },
  207. {
  208. "@backend": "ABC",
  209. "@idleTime": "300",
  210. "@max": "10",
  211. "@min": "1",
  212. "@name": "GETME2",
  213. "handlerContainer": {
  214. "@className": "com.abc.xyz.wqere.abcqwere",
  215. "handler": {
  216. "@className": "com.abc.xyz.qweqweqwe.werwerwerwer"
  217. }
  218. },
  219. "mqListener": {
  220. "@copyMessageId": "true",
  221. "@maxExpiry": "500",
  222. "@minExpiry": "4",
  223. "@queue": "ABC.getme2",
  224. "@suggExpiry": "30"
  225. }
  226. }
  227. ]
  228. }
  229.  
  230. xmllint --xpath '//service/[@name="GETME"]' Sample.xml
  231.  
  232. <services>
  233.  
  234. <service name="GETME" min="1" max="10" idleTime="300" backend="ABC">
  235. <handlerContainer className="com.abc.xyz.wqere.abcqwere">
  236. <handler className="com.abc.xyz.qweqweqwe.werwerwerwer"/>
  237. </handlerContainer>
  238. <mqListener queue="ABC.sadasdasd" suggExpiry="30" minExpiry="4" maxExpiry="500" copyMessageId="true"/>
  239. </service>
  240.  
  241. <service name="GETHIM" min="1" max="10" idleTime="300" backend="ABC">
  242. <handlerContainer className="com.abc.xyz.wqere.abcqwere">
  243. <handler className="com.abc.xyz.qweqweqwe.werwerwerwer"/>
  244. </handlerContainer>
  245. <mqListener queue="ABC.sadasdasd" suggExpiry="30" minExpiry="4" maxExpiry="500" copyMessageId="true"/>
  246. </service>
  247.  
  248. </services>
  249.  
  250. xmlstarlet sel -t -v "/services/service[@name='GETME']/mqListener/@queue" test.xml
  251.  
  252. -t ==> select template
  253. -v ==> template selected is "value", i.e. value-of <xpath>
  254.  
  255. xmllint --xpath "/services/service[@name='GETME']/mqListener/@queue" test.xml
  256.  
  257. #!/usr/bin/perl
  258.  
  259. use strict;
  260. use warnings;
  261.  
  262. use XML::Twig;
  263.  
  264. my ($keyword, $filename) = @ARGV;
  265.  
  266. XML::Twig->new(
  267. 'pretty_print' => 'indented_a',
  268. 'twig_handlers' => {
  269. 'service[@name="'.$keyword.'"]' => sub { $_->print }
  270. }
  271. )->parsefile($filename);
  272.  
  273. <service
  274. backend="ABC"
  275. idleTime="300"
  276. max="10"
  277. min="1"
  278. name="GETME">
  279. <handlerContainer className="com.abc.xyz.wqere.abcqwere">
  280. <handler className="com.abc.xyz.qweqweqwe.werwerwerwer" />
  281. </handlerContainer>
  282. <mqListener
  283. copyMessageId="true"
  284. maxExpiry="500"
  285. minExpiry="4"
  286. queue="ABC.getme"
  287. suggExpiry="30"
  288. />
  289. </service>
  290.  
  291. awk '
  292. /<service.*name=/ { f=1 ; m=0 ; res="" }
  293. f { res = res $0 ORS }
  294. f && /mqListener queue="ABC.getme2"/ { m=1 }
  295. /</service>/ { f=0 ; if (m) print res $0 }
  296. ' Sample.xml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement