Skip to content

Commit 44d979a

Browse files
committed
Added getHead() and getTail() to Element
1 parent e4509cb commit 44d979a

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Features in development:
1616

1717
## Building
1818

19-
You need Java 17 and [Apache Ant 1.10.12](https://ant.apache.org) or newer
19+
You need Java 21 and [Apache Ant 1.10.14](https://ant.apache.org) or newer
2020

21-
- Point your JAVA_HOME variable to JDK 17
21+
- Point your JAVA_HOME variable to JDK 21
2222
- Checkout this repository
2323
- Run `ant` to compile the source code
2424

lib/xmljava.jar

63 Bytes
Binary file not shown.

src/com/maxprograms/xml/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
public class Constants {
1616

17-
public static final String VERSION = "1.4.0";
18-
public static final String BUILD = "20231113_1047";
17+
public static final String VERSION = "1.5.0";
18+
public static final String BUILD = "20231229_1000";
1919
}

src/com/maxprograms/xml/Element.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,25 @@ public void setText(String text) {
334334
content.add(new TextNode(text));
335335
}
336336

337+
public String getHead() {
338+
StringBuilder result = new StringBuilder("<" + name);
339+
List<String> keys = new Vector<>();
340+
keys.addAll(attsTable.keySet());
341+
Collections.sort(keys);
342+
Iterator<String> it = keys.iterator();
343+
while (it.hasNext()) {
344+
Attribute a = attsTable.get(it.next());
345+
result.append(' ');
346+
result.append(a.toString());
347+
}
348+
result.append(">");
349+
return result.toString();
350+
}
351+
352+
public String getTail() {
353+
return "</" + name + ">";
354+
}
355+
337356
@Override
338357
public String toString() {
339358
StringBuilder result = new StringBuilder("<" + name);

0 commit comments

Comments
 (0)