public String toXML() { StringBuilder xmlStrbui = new StringBuilder(); xmlStrbui.append(header.toXML(stringSection, resourceSection, 0)).append('\n'); 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()) { xmlStrbui.append(chunk.toXML(stringSection, resourceSection, indents)).append('\n'); } else { xmlStrbui.append(appendNameSpace(chunk.toXML(stringSection, resourceSection, indents), namespaceXmlList)).append('\n'); namespaceXmlList.clear(); } } if (chunk.getChunkType() == ChunkType.START_TAG) { indents++; } } return xmlStrbui.toString(); }
public String toXML() { StringBuilder xmlStrbui = new StringBuilder(); xmlStrbui.append(header.toXML(stringSection, resourceSection, 0)).append('\n'); 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()) { xmlStrbui.append(chunk.toXML(stringSection, resourceSection, indents)).append('\n'); } else { xmlStrbui.append(appendNameSpace(chunk.toXML(stringSection, resourceSection, indents), namespaceXmlList)).append('\n'); namespaceXmlList.clear(); } } if (chunk.getChunkType() == ChunkType.START_TAG) { indents++; } } return xmlStrbui.toString(); }
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++; } } }