* xmlSAX2StartElementNs: * @ctx: the user data (XML parser context) * @localname: the local name of the element * @prefix: the element namespace prefix if available * @URI: the element namespace name if available * @nb_namespaces: number of namespace definitions on that node * @namespaces: pointer to the array of prefix/URI pairs namespace definitions * @nb_attributes: the number of
| 2061 | * the new namespace declarations on the element. |
| 2062 | */ |
| 2063 | void |
| 2064 | xmlSAX2StartElementNs(void *ctx, |
| 2065 | const xmlChar *localname, |
| 2066 | const xmlChar *prefix, |
| 2067 | const xmlChar *URI, |
| 2068 | int nb_namespaces, |
| 2069 | const xmlChar **namespaces, |
| 2070 | int nb_attributes, |
| 2071 | int nb_defaulted, |
| 2072 | const xmlChar **attributes) |
| 2073 | { |
| 2074 | xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; |
| 2075 | xmlNodePtr ret; |
| 2076 | xmlNsPtr last = NULL, ns; |
| 2077 | const xmlChar *uri, *pref; |
| 2078 | xmlChar *lname = NULL; |
| 2079 | int i, j; |
| 2080 | |
| 2081 | if (ctx == NULL) return; |
| 2082 | /* |
| 2083 | * First check on validity: |
| 2084 | */ |
| 2085 | if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && |
| 2086 | ((ctxt->myDoc->intSubset == NULL) || |
| 2087 | ((ctxt->myDoc->intSubset->notations == NULL) && |
| 2088 | (ctxt->myDoc->intSubset->elements == NULL) && |
| 2089 | (ctxt->myDoc->intSubset->attributes == NULL) && |
| 2090 | (ctxt->myDoc->intSubset->entities == NULL)))) { |
| 2091 | xmlErrValid(ctxt, XML_DTD_NO_DTD, |
| 2092 | "Validation failed: no DTD found !", NULL, NULL); |
| 2093 | ctxt->validate = 0; |
| 2094 | } |
| 2095 | |
| 2096 | /* |
| 2097 | * Take care of the rare case of an undefined namespace prefix |
| 2098 | */ |
| 2099 | if ((prefix != NULL) && (URI == NULL)) { |
| 2100 | if (ctxt->dictNames) { |
| 2101 | const xmlChar *fullname; |
| 2102 | |
| 2103 | fullname = xmlDictQLookup(ctxt->dict, prefix, localname); |
| 2104 | if (fullname == NULL) { |
| 2105 | xmlSAX2ErrMemory(ctxt); |
| 2106 | return; |
| 2107 | } |
| 2108 | localname = fullname; |
| 2109 | } else { |
| 2110 | lname = xmlBuildQName(localname, prefix, NULL, 0); |
| 2111 | if (lname == NULL) { |
| 2112 | xmlSAX2ErrMemory(ctxt); |
| 2113 | return; |
| 2114 | } |
| 2115 | } |
| 2116 | } |
| 2117 | /* |
| 2118 | * allocate the node |
| 2119 | */ |
| 2120 | if (ctxt->freeElems != NULL) { |