40 const char* asChars =
reinterpret_cast<const char*
>(theCharsOrNull);
41 return ( (asChars)?(string(asChars)):(
string(
"")) );
56 if (!startIter || !endIter || (startIter > endIter) )
63 reinterpret_cast<const char*>(startIter),
64 reinterpret_cast<const char*>(endIter));
71 const string& prefixA,
73 : localname(localNameA)
89 : localname(proto.localname)
90 , prefix(proto.prefix)
113 const xmlChar* xmlLocalName = (*chunkOfFivePointers++);
114 const xmlChar* xmlPrefix = (*chunkOfFivePointers++);
115 const xmlChar* xmlURI = (*chunkOfFivePointers++);
116 const xmlChar* xmlValueStart = (*chunkOfFivePointers++);
118 const xmlChar* xmlValueEnd = (*chunkOfFivePointers++);
171 return _attributes.begin();
177 return _attributes.end();
183 return _attributes.empty();
198 if (foundIt != _attributes.end())
205 _attributes.push_back(attribute);
267 for (it =
begin(); it !=
end(); ++it)
276 XMLAttributeMap::findByQName(
const string& qname)
279 for (it = _attributes.begin();
280 it != _attributes.end();
283 if (it->getQName() == qname)
300 : prefix(proto.prefix)
329 string attr(
"xmlns");
332 attr += ( string(
":") +
prefix );
334 attr += string(
"=\"");
336 attr += string(
"\"");
353 : _namespaces(proto._namespaces)
364 _namespaces = rhs._namespaces;
372 for (
int i=0; i<numNamespaces; ++i)
396 return _namespaces.begin();
402 return _namespaces.end();
409 for (foundIt =
begin(); foundIt !=
end(); ++foundIt)
411 if (foundIt->prefix == prefix)
422 return (
find(prefix) !=
end() );
428 XMLNamespaceMap::iterator foundIt = findNonConst(ns.
prefix);
429 if (foundIt == _namespaces.end())
431 _namespaces.push_back(ns);
449 return _namespaces.empty();
453 XMLNamespaceMap::iterator
454 XMLNamespaceMap::findNonConst(
const string& prefix)
456 XMLNamespaceMap::iterator foundIt;
457 for (foundIt = _namespaces.begin(); foundIt != _namespaces.end(); ++foundIt)
459 if (foundIt->prefix == prefix)
481 : _stack(proto._stack)
499 _stack.push_back(nsMap);
511 return _stack.back();
517 return _stack.empty();
529 return _stack.rbegin();
535 return _stack.rend();
545 addMissingNamespaces(nsFlattened, *it);
void fromSAX2Namespace(const xmlChar **namespaces)
Assuming the pointer is an array of two strings: {prefix, uri}.
XMLNamespaceMap::const_iterator find(const string &prefix) const
Return the iterator to the element or end() if not found.
XMLNamespaceMap::const_iterator end() const
vector< XMLNamespaceMap >::const_reverse_iterator const_iterator
XMLAttributeMap::const_iterator begin() const
vector< XMLAttribute >::iterator iterator
XMLNamespace & operator=(const XMLNamespace &rhs)
bool isInMap(const string &prefix) const
XMLNamespaceStack & operator=(const XMLNamespaceStack &rhs)
An abstract superclass for NCMLArray that handles the non-parameterized functionality and allows u...
const XMLNamespaceMap & top() const
static string xmlCharToStringFromIterators(const xmlChar *startPtr, const xmlChar *endPtr)
string getAsXMLString() const
Get the standard string version as found in an element: prefix:localname="value" localname="value" if...
const string getValueForLocalNameOrDefault(const string &localname, const string &defVal="") const
If there is an attribute with localname, return its value, else return default.
const XMLAttribute * getAttributeByLocalName(const string &localname) const
These return null if the attribute was not found.
XMLNamespace(const string &prefix="", const string &uri="")
void fromSAX2Namespaces(const xmlChar **pNamespaces, int numNamespaces)
Read them all in from the xmlChar array.
XMLAttribute & operator=(const XMLAttribute &rhs)
XMLNamespaceMap::const_iterator begin() const
string getAllNamespacesAsAttributeString() const
Get a big string full of xmlns:prefix="uri" attributes, separated by spaces.
void addAttribute(const XMLAttribute &attribute)
TODO how do we tell if this exists? Does it replace? Do we care?
void getFlattenedNamespacesUsingLexicalScoping(XMLNamespaceMap &nsFlattened) const
Scanning from the stack top downwards, add the first found new XMLNamespace (in terms of its prefix) ...
string getAsAttributeString() const
Get the namespace as attribute string, ie "xmlns:prefix=\"uri"" for serializing.
XMLAttribute(const string &localName="", const string &value="", const string &prefix="", const string &nsURI="")
static string xmlCharToString(const xmlChar *pChars)
XMLAttributeMap::const_iterator end() const
XMLNamespaceStack::const_iterator begin() const
Starts from the top (most recently pushed) and iterates to the bottom (first pushed).
vector< XMLAttribute >::const_iterator const_iterator
string getAllAttributesAsString() const
The classic {prefix:}foo="value" whitespace separated.
const XMLAttribute * getAttributeByQName(const string &qname) const
void push(const XMLNamespaceMap &nsMap)
void addNamespace(const XMLNamespace &ns)
If the given prefix is already in the map, ns REPLACES it.
XMLNamespaceStack::const_iterator end() const
string getQName() const
get the name with the prefix:localname if prefix not empty else localname
XMLNamespaceMap & operator=(const XMLNamespaceMap &rhs)
vector< XMLNamespace >::const_iterator const_iterator
void fromSAX2NamespaceAttributes(const xmlChar **chunkOfFivePointers)
Fill in the fields from the SAX2 namespace attributes array.