version 1.54, 2009/02/05 05:44:04
|
version 1.55, 2009/11/30 16:49:46
|
|
|
// | // |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
XmlParser::XmlParser(char* text, XmlNamespace* ns) |
XmlParser::XmlParser(char* text, XmlNamespace* ns, Boolean hideEmptyTags) |
: _line(1), | : _line(1), |
_current(text), | _current(text), |
_restoreChar('\0'), | _restoreChar('\0'), |
_foundRoot(false), | _foundRoot(false), |
_supportedNamespaces(ns), | _supportedNamespaces(ns), |
// Start valid indexes with -2. -1 is reserved for not found. | // Start valid indexes with -2. -1 is reserved for not found. |
_currentUnsupportedNSType(-2) |
_currentUnsupportedNSType(-2), |
|
_hideEmptyTags(hideEmptyTags) |
{ | { |
} | } |
| |
|
|
} | } |
} | } |
| |
Boolean XmlParser::next( |
Boolean XmlParser::_next( |
XmlEntry& entry, | XmlEntry& entry, |
Boolean includeComment) | Boolean includeComment) |
{ | { |
|
|
return true; | return true; |
} | } |
| |
|
Boolean XmlParser::next(XmlEntry& entry, Boolean includeComment) |
|
{ |
|
if (_hideEmptyTags) |
|
{ |
|
// Get the next tag. |
|
|
|
if (!_next(entry, includeComment)) |
|
return false; |
|
|
|
// If an EMPTY_TAG is encountered, then convert it to a START_TAG and |
|
// push a matching END_TAG on the put-back stack. This hides every |
|
// EMPTY_TAG from the caller. |
|
|
|
if (entry.type == XmlEntry::EMPTY_TAG) |
|
{ |
|
entry.type = XmlEntry::START_TAG; |
|
|
|
XmlEntry tmp; |
|
tmp.type = XmlEntry::END_TAG; |
|
tmp.text = entry.text; |
|
tmp.nsType = entry.nsType; |
|
tmp.localName = entry.localName; |
|
|
|
_putBackStack.push(tmp); |
|
} |
|
|
|
return true; |
|
} |
|
else |
|
return _next(entry, includeComment); |
|
} |
|
|
// Get the namespace type of the given tag | // Get the namespace type of the given tag |
int XmlParser::_getNamespaceType(const char* tag) | int XmlParser::_getNamespaceType(const char* tag) |
{ | { |