| 8755 | */ |
| 8756 | |
| 8757 | static xmlHashedString |
| 8758 | xmlParseAttribute2(xmlParserCtxtPtr ctxt, |
| 8759 | const xmlChar * pref, const xmlChar * elem, |
| 8760 | xmlHashedString * hprefix, xmlChar ** value, |
| 8761 | int *len, int *alloc) |
| 8762 | { |
| 8763 | xmlHashedString hname; |
| 8764 | const xmlChar *prefix, *name; |
| 8765 | xmlChar *val = NULL, *internal_val = NULL; |
| 8766 | int normalize = 0; |
| 8767 | int isNamespace; |
| 8768 | |
| 8769 | *value = NULL; |
| 8770 | GROW; |
| 8771 | hname = xmlParseQNameHashed(ctxt, hprefix); |
| 8772 | if (hname.name == NULL) { |
| 8773 | xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, |
| 8774 | "error parsing attribute name\n"); |
| 8775 | return(hname); |
| 8776 | } |
| 8777 | name = hname.name; |
| 8778 | if (hprefix->name != NULL) |
| 8779 | prefix = hprefix->name; |
| 8780 | else |
| 8781 | prefix = NULL; |
| 8782 | |
| 8783 | /* |
| 8784 | * get the type if needed |
| 8785 | */ |
| 8786 | if (ctxt->attsSpecial != NULL) { |
| 8787 | int type; |
| 8788 | |
| 8789 | type = (int) (ptrdiff_t) xmlHashQLookup2(ctxt->attsSpecial, |
| 8790 | pref, elem, |
| 8791 | prefix, name); |
| 8792 | if (type != 0) |
| 8793 | normalize = 1; |
| 8794 | } |
| 8795 | |
| 8796 | /* |
| 8797 | * read the value |
| 8798 | */ |
| 8799 | SKIP_BLANKS; |
| 8800 | if (RAW == '=') { |
| 8801 | NEXT; |
| 8802 | SKIP_BLANKS; |
| 8803 | isNamespace = (((prefix == NULL) && (name == ctxt->str_xmlns)) || |
| 8804 | (prefix == ctxt->str_xmlns)); |
| 8805 | val = xmlParseAttValueInternal(ctxt, len, alloc, normalize, |
| 8806 | isNamespace); |
| 8807 | if (val == NULL) |
| 8808 | goto error; |
| 8809 | } else { |
| 8810 | xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, |
| 8811 | "Specification mandates value for attribute %s\n", |
| 8812 | name); |
| 8813 | goto error; |
| 8814 | } |
no test coverage detected