org.n52.security.common.xml
Class XMLChunkIterator

java.lang.Object
  extended by org.n52.security.common.xml.XMLChunkIterator
All Implemented Interfaces:
Iterator<XMLChunk>

public class XMLChunkIterator
extends Object
implements Iterator<XMLChunk>

Iterates over chunks of xml. Because this iterator supports nested chunks, each chunk is returned twice. First a "start" chunk, if the start element of a chunk is seen. Second a "end" chunk, if the end element of a chunk is seen, only here the content is given. If a chunk contains nested chunks, then the content of the nested chunks is not embedded in the "parent" chunk. When an element is a start/end of a chunk is open to XMLChunkIterator.QNameMatcher implementations. The default way is to specify element QNames. Please note that the iterator updates the content of the Parent-Chunks if a nested chunk is visited. Simple use the XMLChunk.getParent() method to get an updated parent.


Nested Class Summary
static class XMLChunkIterator.QNameMatcher
          Matches an element path, if the last element in the path matches a given qname.
 
Constructor Summary
XMLChunkIterator(InputSource source, Iterable<org.n52.security.common.xml.XMLChunkIterator.Matcher> elementMatcher)
           
XMLChunkIterator(InputSource source, QName... chunkStartElements)
           
XMLChunkIterator(InputSource source, org.n52.security.common.xml.XMLChunkIterator.Matcher... elementMatcher)
           
 
Method Summary
 boolean hasNext()
           
 XMLChunk next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLChunkIterator

public XMLChunkIterator(InputSource source,
                        Iterable<org.n52.security.common.xml.XMLChunkIterator.Matcher> elementMatcher)

XMLChunkIterator

public XMLChunkIterator(InputSource source,
                        org.n52.security.common.xml.XMLChunkIterator.Matcher... elementMatcher)

XMLChunkIterator

public XMLChunkIterator(InputSource source,
                        QName... chunkStartElements)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<XMLChunk>

next

public XMLChunk next()
Specified by:
next in interface Iterator<XMLChunk>

remove

public void remove()
Specified by:
remove in interface Iterator<XMLChunk>


Copyright © 2004–2013 52north.org. All rights reserved.