{"action":"created","comment":{"url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/comments/41472168","id":41472168,"diff_hunk":"@@ -53,15 +76,86 @@ public String parseAttribute(String input, String attributeName)\n         return \"\";\n     }\n \n-    public String findMatchingData(String input, String attributeName)\n+    String findMatchingData(String input, String attributeName)\n     {\n         Pattern pattern = Pattern.compile(attributeName + \"=.*\");\n         Matcher matcher = pattern.matcher(input);\n         String matchingData = \"\";\n-\n         while (matcher.find()) {\n             matchingData = matcher.group(0);\n         }\n         return matchingData;\n     }\n+\n+    String getXmlLyrics(String lyrics, String verseOrder)\n+    {\n+        String verseOrders[] = parseVerseOrders(verseOrder);\n+        Writer out = new StringWriter();\n+        try {\n+            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();\n+            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();\n+            Document document = docBuilder.newDocument();\n+            document.setXmlStandalone(true);\n+\n+            Element elementSong = getSongTag(document);\n+            document.appendChild(elementSong);\n+\n+            Element elementLyrics = getLyricsTag(document);\n+            elementSong.appendChild(elementLyrics);\n+\n+            Element elementVerse = getVerseTag(document);\n+            elementLyrics.appendChild(elementVerse);\n+\n+            Transformer transformer = TransformerFactory.newInstance().newTransformer();\n+            transformer.transform(new DOMSource(document), new StreamResult(out));\n+\n+        } catch (ParserConfigurationException e) {\n+            logger.log(Level.SEVERE, \"Exception occurs in:\", e);\n+        } catch (TransformerException e) {\n+            logger.log(Level.SEVERE, \"Exception occurs in:\", e);\n+        }\n+        return out.toString();\n+    }\n+\n+    Element getSongTag(Document document)\n+    {\n+        Element song = document.createElement(\"song\");\n+        Attr version = document.createAttribute(\"version\");\n+        version.setValue(\"1.0\");\n+        song.setAttributeNode(version);\n+        return song;\n+    }\n+\n+    Element getLyricsTag(Document document)\n+    {\n+        return document.createElement(\"lyrics\");\n+    }\n+\n+    Element getVerseTag(Document document)\n+    {\n+        Element verse = document.createElement(\"verse\");\n+        Attr type = document.createAttribute(\"type\");\n+        type.setValue(\"\");\n+        verse.setAttributeNode(type);\n+        Attr label = document.createAttribute(\"label\");\n+        label.setValue(\"\");\n+        verse.setAttributeNode(label);\n+        verse.appendChild(document.createCDATASection(\"data\"));\n+        return verse;\n+    }\n+\n+    String[] parseVerseOrders(String verseOrder)","path":"src/main/java/org/worshipsongs/importer/SongParser.java","position":153,"original_position":153,"commit_id":"bd2d033dc7c9c04912596e6a79eed63c2f3d2607","original_commit_id":"bd2d033dc7c9c04912596e6a79eed63c2f3d2607","user":{"login":"sskjames","id":229993,"avatar_url":"https://avatars.githubusercontent.com/u/229993?v=3","gravatar_id":"","url":"https://api.github.com/users/sskjames","html_url":"https://github.com/sskjames","followers_url":"https://api.github.com/users/sskjames/followers","following_url":"https://api.github.com/users/sskjames/following{/other_user}","gists_url":"https://api.github.com/users/sskjames/gists{/gist_id}","starred_url":"https://api.github.com/users/sskjames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sskjames/subscriptions","organizations_url":"https://api.github.com/users/sskjames/orgs","repos_url":"https://api.github.com/users/sskjames/repos","events_url":"https://api.github.com/users/sskjames/events{/privacy}","received_events_url":"https://api.github.com/users/sskjames/received_events","type":"User","site_admin":false},"body":"Consider renaming the method as \"splitVerseOrder\".","created_at":"2015-10-08T03:05:59Z","updated_at":"2015-10-08T03:05:59Z","html_url":"https://github.com/crunchersaspire/worshipsongs-importer/pull/4#discussion_r41472168","pull_request_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/comments/41472168"},"html":{"href":"https://github.com/crunchersaspire/worshipsongs-importer/pull/4#discussion_r41472168"},"pull_request":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4","id":46873813,"html_url":"https://github.com/crunchersaspire/worshipsongs-importer/pull/4","diff_url":"https://github.com/crunchersaspire/worshipsongs-importer/pull/4.diff","patch_url":"https://github.com/crunchersaspire/worshipsongs-importer/pull/4.patch","issue_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/issues/4","number":4,"state":"open","locked":false,"title":"Parsed lyrics attribute from a song","user":{"login":"pitchumani1989","id":8839835,"avatar_url":"https://avatars.githubusercontent.com/u/8839835?v=3","gravatar_id":"","url":"https://api.github.com/users/pitchumani1989","html_url":"https://github.com/pitchumani1989","followers_url":"https://api.github.com/users/pitchumani1989/followers","following_url":"https://api.github.com/users/pitchumani1989/following{/other_user}","gists_url":"https://api.github.com/users/pitchumani1989/gists{/gist_id}","starred_url":"https://api.github.com/users/pitchumani1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitchumani1989/subscriptions","organizations_url":"https://api.github.com/users/pitchumani1989/orgs","repos_url":"https://api.github.com/users/pitchumani1989/repos","events_url":"https://api.github.com/users/pitchumani1989/events{/privacy}","received_events_url":"https://api.github.com/users/pitchumani1989/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-06T08:20:49Z","updated_at":"2015-10-08T03:05:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"582c117e6e9e8ed309e9cc8589e40c4cacd73f42","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4/commits","review_comments_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4/comments","review_comment_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/issues/4/comments","statuses_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/statuses/bd2d033dc7c9c04912596e6a79eed63c2f3d2607","head":{"label":"pitchumani1989:master","ref":"master","sha":"bd2d033dc7c9c04912596e6a79eed63c2f3d2607","user":{"login":"pitchumani1989","id":8839835,"avatar_url":"https://avatars.githubusercontent.com/u/8839835?v=3","gravatar_id":"","url":"https://api.github.com/users/pitchumani1989","html_url":"https://github.com/pitchumani1989","followers_url":"https://api.github.com/users/pitchumani1989/followers","following_url":"https://api.github.com/users/pitchumani1989/following{/other_user}","gists_url":"https://api.github.com/users/pitchumani1989/gists{/gist_id}","starred_url":"https://api.github.com/users/pitchumani1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitchumani1989/subscriptions","organizations_url":"https://api.github.com/users/pitchumani1989/orgs","repos_url":"https://api.github.com/users/pitchumani1989/repos","events_url":"https://api.github.com/users/pitchumani1989/events{/privacy}","received_events_url":"https://api.github.com/users/pitchumani1989/received_events","type":"User","site_admin":false},"repo":{"id":43727625,"name":"worshipsongs-importer","full_name":"pitchumani1989/worshipsongs-importer","owner":{"login":"pitchumani1989","id":8839835,"avatar_url":"https://avatars.githubusercontent.com/u/8839835?v=3","gravatar_id":"","url":"https://api.github.com/users/pitchumani1989","html_url":"https://github.com/pitchumani1989","followers_url":"https://api.github.com/users/pitchumani1989/followers","following_url":"https://api.github.com/users/pitchumani1989/following{/other_user}","gists_url":"https://api.github.com/users/pitchumani1989/gists{/gist_id}","starred_url":"https://api.github.com/users/pitchumani1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitchumani1989/subscriptions","organizations_url":"https://api.github.com/users/pitchumani1989/orgs","repos_url":"https://api.github.com/users/pitchumani1989/repos","events_url":"https://api.github.com/users/pitchumani1989/events{/privacy}","received_events_url":"https://api.github.com/users/pitchumani1989/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pitchumani1989/worshipsongs-importer","description":"","fork":true,"url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer","forks_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/forks","keys_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/teams","hooks_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/hooks","issue_events_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/issues/events{/number}","events_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/events","assignees_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/assignees{/user}","branches_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/branches{/branch}","tags_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/tags","blobs_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/statuses/{sha}","languages_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/languages","stargazers_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/stargazers","contributors_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/contributors","subscribers_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/subscribers","subscription_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/subscription","commits_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/contents/{+path}","compare_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/merges","archive_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/downloads","issues_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/issues{/number}","pulls_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/pulls{/number}","milestones_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/milestones{/number}","notifications_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/labels{/name}","releases_url":"https://api.github.com/repos/pitchumani1989/worshipsongs-importer/releases{/id}","created_at":"2015-10-06T03:18:26Z","updated_at":"2015-10-06T03:22:20Z","pushed_at":"2015-10-08T01:46:52Z","git_url":"git://github.com/pitchumani1989/worshipsongs-importer.git","ssh_url":"git@github.com:pitchumani1989/worshipsongs-importer.git","clone_url":"https://github.com/pitchumani1989/worshipsongs-importer.git","svn_url":"https://github.com/pitchumani1989/worshipsongs-importer","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"crunchersaspire:master","ref":"master","sha":"127a19fe12bf570731fe463203f4a0a3a1c7293b","user":{"login":"crunchersaspire","id":8839657,"avatar_url":"https://avatars.githubusercontent.com/u/8839657?v=3","gravatar_id":"","url":"https://api.github.com/users/crunchersaspire","html_url":"https://github.com/crunchersaspire","followers_url":"https://api.github.com/users/crunchersaspire/followers","following_url":"https://api.github.com/users/crunchersaspire/following{/other_user}","gists_url":"https://api.github.com/users/crunchersaspire/gists{/gist_id}","starred_url":"https://api.github.com/users/crunchersaspire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crunchersaspire/subscriptions","organizations_url":"https://api.github.com/users/crunchersaspire/orgs","repos_url":"https://api.github.com/users/crunchersaspire/repos","events_url":"https://api.github.com/users/crunchersaspire/events{/privacy}","received_events_url":"https://api.github.com/users/crunchersaspire/received_events","type":"User","site_admin":false},"repo":{"id":43726794,"name":"worshipsongs-importer","full_name":"crunchersaspire/worshipsongs-importer","owner":{"login":"crunchersaspire","id":8839657,"avatar_url":"https://avatars.githubusercontent.com/u/8839657?v=3","gravatar_id":"","url":"https://api.github.com/users/crunchersaspire","html_url":"https://github.com/crunchersaspire","followers_url":"https://api.github.com/users/crunchersaspire/followers","following_url":"https://api.github.com/users/crunchersaspire/following{/other_user}","gists_url":"https://api.github.com/users/crunchersaspire/gists{/gist_id}","starred_url":"https://api.github.com/users/crunchersaspire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crunchersaspire/subscriptions","organizations_url":"https://api.github.com/users/crunchersaspire/orgs","repos_url":"https://api.github.com/users/crunchersaspire/repos","events_url":"https://api.github.com/users/crunchersaspire/events{/privacy}","received_events_url":"https://api.github.com/users/crunchersaspire/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/crunchersaspire/worshipsongs-importer","description":"","fork":false,"url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer","forks_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/forks","keys_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/teams","hooks_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/hooks","issue_events_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/issues/events{/number}","events_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/events","assignees_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/assignees{/user}","branches_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/branches{/branch}","tags_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/tags","blobs_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/git/refs{/sha}","trees_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/statuses/{sha}","languages_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/languages","stargazers_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/stargazers","contributors_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/contributors","subscribers_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/subscribers","subscription_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/subscription","commits_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/commits{/sha}","git_commits_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/git/commits{/sha}","comments_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/comments{/number}","issue_comment_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/issues/comments{/number}","contents_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/contents/{+path}","compare_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/merges","archive_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/downloads","issues_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/issues{/number}","pulls_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls{/number}","milestones_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/milestones{/number}","notifications_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/labels{/name}","releases_url":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/releases{/id}","created_at":"2015-10-06T02:54:37Z","updated_at":"2015-10-06T06:16:07Z","pushed_at":"2015-10-08T01:46:52Z","git_url":"git://github.com/crunchersaspire/worshipsongs-importer.git","ssh_url":"git@github.com:crunchersaspire/worshipsongs-importer.git","clone_url":"https://github.com/crunchersaspire/worshipsongs-importer.git","svn_url":"https://github.com/crunchersaspire/worshipsongs-importer","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4"},"html":{"href":"https://github.com/crunchersaspire/worshipsongs-importer/pull/4"},"issue":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/issues/4"},"comments":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/crunchersaspire/worshipsongs-importer/statuses/bd2d033dc7c9c04912596e6a79eed63c2f3d2607"}}}}