* xmlSchemaBuildContentModel: * @ctxt: the schema parser context * @type: the complex type definition * @name: the element name * * Builds the content model of the complex type. */
| 13102 | * Builds the content model of the complex type. |
| 13103 | */ |
| 13104 | static void |
| 13105 | xmlSchemaBuildContentModel(xmlSchemaTypePtr type, |
| 13106 | xmlSchemaParserCtxtPtr ctxt) |
| 13107 | { |
| 13108 | if ((type->type != XML_SCHEMA_TYPE_COMPLEX) || |
| 13109 | (type->contModel != NULL) || |
| 13110 | ((type->contentType != XML_SCHEMA_CONTENT_ELEMENTS) && |
| 13111 | (type->contentType != XML_SCHEMA_CONTENT_MIXED))) |
| 13112 | return; |
| 13113 | |
| 13114 | ctxt->am = NULL; |
| 13115 | ctxt->am = xmlNewAutomata(); |
| 13116 | if (ctxt->am == NULL) { |
| 13117 | xmlSchemaPErrMemory(ctxt); |
| 13118 | return; |
| 13119 | } |
| 13120 | ctxt->state = xmlAutomataGetInitState(ctxt->am); |
| 13121 | /* |
| 13122 | * Build the automaton. |
| 13123 | */ |
| 13124 | xmlSchemaBuildAContentModel(ctxt, WXS_TYPE_PARTICLE(type)); |
| 13125 | xmlAutomataSetFinalState(ctxt->am, ctxt->state); |
| 13126 | type->contModel = xmlAutomataCompile(ctxt->am); |
| 13127 | if (type->contModel == NULL) { |
| 13128 | xmlSchemaPCustomErr(ctxt, |
| 13129 | XML_SCHEMAP_INTERNAL, |
| 13130 | WXS_BASIC_CAST type, type->node, |
| 13131 | "Failed to compile the content model", NULL); |
| 13132 | } else if (xmlRegexpIsDeterminist(type->contModel) != 1) { |
| 13133 | xmlSchemaPCustomErr(ctxt, |
| 13134 | XML_SCHEMAP_NOT_DETERMINISTIC, |
| 13135 | /* XML_SCHEMAS_ERR_NOTDETERMINIST, */ |
| 13136 | WXS_BASIC_CAST type, type->node, |
| 13137 | "The content model is not determinist", NULL); |
| 13138 | } else { |
| 13139 | } |
| 13140 | ctxt->state = NULL; |
| 13141 | xmlFreeAutomata(ctxt->am); |
| 13142 | ctxt->am = NULL; |
| 13143 | } |
| 13144 | |
| 13145 | /** |
| 13146 | * xmlSchemaResolveElementReferences: |
no test coverage detected