예제 #1
0
SequenceType SequenceType::createElementType(
    const StaticContext_t& sctx,
    const String& nodeUri,
    const String& nodeLocalName,
    const String& typeUri,
    const String& typeLocalName,
    bool nillable,
    Quantifier quant)
{
  TypeManager* tm;

  if (sctx == NULL)
  {
    tm = &GENV_TYPESYSTEM;
  }
  else
  {
    static_context* sctx2 = Unmarshaller::getInternalStaticContext(sctx);
    tm = sctx2->get_typemanager();
  }

  zstring& nodeNS = Unmarshaller::getInternalString(nodeUri);
  zstring& nodeLocal = Unmarshaller::getInternalString(nodeLocalName);
  store::Item_t nodeQName;

  if (!nodeLocal.empty())
    GENV_ITEMFACTORY->createQName(nodeQName, nodeNS, "", nodeLocal);

  zstring& typeNS = Unmarshaller::getInternalString(typeUri);
  zstring& typeLocal = Unmarshaller::getInternalString(typeLocalName);
  store::Item_t typeQName;
  xqtref_t contentType;

  if (!typeLocal.empty())
  {
    GENV_ITEMFACTORY->createQName(typeQName, typeNS, "", typeLocal);

    contentType = tm->create_named_type(typeQName, QUANT_ONE, QueryLoc::null, false);

    if (contentType == NULL)
      return Unmarshaller::createSequenceType(NULL);
  }

  xqtref_t res = tm->create_node_type(store::StoreConsts::elementNode,
                                      nodeQName,
                                      contentType,
                                      quant,
                                      nillable,
                                      false);

  return Unmarshaller::createSequenceType(res.getp());
}
예제 #2
0
SequenceType SequenceType::createNamespaceType(Quantifier quant)
{
  TypeManager* tm = &GENV_TYPESYSTEM;

  xqtref_t res = tm->create_node_type(store::StoreConsts::namespaceNode,
                                      NULL,
                                      NULL,
                                      quant,
                                      false,
                                      false);

  return Unmarshaller::createSequenceType(res.getp());
}
예제 #3
0
SequenceType SequenceType::createDocumentType(
    const SequenceType& contentType,
    Quantifier quant)
{
  const XQType* contentType2 = Unmarshaller::getInternalType(contentType);

  TypeManager* tm = (contentType2 == NULL ?
                     &GENV_TYPESYSTEM :
                     contentType2->get_manager());

  store::Item_t qname;

  xqtref_t res = tm->create_node_type(store::StoreConsts::documentNode,
                                      qname,
                                      contentType2,
                                      quant,
                                      false,
                                      false);

  return Unmarshaller::createSequenceType(res.getp());
}