Package com.yahoo.vespaxmlparser
Class VespaXMLFeedReader
- java.lang.Object
-
- com.yahoo.vespaxmlparser.VespaXMLReader
-
- com.yahoo.vespaxmlparser.VespaXMLFeedReader
-
- All Implemented Interfaces:
FeedReader
public class VespaXMLFeedReader extends VespaXMLReader implements FeedReader
XML parser for Vespa document XML. Parses an entire document "feed", which consists of a vespafeed element containing zero or more instances of documents, updates or removes. Standard usage is to create an Operation object and call read(Operation) until operation.getType() returns OperationType.INVALID. If you are looking to parse only a single document or update, use VespaXMLDocumentReader or VespaXMLUpdateReader respectively.
-
-
Constructor Summary
Constructors Constructor Description VespaXMLFeedReader(InputStream stream, DocumentTypeManager docTypeManager)
Creates a reader that reads from the given stream.VespaXMLFeedReader(String fileName, DocumentTypeManager docTypeManager)
Creates a reader that reads from the given file.VespaXMLFeedReader(XMLStreamReader reader, DocumentTypeManager manager)
Creates a reader that uses the given reader to read - this can be used if the vespa feed is part of a larger XML document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FeedOperation
read()
Reads the next operation from the stream.List<FeedOperation>
readAll()
Reads all operations from the XML stream and puts into a list.-
Methods inherited from class com.yahoo.vespaxmlparser.VespaXMLReader
isBase64EncodedElement, isBase64EncodingAttribute, newDeserializeException, newException, skipToEnd
-
-
-
-
Constructor Detail
-
VespaXMLFeedReader
public VespaXMLFeedReader(String fileName, DocumentTypeManager docTypeManager) throws Exception
Creates a reader that reads from the given file.- Throws:
Exception
-
VespaXMLFeedReader
public VespaXMLFeedReader(InputStream stream, DocumentTypeManager docTypeManager) throws Exception
Creates a reader that reads from the given stream.- Throws:
Exception
-
VespaXMLFeedReader
public VespaXMLFeedReader(XMLStreamReader reader, DocumentTypeManager manager) throws Exception
Creates a reader that uses the given reader to read - this can be used if the vespa feed is part of a larger XML document.- Throws:
Exception
-
-
Method Detail
-
readAll
public List<FeedOperation> readAll() throws Exception
Reads all operations from the XML stream and puts into a list. Note that if the XML stream is large, this may cause out of memory errors, so make sure to use this only with small streams.
- Returns:
- The list of all read operations.
- Throws:
Exception
-
read
public FeedOperation read() throws Exception
Description copied from interface:FeedReader
Reads the next operation from the stream.- Specified by:
read
in interfaceFeedReader
- Returns:
- operation, possibly invalid if none was found.
- Throws:
Exception
-
-