Skip to content

Commit 1e671a6

Browse files
committed
Fixed content model
1 parent 8554ac9 commit 1e671a6

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

lib/xmljava.jar

80 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
@@ -24,8 +24,8 @@
2424

2525
public class Constants {
2626

27-
public static final String VERSION = "3.0.0";
28-
public static final String BUILD = "20251014_1235";
27+
public static final String VERSION = "3.1.0";
28+
public static final String BUILD = "20251014_2111";
2929

3030
private Constants() {
3131
// private for security

src/com/maxprograms/xml/ContentModel.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,39 @@ else if (c == ')')
187187

188188
@Override
189189
public String toString() {
190+
if (type.equals(EMPTY)) {
191+
return EMPTY;
192+
}
193+
if (type.equals(ANY)) {
194+
return ANY;
195+
}
196+
if (content.isEmpty()) {
197+
return "";
198+
}
199+
190200
StringBuilder sb = new StringBuilder();
191-
String separator = type.equals("|") ? "|" : ",";
201+
202+
// For MIXED content, handle specially
203+
if (type.equals(MIXED)) {
204+
sb.append("(");
205+
for (int i = 0; i < content.size(); i++) {
206+
ContentParticle particle = content.get(i);
207+
sb.append(particle.toString());
208+
if (i < content.size() - 1) {
209+
sb.append("|");
210+
}
211+
}
212+
sb.append(")*");
213+
return sb.toString();
214+
}
215+
216+
// For CHILDREN content, the particles themselves determine the structure
192217
for (int i = 0; i < content.size(); i++) {
193218
ContentParticle particle = content.get(i);
194219
sb.append(particle.toString());
195220
if (i < content.size() - 1) {
196-
sb.append(separator);
221+
// This should not happen as CHILDREN content typically has a single root particle
222+
sb.append(",");
197223
}
198224
}
199225
return sb.toString();

0 commit comments

Comments
 (0)