8#ifndef INCLUDED_BALXML_MINIREADER
9#define INCLUDED_BALXML_MINIREADER
314#include <balscm_version.h>
325#include <bsl_cstring.h>
326#include <bsl_cstddef.h>
327#include <bsl_cstdlib.h>
328#include <bsl_fstream.h>
329#include <bsl_string.h>
330#include <bsl_vector.h>
348 k_MIN_BUFSIZE = 1024,
349 k_MAX_BUFSIZE = 1024 * 128,
350 k_DEFAULT_BUFSIZE = 1024 * 8,
361 k_NODE_NO_FLAGS = 0x0000,
362 k_NODE_EMPTY = 0x0001
366 const char *d_qualifiedName;
367 const char *d_prefix;
368 const char *d_localName;
371 const char *d_namespaceUri;
373 AttributeVector d_attributes;
375 size_t d_namespaceCount;
383 void swap(Node& other);
384 void addAttribute(
const Attribute& attr);
401 FLG_READ_EOF = 0x0001,
402 FLG_ROOT_CLOSED = 0x0002
410 e_STRINGTYPE_COMMENT,
412 e_STRINGTYPE_START_ELEMENT,
413 e_STRINGTYPE_END_ELEMENT
425 bsl::ifstream d_stream;
426 bsl::streambuf *d_streamBuf;
427 const char * d_memStream;
446 ErrorInfo d_errorInfo;
449 NamespaceRegistry d_ownNamespaces;
450 PrefixStack d_ownPrefixes;
451 PrefixStack *d_prefixes;
454 size_t d_activeNodesCount;
455 ElementVector d_activeNodes;
461 unsigned int d_options;
465 MiniReader(
const MiniReader&);
466 MiniReader& operator=(
const MiniReader&);
470 const Node& currentNode()
const;
474 int setParseError(
const char *errText,
475 const char *startFragment,
476 const char *endFragment);
481 const bsl::string& findNamespace(
const char *prefix)
const;
486 void pushElementName();
489 int updateAttributes();
490 int updateElementInfo();
495 int scanAttributes();
497 int scanEndElementRaw();
499 int scanEndElement();
500 int scanExclaimConstruct();
502 int scanProcessingInstruction();
503 int scanStartElement();
512 StringType searchCommentCDataOrEndElementName(
const bsl::string& name);
520 StringType searchElementName(
const bsl::string& name);
523 const char *rebasePointer(
const char *ptr,
const char *newBase);
524 void rebasePointers(
const char *newBase,
size_t newLength);
527 int doOpen(
const char *url,
const char *encoding);
536 int readAtLeast(bsl::ptrdiff_t number);
549 int getCharAndSet(
char ch);
553 bool checkForNewLine();
564 int scanForSymbol(
char symbol);
566 int scanForSymbolOrSpace(
char symbol1,
char symbol2);
572 int scanForSymbolOrSpace(
char symbol);
578 int scanForString(
const char * str);
584 bool skipIfMatch(
const char *str);
784 const
char *localName,
785 const
char *namespaceUri) const
797 const
char *localName,
798 int namespaceId) const
952 return d_currentNode;
956const MiniReader::Node& MiniReader::currentNode()
const
958 return d_currentNode;
962int MiniReader::peekChar()
964 if (d_scanPtr >= d_endPtr) {
965 if (readInput() == 0) {
974int MiniReader::getChar()
976 if (d_scanPtr >= d_endPtr) {
977 if (readInput() == 0) {
985bool MiniReader::checkForNewLine()
987 if (*d_scanPtr ==
'\n') {
998int MiniReader::getCharAndSet(
char ch)
1002 int rc = peekChar();
1012const char *MiniReader::rebasePointer(
const char *ptr,
const char *newBase)
1014 if (ptr && ptr >= d_markPtr && ptr <= d_endPtr) {
1015 return newBase + (ptr - d_markPtr);
1023 return static_cast<int>(d_streamOffset + (d_scanPtr - d_startPtr));
1029 return currentNode().d_startPos;
1035 return currentNode().d_endPos;
Definition balxml_elementattribute.h:289
Definition balxml_errorinfo.h:353
Severity
Definition balxml_errorinfo.h:358
Definition balxml_minireader.h:343
~MiniReader() BSLS_KEYWORD_OVERRIDE
int advanceToNextNode() BSLS_KEYWORD_OVERRIDE
bool nodeHasValue() const BSLS_KEYWORD_OVERRIDE
Return true if the current node has a value and false otherwise.
void close() BSLS_KEYWORD_OVERRIDE
int open(const char *filename, const char *encoding=0) BSLS_KEYWORD_OVERRIDE
int getCurrentPosition() const
Definition balxml_minireader.h:1021
const char * nodeValue() const BSLS_KEYWORD_OVERRIDE
unsigned int options() const BSLS_KEYWORD_OVERRIDE
Return the option flags.
const char * documentEncoding() const BSLS_KEYWORD_OVERRIDE
NodeType nodeType() const BSLS_KEYWORD_OVERRIDE
XmlResolverFunctor resolver() const BSLS_KEYWORD_OVERRIDE
Return the external XML resource resolver.
const char * nodePrefix() const BSLS_KEYWORD_OVERRIDE
virtual int advanceToEndNodeRaw()
const char * nodeBaseUri() const BSLS_KEYWORD_OVERRIDE
const char * nodeNamespaceUri() const BSLS_KEYWORD_OVERRIDE
const ErrorInfo & errorInfo() const BSLS_KEYWORD_OVERRIDE
int getColumnNumber() const BSLS_KEYWORD_OVERRIDE
const char * nodeName() const BSLS_KEYWORD_OVERRIDE
friend struct Node
Definition balxml_minireader.h:358
int nodeDepth() const BSLS_KEYWORD_OVERRIDE
int nodeNamespaceId() const BSLS_KEYWORD_OVERRIDE
const char * nodeLocalName() const BSLS_KEYWORD_OVERRIDE
void setResolver(XmlResolverFunctor resolver) BSLS_KEYWORD_OVERRIDE
void setPrefixStack(PrefixStack *prefixes) BSLS_KEYWORD_OVERRIDE
virtual int advanceToEndNode()
int nodeEndPosition() const
Definition balxml_minireader.h:1033
int numAttributes() const BSLS_KEYWORD_OVERRIDE
bool isOpen() const BSLS_KEYWORD_OVERRIDE
int lookupAttribute(ElementAttribute *attribute, int index) const BSLS_KEYWORD_OVERRIDE
virtual int advanceToEndNodeRawBare()
int getLineNumber() const BSLS_KEYWORD_OVERRIDE
int nodeStartPosition() const
Definition balxml_minireader.h:1027
bool isEmptyElement() const BSLS_KEYWORD_OVERRIDE
void setOptions(unsigned int flags) BSLS_KEYWORD_OVERRIDE
PrefixStack * prefixStack() const BSLS_KEYWORD_OVERRIDE
Definition balxml_prefixstack.h:137
Definition balxml_reader.h:835
bsl::function< StreamBufPtr(const char *location, const char *namespaceUri)> XmlResolverFunctor
Definition balxml_reader.h:920
NodeType
Definition balxml_reader.h:839
Definition bslstl_string.h:1281
Forward declaration.
Definition bslstl_function.h:934
Definition bslstl_pair.h:1210
Definition bslstl_vector.h:1025
Definition bslma_allocator.h:457
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_OVERRIDE
Definition bsls_keyword.h:653
Definition balxml_base64parser.h:150
Definition bdlb_printmethods.h:283
Definition balxml_encoderoptions.h:68