Skip to content

Commit fc6a4e7

Browse files
committed
[optimise] XUpdate document only needs to be parsed once and not twice
1 parent f732b53 commit fc6a4e7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

exist-core/src/main/java/org/exist/http/RESTServer.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,12 @@ public void doPost(final DBBroker broker, final Txn transaction, final HttpServl
936936
}
937937

938938
final XUpdateProcessor processor = new XUpdateProcessor(broker, docs);
939+
root.toSAX(broker, processor, new Properties());
940+
final List<Modification> modifications = processor.getModifications();
939941
long mods = 0;
940-
try(final Reader reader = new StringReader(content)) {
941-
final Modification modifications[] = processor.parse(new InputSource(reader));
942-
for (Modification modification : modifications) {
943-
mods += modification.process(transaction);
944-
broker.flush();
945-
}
942+
for (final Modification modification : modifications) {
943+
mods += modification.process(transaction);
944+
broker.flush();
946945
}
947946

948947
// FD : Returns an XML doc

0 commit comments

Comments
 (0)