Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. private void updateCore(ConditionHandler conditionTaker, ArrayList<String> orderedValues,
  2. ArrayList<String> orderedNames, String tableName) throws JDOMException, IOException {
  3. String fileWithExtension = tableName + ".xml";
  4. SAXBuilder saxBuilder = new SAXBuilder();
  5. Document document = saxBuilder.build(new File("./DBMS Workspace/" + dbName + "/" + fileWithExtension));
  6. DocType docType = document.getDocType();
  7. docType.setInternalSubset(dtd);
  8. Element rootElement = document.getRootElement();
  9. List<Element> rows = rootElement.getChildren("row");
  10. for (int i = 0; i < rows.size(); i++) {
  11. Element row = rows.get(i);
  12. String conditionColumnName = conditionTaker.getColumnName();
  13. Integer conditionColumnNameInt = null;
  14. String toBeEvaluated = null;
  15. if(conditionColumnName != null){
  16. toBeEvaluated = row.getChild(conditionTaker.getColumnName()).getValue();
  17. conditionColumnNameInt = tableData.get(conditionColumnName);
  18. }
  19.  
  20. if (conditionTaker.evaluateCondition(toBeEvaluated, conditionColumnNameInt)) {
  21. for (int j = 0; j < orderedNames.size(); ++j) {
  22. String adjustdate = removeQuotes(orderedValues.get(j), orderedNames.get(j));
  23. row.getChild(orderedNames.get(j)).setText(adjustdate);
  24. }
  25. }
  26. }
  27. writingAfterModification(document, fileWithExtension);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement