void DocumentConstructor::evaluateToSequenceReceiver(const DynamicContext::Ptr &context) const { QAbstractXmlReceiver *const receiver = context->outputReceiver(); DocumentContentValidator validator(receiver, context, ConstPtr(this)); const DynamicContext::Ptr receiverContext(context->createReceiverContext(&validator)); validator.startDocument(); m_operand->evaluateToSequenceReceiver(receiverContext); validator.endDocument(); }
Item DocumentConstructor::evaluateSingleton(const DynamicContext::Ptr &context) const { NodeBuilder::Ptr nodeBuilder(context->nodeBuilder(m_staticBaseURI)); DocumentContentValidator validator(nodeBuilder.data(), context, ConstPtr(this)); const DynamicContext::Ptr receiverContext(context->createReceiverContext(&validator)); validator.startDocument(); m_operand->evaluateToSequenceReceiver(receiverContext); validator.endDocument(); const QAbstractXmlNodeModel::Ptr nm(nodeBuilder->builtDocument()); context->addNodeModel(nm); return nm->root(QXmlNodeModelIndex()); }
void ElementConstructor::evaluateToSequenceReceiver(const DynamicContext::Ptr &context) const { /* We create an OutputValidator here too. If we're serializing(a common case, unfortunately) * the receiver is already validating in order to catch cases where a computed attribute * constructor is followed by an element constructor, but in the cases where we're not serializing * it's necessary that we validate in this step. */ const Item name(m_operand1->evaluateSingleton(context)); QAbstractXmlReceiver *const receiver = context->outputReceiver(); OutputValidator validator(receiver, context, this); const DynamicContext::Ptr receiverContext(context->createReceiverContext(&validator)); receiver->startElement(name.as<QNameValue>()->qName()); m_operand2->evaluateToSequenceReceiver(receiverContext); receiver->endElement(); }
Item ElementConstructor::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item name(m_operand1->evaluateSingleton(context)); const NodeBuilder::Ptr nodeBuilder(context->nodeBuilder(m_staticBaseURI)); OutputValidator validator(nodeBuilder.data(), context, this, m_isXSLT); const DynamicContext::Ptr receiverContext(context->createReceiverContext(&validator)); nodeBuilder->startElement(name.as<QNameValue>()->qName()); m_operand2->evaluateToSequenceReceiver(receiverContext); nodeBuilder->endElement(); const QAbstractXmlNodeModel::Ptr nm(nodeBuilder->builtDocument()); context->addNodeModel(nm); return nm->root(QXmlNodeModelIndex()); }