We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 356d616 commit c03290dCopy full SHA for c03290d
1 file changed
verkeersdrukte/src/main/java/nl/bertriksikken/datex2/XmlUtil.java
@@ -3,17 +3,20 @@
3
import com.fasterxml.jackson.core.JsonParser;
4
import com.fasterxml.jackson.core.JsonStreamContext;
5
6
+import java.util.ArrayDeque;
7
+import java.util.Deque;
8
+
9
public final class XmlUtil {
10
11
public static String getPath(JsonParser parser) {
- StringBuilder path = new StringBuilder();
12
+ Deque<String> parts = new ArrayDeque<>();
13
for (JsonStreamContext ctx = parser.getParsingContext(); ctx != null; ctx = ctx.getParent()) {
14
String name = ctx.getCurrentName();
15
if (name != null) {
- path.insert(0, "/" + name);
16
+ parts.push(name);
17
}
18
- return path.toString();
19
+ return "/" + String.join("/", parts);
20
21
22
0 commit comments