Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void updateCore(ConditionHandler conditionTaker, ArrayList<String> orderedValues,
- ArrayList<String> orderedNames, String tableName) throws JDOMException, IOException {
- String fileWithExtension = tableName + ".xml";
- SAXBuilder saxBuilder = new SAXBuilder();
- Document document = saxBuilder.build(new File("./DBMS Workspace/" + dbName + "/" + fileWithExtension));
- DocType docType = document.getDocType();
- docType.setInternalSubset(dtd);
- Element rootElement = document.getRootElement();
- List<Element> rows = rootElement.getChildren("row");
- for (int i = 0; i < rows.size(); i++) {
- Element row = rows.get(i);
- String conditionColumnName = conditionTaker.getColumnName();
- Integer conditionColumnNameInt = null;
- String toBeEvaluated = null;
- if(conditionColumnName != null){
- toBeEvaluated = row.getChild(conditionTaker.getColumnName()).getValue();
- conditionColumnNameInt = tableData.get(conditionColumnName);
- }
- if (conditionTaker.evaluateCondition(toBeEvaluated, conditionColumnNameInt)) {
- for (int j = 0; j < orderedNames.size(); ++j) {
- String adjustdate = removeQuotes(orderedValues.get(j), orderedNames.get(j));
- row.getChild(orderedNames.get(j)).setText(adjustdate);
- }
- }
- }
- writingAfterModification(document, fileWithExtension);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement