public void print() { log("%s", header.toXML(stringSection, resourceSection, 0)); Iterator<Chunk> iterator = chunks.iterator(); int indents = 0; List<String> namespaceXmlList = new ArrayList<String>(); while (iterator.hasNext()) { Chunk chunk = iterator.next(); if (chunk.getChunkType() == ChunkType.END_TAG) { indents--; } if (chunk.getChunkType() == ChunkType.START_NAMESPACE) { namespaceXmlList.add(chunk.toXML(stringSection, resourceSection, indents)); } else if (chunk.getChunkType() == ChunkType.END_NAMESPACE) { // ignore } else { if (namespaceXmlList.isEmpty()) { log("%s", chunk.toXML(stringSection, resourceSection, indents)); } else { log("%s", appendNameSpace(chunk.toXML(stringSection, resourceSection, indents), namespaceXmlList)); namespaceXmlList.clear(); } } if (chunk.getChunkType() == ChunkType.START_TAG) { indents++; } } }
public void print() { log("%s", header.toXML(stringSection, resourceSection, 0)); Iterator<Chunk> iterator = chunks.iterator(); int indents = 0; List<String> namespaceXmlList = new ArrayList<String>(); while (iterator.hasNext()) { Chunk chunk = iterator.next(); if (chunk.getChunkType() == ChunkType.END_TAG) { indents--; } if (chunk.getChunkType() == ChunkType.START_NAMESPACE) { namespaceXmlList.add(chunk.toXML(stringSection, resourceSection, indents)); } else if (chunk.getChunkType() == ChunkType.END_NAMESPACE) { // ignore } else { if (namespaceXmlList.isEmpty()) { log("%s", chunk.toXML(stringSection, resourceSection, indents)); } else { log("%s", appendNameSpace(chunk.toXML(stringSection, resourceSection, indents), namespaceXmlList)); namespaceXmlList.clear(); } } if (chunk.getChunkType() == ChunkType.START_TAG) { indents++; } } }