Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In light of the lack of answers, I ended up going with my own suggested approach, which</p> <ol> <li>Reads the .xml file</li> <li>Regex's out the table name</li> <li>Truncates the table name if it's over 30 characters</li> <li>Appends the (potentially modified) line to a StringBuilder</li> <li>Feeds that StringBuilder into a ByteArrayInputStream, suitable for passing into a DataSetBuilder</li> </ol> <hr> <pre><code>public InputStream oracleWorkaroundStream(String fileName) throws IOException { String ls = System.getProperty("line.separator"); // This pattern isolates the table name from the rest of the line Pattern pattern = Pattern.compile("(\\s*&lt;)(\\w+)(.*/&gt;)"); FileInputStream fis = new FileInputStream(fileName); // Use a StringBuidler for better performance over repeated concatenation StringBuilder sb = new StringBuilder(fis.available()*2); InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); BufferedReader buff = new BufferedReader(isr); while (buff.ready()) { // Read a line from the source xml file String line = buff.readLine(); Matcher matcher = pattern.matcher(line); // See if the line contains a table name if (matcher.matches()) { String tableName = matcher.group(2); if (tableName.length() &gt; 30) { tableName = tableName.substring(0, 30); } // Append the (potentially modified) line sb.append(matcher.group(1)); sb.append(tableName); sb.append(matcher.group(3)); } else { // Some lines don't have tables names (&lt;dataset&gt;, &lt;?xml?&gt;, etc.) sb.append(line); } sb.append(ls); } return new ByteArrayInputStream(sb.toString().getBytes("UTF-8")); } </code></pre> <p>EDIT: Swtiched to StringBuilder from repeated String concatenation, which gives a huge performance boost</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload