{"id":1213,"date":"2014-09-16T10:54:16","date_gmt":"2014-09-16T08:54:16","guid":{"rendered":"http:\/\/www.capri-soft.de\/blog\/?p=1213"},"modified":"2014-09-16T10:54:16","modified_gmt":"2014-09-16T08:54:16","slug":"ibm-doors-dxl-analyze-module-or-string-for-html-or-xml-tags","status":"publish","type":"post","link":"https:\/\/www.capri-soft.de\/blog\/?p=1213","title":{"rendered":"IBM Doors DXL: Analyze Module or String for HTML or XML Tags"},"content":{"rendered":"<h1>Problem<\/h1>\n<p>A module or a string should be analyzed for HTML or XML Tags.<\/p>\n<h1>Approach<\/h1>\n<p>The tags withing a module attribute shall be counted and the output should be send to the DXL Interaction window.<\/p>\n<p>By running through the whole string, opening and closing tags can be found.<br \/>\nHere the steps are the following:<br \/>\n1.) Create a Skip-List that counts all tags<br \/>\n2.) Create a loop over the current module<br \/>\n3.) Within the loop call the Method checkForTags and <\/p>\n<h1>Solution<\/h1>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\npragma runLim, 0;\r\n\r\n\/********************************************************************\r\n * Author: \tBjoern Karpenstein\r\n * Date: \t2014-09-16\r\n * Parameter: \r\n * Skipliste tagCount (vorher mit Skip tagCount=create; erzeugen)\r\n * string textToCheck (der auf XML Tags zu pr\u00fcfende Text)\r\n * string tag (nach welchen Tag sehen? Falls leer alle Tags sammeln\r\n ********************************************************************\/\r\nvoid checkForTags(Skip tagCount, string textToCheck, string tag)\r\n{\r\n   \/\/ init loop variables\r\n bool currentIsInTag = false;\r\n bool tagEnded = false;\r\n string tagBetweenBrackets = &quot;&quot;;\r\n int x;\r\n   \t\r\n for (x=0; x&lt;length(textToCheck)-1;x++)\r\n {\r\n  if(textToCheck&amp;#91;x:x&amp;#93; &quot;&quot; == &quot;&lt;&quot; &quot;&quot;)\r\n  {\r\n    currentIsInTag = true;\r\n    tagBetweenBrackets = &quot;&quot;;\r\n   }\r\n           \r\n   if(textToCheck&amp;#91;x:x&amp;#93; &quot;&quot; == &quot;&gt;&quot; &quot;&quot; &amp;&amp; currentIsInTag)\r\n   {\r\n     currentIsInTag = false;\r\n\r\n     \/\/ Wenn der Tag schon vorhanden ... eins hochz\u00e4hlen\r\n     int vorhanden = 0;\r\n\r\n     if(find(tagCount, tagBetweenBrackets &quot;&gt;&quot;, vorhanden))\r\n     {\r\n       \/\/ nehmen und eins hochz\u00e4hlen\r\n       if(matches(lower(tag), lower(tagBetweenBrackets)))\r\n       {\r\n\t\/\/ L\u00f6sche den aktuellen Wert in Skip-Liste\t\t   \t\t   \r\n\tdelete (tagCount, tagBetweenBrackets &quot;&gt;&quot;);\r\n\t\t   \t\t   \r\n\t\/\/ F\u00fcge den aktuellen Wert inkrementiert in St\u00fcckliste ein\r\n\tput(tagCount, tagBetweenBrackets &quot;&gt;&quot;, vorhanden+1);\r\n       }\r\n    }\r\n    else\r\n    {\r\n      \/\/ Wenn nicht vorhanden initial mit 1 einf\u00fcgen\r\n      if(matches(lower(tag), lower(tagBetweenBrackets)))\r\n      {\r\n         put(tagCount, tagBetweenBrackets &quot;&gt;&quot;, 1);\r\n      }\r\n     }  \r\n    }\r\n      \r\n    if(currentIsInTag)\r\n    {\r\n       tagBetweenBrackets = tagBetweenBrackets textToCheck&#x5B;x:x] &quot;&quot;;\r\n    }\r\n  }   \r\n}\r\n\r\nvoid main()\r\n{\r\n  Object o;\r\n  Module m = current;\r\n  Filter off;\r\n  Skip tagCount = create;\r\n\t\r\n  for o in m do\r\n  {\t\t\r\n    string engText = o.&quot;Text_english&quot; &quot;&quot;;\r\n    string gerText = o.&quot;Text_german&quot; &quot;&quot;;\r\n\t\t\r\n    checkForTags(tagCount, engText, &quot;&quot;);\r\n    checkForTags(tagCount, gerText, &quot;&quot;);\r\n  }\r\n\t\r\n  for myIterator in tagCount do \r\n  {\r\n    string keyValue = (string key(tagCount));\r\n   \r\n    int dasVorhandene=0;\r\n\t   \r\n    if(find(tagCount, keyValue, dasVorhandene))\r\n    {\r\n      print keyValue &quot; \\t&quot; dasVorhandene &quot;\\n&quot;;\r\n    }\r\n  }\r\n\t\r\n  delete(tagCount);\r\n}\r\n\r\nmain();\r\n\r\n<\/pre>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Fwww.capri-soft.de%2Fblog%2F%3Fp%3D1213&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px;margin-top:5px;\"><\/iframe>","protected":false},"excerpt":{"rendered":"<p>Problem A module or a string should be analyzed for HTML or XML Tags. Approach The tags withing a module attribute shall be counted and the output should be send to the DXL Interaction window. By running through the whole string, opening and closing tags can be found. Here the steps are the following: 1.) &hellip; <a href=\"https:\/\/www.capri-soft.de\/blog\/?p=1213\" class=\"more-link\"><span class=\"screen-reader-text\">IBM Doors DXL: Analyze Module or String for HTML or XML Tags<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[22,19],"tags":[],"class_list":["post-1213","post","type-post","status-publish","format-standard","hentry","category-dxl","category-ibm-doors"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4yGeN-jz","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1213"}],"version-history":[{"count":2,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1213\/revisions"}],"predecessor-version":[{"id":1215,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1213\/revisions\/1215"}],"wp:attachment":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}