* xmlSchemaAddType: * @ctxt: a schema parser context * @schema: the schema being built * @name: the item name * @namespace: the namespace * * Add an XML schema item * *WARNING* this interface is highly subject to change * * Returns the new structure or NULL in case of error */
| 5326 | * Returns the new structure or NULL in case of error |
| 5327 | */ |
| 5328 | static xmlSchemaTypePtr |
| 5329 | xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, |
| 5330 | xmlSchemaTypeType type, |
| 5331 | const xmlChar * name, const xmlChar * nsName, |
| 5332 | xmlNodePtr node, int topLevel) |
| 5333 | { |
| 5334 | xmlSchemaTypePtr ret = NULL; |
| 5335 | |
| 5336 | if ((ctxt == NULL) || (schema == NULL)) |
| 5337 | return (NULL); |
| 5338 | |
| 5339 | ret = (xmlSchemaTypePtr) xmlMalloc(sizeof(xmlSchemaType)); |
| 5340 | if (ret == NULL) { |
| 5341 | xmlSchemaPErrMemory(ctxt); |
| 5342 | return (NULL); |
| 5343 | } |
| 5344 | memset(ret, 0, sizeof(xmlSchemaType)); |
| 5345 | ret->type = type; |
| 5346 | ret->name = name; |
| 5347 | ret->targetNamespace = nsName; |
| 5348 | ret->node = node; |
| 5349 | if (topLevel) { |
| 5350 | if (ctxt->isRedefine) { |
| 5351 | ctxt->redef = xmlSchemaAddRedef(ctxt, ctxt->redefined, |
| 5352 | ret, name, nsName); |
| 5353 | if (ctxt->redef == NULL) { |
| 5354 | xmlFree(ret); |
| 5355 | return(NULL); |
| 5356 | } |
| 5357 | ctxt->redefCounter = 0; |
| 5358 | } |
| 5359 | WXS_ADD_GLOBAL(ctxt, ret); |
| 5360 | } else |
| 5361 | WXS_ADD_LOCAL(ctxt, ret); |
| 5362 | WXS_ADD_PENDING(ctxt, ret); |
| 5363 | return (ret); |
| 5364 | } |
| 5365 | |
| 5366 | static xmlSchemaQNameRefPtr |
| 5367 | xmlSchemaNewQNameRef(xmlSchemaParserCtxtPtr pctxt, |
no test coverage detected