fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String xml = "<!-- SourcingCandidate !![XS]:<ADPRMSourcingCand version=\"1\" entityClass=\"com.airs.portal.entities.SourcingCandidate\">\n" +
  13. " <entityattrs>\n" +
  14. " <attributes>\n" +
  15. " <entry>\n" +
  16. " <string>workStatus</string>\n" +
  17. " <string></string>\n" +
  18. " </entry>\n" +
  19. " <entry>\n" +
  20. " <string>zip</string>\n" +
  21. " <string>33525</string>\n" +
  22. " </entry>\n" +
  23. " </attributes>\n" +
  24. " <errors/>\n" +
  25. " <extras/>\n" +
  26. " <identification>\n" +
  27. " <entry>\n" +
  28. " <string>id</string>\n" +
  29. " <string>2014316289410</string>\n" +
  30. " </entry>\n" +
  31. " </identification>\n" +
  32. " <deltas/>\n" +
  33. " <nullAttributes/>\n" +
  34. " <dbid>portal</dbid>\n" +
  35. " <table>SourcingCandidate$$007</table>\n" +
  36. " <className>SourcingCandidate</className>\n" +
  37. " <db>portal.007</db>\n" +
  38. " <dirty>false</dirty>\n" +
  39. " <error>false</error>\n" +
  40. " <found>true</found>\n" +
  41. " <doInstanceSearch>true</doInstanceSearch>\n" +
  42. " <doLastInsertID>true</doLastInsertID>\n" +
  43. " <doConflictFreeInsert>false</doConflictFreeInsert>\n" +
  44. " <doLastCount>false</doLastCount>\n" +
  45. " <doSQLLogging>true</doSQLLogging>\n" +
  46. " <doSQLLoggingTemp>true</doSQLLoggingTemp>\n" +
  47. " <doTouchReferents>true</doTouchReferents>\n" +
  48. " <wasTimedOut>false</wasTimedOut>\n" +
  49. " <lastInsertID>2014316289410</lastInsertID>\n" +
  50. " <lastCount>0</lastCount>\n" +
  51. " <sqlTimeout>0</sqlTimeout>\n" +
  52. " </entityattrs>\n" +
  53. "</ADPRMSourcingCand> -->";
  54. int contactStart = xml.indexOf("<!-- SourcingCandidate ");
  55. contactStart = contactStart + "<!-- SourcingCandidate ".length();
  56. int contactEnd = xml.indexOf(" -->", contactStart);
  57. String serialized = xml.substring(contactStart, contactEnd);
  58. System.out.println(serialized);
  59. }
  60. }
Success #stdin #stdout 0.07s 2841600KB
stdin
Standard input is empty
stdout
!![XS]:<ADPRMSourcingCand version="1" entityClass="com.airs.portal.entities.SourcingCandidate">
  <entityattrs>
    <attributes>
      <entry>
        <string>workStatus</string>
        <string></string>
      </entry>
      <entry>
        <string>zip</string>
        <string>33525</string>
      </entry>
    </attributes>
    <errors/>
    <extras/>
    <identification>
      <entry>
        <string>id</string>
        <string>2014316289410</string>
      </entry>
    </identification>
    <deltas/>
    <nullAttributes/>
    <dbid>portal</dbid>
    <table>SourcingCandidate$$007</table>
    <className>SourcingCandidate</className>
    <db>portal.007</db>
    <dirty>false</dirty>
    <error>false</error>
    <found>true</found>
    <doInstanceSearch>true</doInstanceSearch>
    <doLastInsertID>true</doLastInsertID>
    <doConflictFreeInsert>false</doConflictFreeInsert>
    <doLastCount>false</doLastCount>
    <doSQLLogging>true</doSQLLogging>
    <doSQLLoggingTemp>true</doSQLLoggingTemp>
    <doTouchReferents>true</doTouchReferents>
    <wasTimedOut>false</wasTimedOut>
    <lastInsertID>2014316289410</lastInsertID>
    <lastCount>0</lastCount>
    <sqlTimeout>0</sqlTimeout>
  </entityattrs>
</ADPRMSourcingCand>