summaryrefslogtreecommitdiff
path: root/ACEXML/common/NamespaceSupport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ACEXML/common/NamespaceSupport.cpp')
-rw-r--r--ACEXML/common/NamespaceSupport.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/ACEXML/common/NamespaceSupport.cpp b/ACEXML/common/NamespaceSupport.cpp
index b28b9d07248..d4f27ba71c4 100644
--- a/ACEXML/common/NamespaceSupport.cpp
+++ b/ACEXML/common/NamespaceSupport.cpp
@@ -2,18 +2,15 @@
#include "ACEXML/common/NamespaceSupport.h"
-static const ACEXML_Char ACEXML_XMLNS_PREFIX_name[] = {'x', 'm', 'l', 'n', 's', 0};
+static const ACEXML_Char ACEXML_XMLNS_PREFIX_name[] = ACE_TEXT ("xmlns");
+
const ACEXML_Char *ACEXML_NamespaceSupport::XMLNS_PREFIX = ACEXML_XMLNS_PREFIX_name;
static const ACEXML_Char ACEXML_DEFAULT_NS_PREFIX[] = {0};
-static const ACEXML_Char ACEXML_TABOO_NS_PREFIX[] = {'x', 'm', 'l', 0};
+static const ACEXML_Char ACEXML_TABOO_NS_PREFIX[] = ACE_TEXT ("xml");
-static const ACEXML_Char ACEXML_XMLNS_URI_name[] = {
- 'h', 't', 't', 'p', ':', '/', '/',
- 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/',
- 'X', 'M', 'L', '/', '1', '9', '9', '8', '/',
- 'n', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e', 0};
+static const ACEXML_Char ACEXML_XMLNS_URI_name[] = ACE_TEXT ("http://www.w3.org/XML/1998/namespace");
const ACEXML_Char *ACEXML_NamespaceSupport::XMLNS = ACEXML_XMLNS_URI_name;
#if !defined (__ACEXML_INLINE__)
@@ -82,6 +79,9 @@ int
ACEXML_NamespaceSupport::declarePrefix (const ACEXML_Char *prefix,
const ACEXML_Char *uri)
{
+ if (!prefix || !uri)
+ return -1;
+
// Unless predefined by w3.org(?) NS prefix can never start with
// "xml".
if (ACE_OS_String::strcmp (ACEXML_TABOO_NS_PREFIX, prefix) == 0)
@@ -112,6 +112,9 @@ ACEXML_NamespaceSupport::getDeclaredPrefixes (ACEXML_STR_LIST &prefixes) const
const ACEXML_Char *
ACEXML_NamespaceSupport::getPrefix (const ACEXML_Char *uri) const
{
+ if (!uri)
+ return 0;
+
ACEXML_NS_CONTEXT_ENTRY *entry;
for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_);
@@ -146,6 +149,9 @@ int
ACEXML_NamespaceSupport::getPrefixes (const ACEXML_Char *uri,
ACEXML_STR_LIST &prefixes) const
{
+ if (!uri)
+ return -1;
+
ACEXML_NS_CONTEXT_ENTRY *entry;
for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_);
@@ -163,6 +169,9 @@ ACEXML_NamespaceSupport::getPrefixes (const ACEXML_Char *uri,
const ACEXML_Char *
ACEXML_NamespaceSupport::getURI (const ACEXML_Char *prefix) const
{
+ if (!prefix)
+ return 0;
+
ACEXML_NS_CONTEXT_ENTRY *entry;
if (this->effective_context_->find (ACEXML_String (prefix, 0, 0),
@@ -236,21 +245,24 @@ ACEXML_NamespaceSupport::processName (const ACEXML_Char *qName,
ACEXML_NS_CONTEXT_ENTRY *entry;
- if (this->effective_context_->find (prefix, entry) == 0)
- uri = entry->int_id_.c_str ();
+ if (prefix != ACEXML_DEFAULT_NS_PREFIX)
+ {
+ if (this->effective_context_->find (prefix, entry) == 0)
+ uri = entry->int_id_.c_str ();
+ }
else
{
uri = ACEXML_DEFAULT_NS_PREFIX;
return -1;
}
-
return 0;
}
int
ACEXML_NamespaceSupport::reset (void)
{
- // Not implemented.
+ while (this->popContext() != -1)
+ ;
return 0;
}