Changeset 28283 for main/trunk/greenstone3/src/java/org/greenstone
- Timestamp:
- 2013-09-13T17:02:24+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
r28179 r28283 92 92 public static final String INDEX_STEM_ELEM = "indexStem"; 93 93 public static final String INDEX_OPTION_ELEM = "indexOption"; 94 94 public static final String PARAM_DEFAULT_ELEM = "paramDefault"; 95 95 public static final String BROWSE_ELEM = "browse"; 96 96 public static final String DISPLAY_ELEM = "display"; … … 1341 1341 } 1342 1342 } 1343 NodeList children = e.getChildNodes(); 1344 1343 1344 if (e.hasChildNodes()) 1345 { 1346 boolean hasElements = false; 1347 boolean indentSwapped = false; 1348 1349 Node child = e.getFirstChild(); 1350 do 1351 { 1352 if (child.getNodeType() == Node.ELEMENT_NODE) 1353 { 1354 hasElements = true; 1355 } 1356 if (child.getNodeType() == Node.TEXT_NODE && indent) 1357 { 1358 if (child.getNodeValue() != null && child.getNodeValue().trim().length() > 0) 1359 { 1360 indentSwapped = true; 1361 indent = false; 1362 } 1363 } 1364 } while ((child = child.getNextSibling()) != null); 1365 1366 sb.append(">"); 1367 if (hasElements && indent) 1368 { 1369 sb.append("\n"); 1370 } 1371 1372 child = e.getFirstChild(); 1373 do 1374 { 1375 xmlNodeToString(sb, child, indent, indentString, depth + 1); 1376 } while ((child = child.getNextSibling()) != null); 1377 1378 if (indent) 1379 { 1380 for (int i = 0; i < depth; i++) 1381 { 1382 sb.append(indentString); 1383 } 1384 } 1385 1386 sb.append("</" + e.getNodeName() + ">"); 1387 1388 if ((hasElements && indent) || indentSwapped) 1389 { 1390 sb.append("\n"); 1391 } 1392 } 1393 else 1394 { 1395 sb.append("/>"); 1396 1397 if (indent) 1398 { 1399 sb.append("\n"); 1400 } 1401 } 1402 1403 /* 1345 1404 boolean hasElements = false; 1346 1405 boolean indentSwapped = false; … … 1399 1458 } 1400 1459 } 1460 */ 1401 1461 } 1402 1462
Note:
See TracChangeset
for help on using the changeset viewer.