| 7960 | } |
| 7961 | |
| 7962 | static int |
| 7963 | xmlSchemaCheckCSelectorXPath(xmlSchemaParserCtxtPtr ctxt, |
| 7964 | xmlSchemaIDCPtr idc, |
| 7965 | xmlSchemaIDCSelectPtr selector, |
| 7966 | xmlAttrPtr attr, |
| 7967 | int isField) |
| 7968 | { |
| 7969 | xmlNodePtr node; |
| 7970 | |
| 7971 | /* |
| 7972 | * c-selector-xpath: |
| 7973 | * Schema Component Constraint: Selector Value OK |
| 7974 | * |
| 7975 | * TODO: 1 The {selector} must be a valid XPath expression, as defined |
| 7976 | * in [XPath]. |
| 7977 | */ |
| 7978 | if (selector == NULL) { |
| 7979 | xmlSchemaPErr(ctxt, idc->node, |
| 7980 | XML_SCHEMAP_INTERNAL, |
| 7981 | "Internal error: xmlSchemaCheckCSelectorXPath, " |
| 7982 | "the selector is not specified.\n", NULL, NULL); |
| 7983 | return (-1); |
| 7984 | } |
| 7985 | if (attr == NULL) |
| 7986 | node = idc->node; |
| 7987 | else |
| 7988 | node = (xmlNodePtr) attr; |
| 7989 | if (selector->xpath == NULL) { |
| 7990 | xmlSchemaPCustomErr(ctxt, |
| 7991 | /* TODO: Adjust error code. */ |
| 7992 | XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, |
| 7993 | NULL, node, |
| 7994 | "The XPath expression of the selector is not valid", NULL); |
| 7995 | return (XML_SCHEMAP_S4S_ATTR_INVALID_VALUE); |
| 7996 | } else { |
| 7997 | const xmlChar **nsArray = NULL; |
| 7998 | xmlNsPtr *nsList = NULL; |
| 7999 | /* |
| 8000 | * Compile the XPath expression. |
| 8001 | */ |
| 8002 | /* |
| 8003 | * TODO: We need the array of in-scope namespaces for compilation. |
| 8004 | * TODO: Call xmlPatterncompile with different options for selector/ |
| 8005 | * field. |
| 8006 | */ |
| 8007 | if (attr == NULL) |
| 8008 | nsList = NULL; |
| 8009 | else |
| 8010 | nsList = xmlGetNsList(attr->doc, attr->parent); |
| 8011 | /* |
| 8012 | * Build an array of prefixes and namespaces. |
| 8013 | */ |
| 8014 | if (nsList != NULL) { |
| 8015 | int i, count = 0; |
| 8016 | |
| 8017 | for (i = 0; nsList[i] != NULL; i++) |
| 8018 | count++; |
| 8019 |
no test coverage detected