示例#1
0
Bool isValidQName(const char* name)
{
  char *local = NULL;
  char *start = NULL;
  Bool copy = false;
  Bool result = TRUE;

  char *colon = (char *)strchr(name, ':');
  if (colon) 
    {
      //*colon = '\0';
      local = colon + 1;
      copy = true;
      start = new char[colon - name + 1];
      strncpy(start, name, colon - name);
      start[colon - name] = '\0';
    } else {
      start = (char*)name;
    }

  result = isValidNCName(start) && (local == NULL || isValidNCName(local));

  //if (colon) *colon = ':';
  if (copy) delete start;
  return result;
}
示例#2
0
文件: ElemPI.cpp 项目: apache/xalan-c
void
ElemPI::execute(StylesheetExecutionContext&     executionContext) const
{
    ElemTemplateElement::execute(executionContext);
    
    const StylesheetExecutionContext::GetCachedString   theGuard(executionContext);

    XalanDOMString&     piName = theGuard.get();

    m_nameAVT->evaluate(piName, *this, executionContext);

    if (equalsIgnoreCaseASCII(
            piName,
            Constants::ATTRVAL_OUTPUT_METHOD_XML) ||
       isValidNCName(piName) == false)
    {
        error(
            executionContext,
            XalanMessages::PINameInvalid_1Param,
            piName);
    }

    StylesheetExecutionContext::SetAndRestoreCopyTextNodesOnly  theSetAndRestore(executionContext, true);

    childrenToResultPI(
            executionContext,
            piName);
}
示例#3
0
文件: ElemPI.cpp 项目: apache/xalan-c
const ElemTemplateElement*
ElemPI::startElement(StylesheetExecutionContext&    executionContext) const
{
    ElemTemplateElement::startElement(executionContext);
    
    XalanDOMString& piName = executionContext.getAndPushCachedString();

    m_nameAVT->evaluate(piName, *this, executionContext);

    if (equalsIgnoreCaseASCII(
            piName,
            Constants::ATTRVAL_OUTPUT_METHOD_XML) ||
       isValidNCName(piName) == false)
    {
        error(
            executionContext,
            XalanMessages::PINameInvalid_1Param,
            piName);
    }

    XalanDOMString& theResult = executionContext.getAndPushCachedString();

    executionContext.pushCopyTextNodesOnly(true);

    return beginChildrenToString(executionContext,theResult);
}