Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsParserService.cpp File Reference
#include "nsDOMError.h"
#include "nsIAtom.h"
#include "nsParserService.h"
#include "nsHTMLEntities.h"
#include "nsElementTable.h"
#include "nsICategoryManager.h"
#include "nsCategoryManagerUtils.h"

Go to the source code of this file.

Classes

class  nsMatchesTopic

Functions

int MOZ_XMLCheckQName (const char *ptr, const char *end, int ns_aware, const char **colon)
 NS_IMPL_ISUPPORTS2 (nsParserService, nsIParserService, nsIParserService_MOZILLA_1_8_BRANCH) PRInt32 nsParserService

Function Documentation

int MOZ_XMLCheckQName ( const char *  ptr,
const char *  end,
int  ns_aware,
const char **  colon 
)

Definition at line 61 of file moz_extensions.c.

{
  int result = MOZ_EXPAT_VALID_QNAME;
  int nmstrt = 1;
  *colon = 0;
  if (ptr == end) {
    return MOZ_EXPAT_EMPTY_QNAME;
  }
  do {
    switch (BYTE_TYPE(ptr)) {
    case BT_COLON:
      if (ns_aware) {
        if (*colon != 0 || nmstrt || ptr + 2 == end) {
          /* We already encountered a colon or this is the first or the last
             character so the QName is malformed. */
          result |= MOZ_EXPAT_MALFORMED;
        }
        *colon = ptr;
        nmstrt = 1;
      }
      else if (nmstrt) {
        /* This is the first character so the QName is malformed. */
        result |= MOZ_EXPAT_MALFORMED;
        nmstrt = 0;
      }
      break;
    case BT_NONASCII:
      if (nmstrt) {
        if (!IS_NMSTRT_CHAR_MINBPC(ptr)) {
          /* If this is a valid name character the QName is malformed, 
             otherwise it contains an invalid character. */
          result |= IS_NAME_CHAR_MINBPC(ptr) ? MOZ_EXPAT_MALFORMED :
                                               MOZ_EXPAT_INVALID_CHARACTER;
        }
      }
      else if (!IS_NAME_CHAR_MINBPC(ptr)) {
        result |= MOZ_EXPAT_INVALID_CHARACTER;
      }
      nmstrt = 0;
      break;
    case BT_NMSTRT:
    case BT_HEX:
      nmstrt = 0;
      break;
    case BT_DIGIT:
    case BT_NAME:
    case BT_MINUS:
      if (nmstrt) {
        result |= MOZ_EXPAT_MALFORMED;
        nmstrt = 0;
      }
      break;
    default:
      result |= MOZ_EXPAT_INVALID_CHARACTER;
      nmstrt = 0;
    }
    ptr += 2;
  } while (ptr != end);
  return result;
}

Here is the caller graph for this function:

Definition at line 63 of file nsParserService.cpp.

{
  nsAutoString tagName;
  aAtom->ToString(tagName);

  return nsHTMLTags::LookupTag(tagName);
}

Here is the call graph for this function: