Skip to content

Commit

Permalink
Merge pull request #86 from assimbly/191-split---xml-aggregate---remo…
Browse files Browse the repository at this point in the history
…ve-duplicated-xml-declaration

XmlAggregateStrategy - removes xml declaration from splitXml
  • Loading branch information
skin27 authored Apr 9, 2024
2 parents a9e061b + c27584d commit e8b4139
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public Exchange aggregate(Exchange newExchange, Exchange splitExchange) {

private String buildAggregateBody(String newXml, String splitXml) {
String result = "";

if(splitXml.indexOf("?>") != -1) {
// removes xml declaration from splitXml
int declarationEndPos = splitXml.indexOf("?>");
splitXml = splitXml.substring(declarationEndPos + 2);
}

if(newXml.endsWith(AGGREGATE_END_TAG)) {
result = StringUtils.substring(newXml, 0, newXml.length() - AGGREGATE_END_TAG.length()) + splitXml + AGGREGATE_END_TAG;
} else {
Expand Down

0 comments on commit e8b4139

Please sign in to comment.