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; }
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); }
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); }