|
| BSLMF_NESTED_TRAIT_DECLARATION (Utf8ReaderWrapper, bslma::UsesBslmaAllocator) |
|
| Utf8ReaderWrapper (Reader *reader, bslma::Allocator *basicAllocator=0) |
|
| ~Utf8ReaderWrapper () BSLS_KEYWORD_OVERRIDE |
| Close the held reader and destroy this object.
|
|
void | setOptions (unsigned int flags) BSLS_KEYWORD_OVERRIDE |
|
void | setPrefixStack (PrefixStack *prefixes) BSLS_KEYWORD_OVERRIDE |
|
void | setResolver (XmlResolverFunctor resolver) BSLS_KEYWORD_OVERRIDE |
|
int | open (const char *filename, const char *encoding=0) BSLS_KEYWORD_OVERRIDE |
|
int | open (const char *buffer, bsl::size_t size, const char *url=0, const char *encoding=0) BSLS_KEYWORD_OVERRIDE |
|
int | open (bsl::streambuf *stream, const char *url=0, const char *encoding=0) BSLS_KEYWORD_OVERRIDE |
|
void | close () BSLS_KEYWORD_OVERRIDE |
|
int | advanceToNextNode () BSLS_KEYWORD_OVERRIDE |
|
bslma::Allocator * | allocator () const |
| Return the allocator used by this object to allocate memory.
|
|
const char * | documentEncoding () const BSLS_KEYWORD_OVERRIDE |
|
const ErrorInfo & | errorInfo () const BSLS_KEYWORD_OVERRIDE |
|
int | getColumnNumber () const BSLS_KEYWORD_OVERRIDE |
|
int | getLineNumber () const BSLS_KEYWORD_OVERRIDE |
|
bool | isEmptyElement () const BSLS_KEYWORD_OVERRIDE |
|
bool | isOpen () const BSLS_KEYWORD_OVERRIDE |
|
int | lookupAttribute (ElementAttribute *attribute, int index) const BSLS_KEYWORD_OVERRIDE |
|
int | lookupAttribute (ElementAttribute *attribute, const char *qname) const BSLS_KEYWORD_OVERRIDE |
|
int | lookupAttribute (ElementAttribute *attribute, const char *localName, const char *namespaceUri) const BSLS_KEYWORD_OVERRIDE |
|
int | lookupAttribute (ElementAttribute *attribute, const char *localName, int namespaceId) const BSLS_KEYWORD_OVERRIDE |
|
const char * | nodeBaseUri () const BSLS_KEYWORD_OVERRIDE |
|
int | nodeDepth () const BSLS_KEYWORD_OVERRIDE |
|
const char * | nodeLocalName () const BSLS_KEYWORD_OVERRIDE |
|
bool | nodeHasValue () const BSLS_KEYWORD_OVERRIDE |
| Return true if the current node has a value and false otherwise.
|
|
const char * | nodeName () const BSLS_KEYWORD_OVERRIDE |
|
int | nodeNamespaceId () const BSLS_KEYWORD_OVERRIDE |
|
const char * | nodeNamespaceUri () const BSLS_KEYWORD_OVERRIDE |
|
const char * | nodePrefix () const BSLS_KEYWORD_OVERRIDE |
|
NodeType | nodeType () const BSLS_KEYWORD_OVERRIDE |
|
const char * | nodeValue () const BSLS_KEYWORD_OVERRIDE |
|
int | numAttributes () const BSLS_KEYWORD_OVERRIDE |
|
unsigned int | options () const BSLS_KEYWORD_OVERRIDE |
| Return the option flags.
|
|
PrefixStack * | prefixStack () const BSLS_KEYWORD_OVERRIDE |
|
XmlResolverFunctor | resolver () const BSLS_KEYWORD_OVERRIDE |
| Return the external XML resource resolver.
|
|
virtual | ~Reader (void) |
|
void | dumpNode (bsl::ostream &os) const |
|
bool | isFatalError () const |
|
bool | isError () const |
|
bool | isWarning () const |
|
|
enum | NodeType {
e_NODE_TYPE_NONE = 0
, e_NODE_TYPE_ELEMENT = 1
, e_NODE_TYPE_TEXT = 2
, e_NODE_TYPE_CDATA = 3
,
e_NODE_TYPE_ENTITY_REFERENCE = 4
, e_NODE_TYPE_ENTITY = 5
, e_NODE_TYPE_PROCESSING_INSTRUCTION = 6
, e_NODE_TYPE_COMMENT = 7
,
e_NODE_TYPE_DOCUMENT = 8
, e_NODE_TYPE_DOCUMENT_TYPE = 9
, e_NODE_TYPE_DOCUMENT_FRAGMENT = 10
, e_NODE_TYPE_NOTATION = 11
,
e_NODE_TYPE_WHITESPACE = 12
, e_NODE_TYPE_SIGNIFICANT_WHITESPACE = 13
, e_NODE_TYPE_END_ELEMENT = 14
, e_NODE_TYPE_END_ENTITY = 15
,
e_NODE_TYPE_XML_DECLARATION = 16
, BAEXML_NODE_TYPE_NONE = e_NODE_TYPE_NONE
, BAEXML_NODE_TYPE_ELEMENT = e_NODE_TYPE_ELEMENT
, BAEXML_NODE_TYPE_TEXT = e_NODE_TYPE_TEXT
,
BAEXML_NODE_TYPE_CDATA = e_NODE_TYPE_CDATA
, BAEXML_NODE_TYPE_ENTITY_REFERENCE = e_NODE_TYPE_ENTITY_REFERENCE
, BAEXML_NODE_TYPE_ENTITY = e_NODE_TYPE_ENTITY
, BAEXML_NODE_TYPE_PROCESSING_INSTRUCTION
,
BAEXML_NODE_TYPE_COMMENT = e_NODE_TYPE_COMMENT
, BAEXML_NODE_TYPE_DOCUMENT = e_NODE_TYPE_DOCUMENT
, BAEXML_NODE_TYPE_DOCUMENT_TYPE = e_NODE_TYPE_DOCUMENT_TYPE
, BAEXML_NODE_TYPE_DOCUMENT_FRAGMENT = e_NODE_TYPE_DOCUMENT_FRAGMENT
,
BAEXML_NODE_TYPE_NOTATION = e_NODE_TYPE_NOTATION
, BAEXML_NODE_TYPE_WHITESPACE = e_NODE_TYPE_WHITESPACE
, BAEXML_NODE_TYPE_SIGNIFICANT_WHITESPACE
, BAEXML_NODE_TYPE_END_ELEMENT = e_NODE_TYPE_END_ELEMENT
,
BAEXML_NODE_TYPE_END_ENTITY = e_NODE_TYPE_END_ENTITY
, BAEXML_NODE_TYPE_XML_DECLARATION = e_NODE_TYPE_XML_DECLARATION
, NODE_TYPE_NONE = e_NODE_TYPE_NONE
, NODE_TYPE_ELEMENT = e_NODE_TYPE_ELEMENT
,
NODE_TYPE_TEXT = e_NODE_TYPE_TEXT
, NODE_TYPE_CDATA = e_NODE_TYPE_CDATA
, NODE_TYPE_ENTITY_REFERENCE = e_NODE_TYPE_ENTITY_REFERENCE
, NODE_TYPE_ENTITY = e_NODE_TYPE_ENTITY
,
NODE_TYPE_PROCESSING_INSTRUCTION
, NODE_TYPE_COMMENT = e_NODE_TYPE_COMMENT
, NODE_TYPE_DOCUMENT = e_NODE_TYPE_DOCUMENT
, NODE_TYPE_DOCUMENT_TYPE = e_NODE_TYPE_DOCUMENT_TYPE
,
NODE_TYPE_DOCUMENT_FRAGMENT = e_NODE_TYPE_DOCUMENT_FRAGMENT
, NODE_TYPE_NOTATION = e_NODE_TYPE_NOTATION
, NODE_TYPE_WHITESPACE = e_NODE_TYPE_WHITESPACE
, NODE_TYPE_SIGNIFICANT_WHITESPACE
,
NODE_TYPE_END_ELEMENT = e_NODE_TYPE_END_ELEMENT
, NODE_TYPE_END_ENTITY = e_NODE_TYPE_END_ENTITY
, NODE_TYPE_XML_DECLARATION = e_NODE_TYPE_XML_DECLARATION
} |
|
typedef bslma::ManagedPtr< bsl::streambuf > | StreamBufPtr |
|
typedef bsl::function< StreamBufPtr(const char *location, const char *namespaceUri)> | XmlResolverFunctor |
|
static const char * | nodeTypeAsString (NodeType nodeType) |
|
This class "has a" pointer to a held and wrapped Reader
object, and operations on this object are passed to the held reader. The held reader is passed a Utf8CheckingInStreamBufWrapper
, which holds and wraps a normal streambuf
. The Utf8CheckingInStreamBufWrapper
checks input for invalid UTF-8, and if it detects any, makes the diagnosis of the problem available through the errorInfo
accessor.
See balxml_utf8readerwrapper
int balxml::Utf8ReaderWrapper::lookupAttribute |
( |
ElementAttribute * |
attribute, |
|
|
const char * |
localName, |
|
|
const char * |
namespaceUri |
|
) |
| const |
|
virtual |
Find the attribute with the specified localName
and specified namespaceUri
in the current node, and fill in the specified attribute
structure. Return 0 on success, 1 if there is no attribute found with localName
and namespaceUri
, and a negative value otherwise. If namespaceUri
== 0 or a blank string is passed, then the document's default namespace will be used. The strings that were filled into the attribute
structure are invalid upon the next advanceToNextNode
or close
is called.
Implements balxml::Reader.
int balxml::Utf8ReaderWrapper::lookupAttribute |
( |
ElementAttribute * |
attribute, |
|
|
const char * |
localName, |
|
|
int |
namespaceId |
|
) |
| const |
|
virtual |
Find the attribute with the specified localName
and specified namespaceId
in the current node, and fill in the specified attribute
structure. Return 0 on success, 1 if there is no attribute found with localName
and namespaceId
, and a negative value otherwise. If namespaceId
== -1, then the document's default namespace will be used. The strings that were filled into the attribute
structure are invalid upon the next advanceToNextNode
or close
is called.
Implements balxml::Reader.
int balxml::Utf8ReaderWrapper::open |
( |
bsl::streambuf * |
stream, |
|
|
const char * |
url = 0 , |
|
|
const char * |
encoding = 0 |
|
) |
| |
|
virtual |
Set up the reader for parsing using the data contained in the specified (XML) stream
, set the base URL to the optionally specified url
and set the encoding value to the optionally specified encoding
("ASCII", "UTF-8", etc). Return 0 on success and non-zero otherwise. If url
is null or a blank string is passed, then base URL will be empty. The encoding passed to Reader::open
will take effect only when there is no encoding information in the original document, i.e., the encoding information obtained from the (XML) stream
trumps all. If there is no encoding provided within the document and encoding
is null or a blank string is passed, then set the encoding to the default "UTF-8". It is an error to open
a reader that is already open. Note that the reader will not be on a valid node until advanceToNextNode
is called.
Implements balxml::Reader.
int balxml::Utf8ReaderWrapper::open |
( |
const char * |
buffer, |
|
|
bsl::size_t |
size, |
|
|
const char * |
url = 0 , |
|
|
const char * |
encoding = 0 |
|
) |
| |
|
virtual |
Set up the reader for parsing using the data contained in the specified (XML) buffer
of the specified size
, set the base URL to the optionally specified url
and set the encoding value to the optionally specified encoding
("ASCII", "UTF-8", etc). Return 0 on success and non-zero otherwise. If url
is null or a blank string is passed, then base URL will be empty. The encoding passed to Reader::open
will take effect only when there is no encoding information in the original document, i.e., the encoding information obtained from the (XML) buffer
trumps all. If there is no encoding provided within the document and encoding
is null or a blank string is passed, then set the encoding to the default "UTF-8". It is an error to open
a reader that is already open. Note that the reader will not be on a valid node until advanceToNextNode
is called.
Implements balxml::Reader.
int balxml::Utf8ReaderWrapper::open |
( |
const char * |
filename, |
|
|
const char * |
encoding = 0 |
|
) |
| |
|
virtual |
Set up the reader for parsing using the data contained in the XML file described by the specified filename
, and set the encoding value to the optionally specified encoding
("ASCII", "UTF-8", etc). Returns 0 on success and non-zero otherwise. The encoding passed to Reader::open
will take effect only when there is no encoding information in the original document, i.e., the encoding information obtained from the XML file described by the filename
trumps all. If there is no encoding provided within the document and encoding
is null or a blank string is passed, then set the encoding to the default "UTF-8". It is an error to open
a reader that is already open. Note that the reader will not be on a valid node until advanceToNextNode
is called.
Implements balxml::Reader.
void balxml::Utf8ReaderWrapper::setPrefixStack |
( |
PrefixStack * |
prefixes | ) |
|
|
virtual |
Set the prefix stack to the stack at the optionally specified prefixes
address or disable prefix stack support if prefixes
is null. This stack is used to push and pop namespace prefixes as the parse progresses, so that, at any point, the stack will reflect the set of active prefixes for the current node. It is legitimate to pass a stack that already contains prefixes, these prefixes shall be preserved when close
is called, i.e., the prefix stack shall be returned to the stack depth it had when setPrefixStack
was called. The behavior is undefined if this method is called after calling open
and before calling close
.
Implements balxml::Reader.