Skip to content

Commit b528970

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

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
@@ -959,13 +959,12 @@ public void doPost(final DBBroker broker, final Txn transaction, final HttpServl
959959
}
960960

961961
final XUpdateProcessor processor = new XUpdateProcessor(broker, docs);
962+
root.toSAX(broker, processor, new Properties());
963+
final List<Modification> modifications = processor.getModifications();
962964
long mods = 0;
963-
try(final Reader reader = new StringReader(content)) {
964-
final Modification modifications[] = processor.parse(new InputSource(reader));
965-
for (Modification modification : modifications) {
966-
mods += modification.process(transaction);
967-
broker.flush();
968-
}
965+
for (final Modification modification : modifications) {
966+
mods += modification.process(transaction);
967+
broker.flush();
969968
}
970969

971970
// FD : Returns an XML doc

0 commit comments

Comments
 (0)