Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HF: dev-107.2.1 → dev-107.3.0 #2056

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions src/main/java/sirius/biz/jobs/batch/file/XMLImportJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import sirius.kernel.commons.Strings;
import sirius.kernel.di.std.Part;
import sirius.kernel.health.Exceptions;
import sirius.kernel.xml.NoContentNodeHandler;
import sirius.kernel.xml.NodeHandler;
import sirius.kernel.xml.StructuredNode;
import sirius.kernel.xml.XMLReader;
import sirius.web.resources.Resource;
import sirius.web.resources.Resources;
Expand Down Expand Up @@ -126,15 +128,28 @@ protected Resource getXsdResource() throws Exception {
protected void executeProcessingStage(InputStream in, Consumer<BiConsumer<String, NodeHandler>> stage)
throws Exception {
XMLReader reader = new XMLReader();
stage.accept((name, originalHandler) -> {
reader.addHandler(name, structuredNode -> {
if (importer.getContext().getEventDispatcher().isActive()) {
AfterNodeLoadEvent event = new AfterNodeLoadEvent(structuredNode, importer.getContext());
importer.getContext().getEventDispatcher().handleEvent(event);
if (importer.getContext().getEventDispatcher().isActive()) {
stage.accept((name, originalHandler) -> {
if (originalHandler.ignoreContent()) {
reader.addHandler(name, new NoContentNodeHandler() {
@Override
public void process(StructuredNode node) {
AfterNodeLoadEvent event = new AfterNodeLoadEvent(node, importer.getContext());
importer.getContext().getEventDispatcher().handleEvent(event);
originalHandler.process(node);
}
});
} else {
reader.addHandler(name, node -> {
AfterNodeLoadEvent event = new AfterNodeLoadEvent(node, importer.getContext());
importer.getContext().getEventDispatcher().handleEvent(event);
originalHandler.process(node);
});
}
originalHandler.process(structuredNode);
});
});
} else {
stage.accept(reader::addHandler);
}
reader.parse(in, this::resolveResource);
}

Expand Down
Loading