summaryrefslogtreecommitdiff
path: root/src/raptor_rdfxml.c
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2010-03-09 12:42:51 -0800
committerDave Beckett <dave@dajobe.org>2010-03-09 12:42:51 -0800
commit5349fe7e02b3d85550ee02afc88953e886fbcb3b (patch)
treef036d84492d711124f3020c1afc5640657abd6f0 /src/raptor_rdfxml.c
parent48e386404b057abe13745d3d7a96da8c36482d37 (diff)
downloadraptor-5349fe7e02b3d85550ee02afc88953e886fbcb3b.tar.gz
Move per-parser-project options into a raptor_object_options type.
raptor_object_options typedef added. raptor_parser_s: use above rather than array of int. (RAPTOR_OPTIONS_GET_NUMERIC, RAPTOR_OPTIONS_SET_NUMERIC): Added and used by parsers.
Diffstat (limited to 'src/raptor_rdfxml.c')
-rw-r--r--src/raptor_rdfxml.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/raptor_rdfxml.c b/src/raptor_rdfxml.c
index 1837db14..50e34d0b 100644
--- a/src/raptor_rdfxml.c
+++ b/src/raptor_rdfxml.c
@@ -655,7 +655,7 @@ raptor_rdfxml_start_element_handler(void *user_data,
continue;
/* If non namespace-prefixed RDF attributes found on an element */
- if(rdf_parser->options[RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES] &&
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES) &&
!attr->nspace) {
const unsigned char *attr_name = attr->local_name;
int j;
@@ -996,13 +996,13 @@ raptor_rdfxml_parse_start(raptor_parser* rdf_parser)
* http://www.w3.org/TR/rdf-concepts/#dfn-language-identifier
*/
raptor_sax2_set_option(rdf_xml_parser->sax2,
- RAPTOR_OPTION_NORMALIZE_LANGUAGE,
- rdf_parser->options[RAPTOR_OPTION_NORMALIZE_LANGUAGE]);
+ RAPTOR_OPTION_NORMALIZE_LANGUAGE,
+ RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_NORMALIZE_LANGUAGE));
/* Optionally forbid network requests in the XML parser */
raptor_sax2_set_option(rdf_xml_parser->sax2,
- RAPTOR_OPTION_NO_NET,
- rdf_parser->options[RAPTOR_OPTION_NO_NET]);
+ RAPTOR_OPTION_NO_NET,
+ RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_NO_NET));
raptor_sax2_parse_start(rdf_xml_parser->sax2, uri);
@@ -1013,7 +1013,7 @@ raptor_rdfxml_parse_start(raptor_parser* rdf_parser)
}
/* Create a new id_set if needed */
- if(rdf_parser->options[RAPTOR_OPTION_CHECK_RDF_ID]) {
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_CHECK_RDF_ID)) {
rdf_xml_parser->id_set = raptor_new_id_set(rdf_parser->world);
if(!rdf_xml_parser->id_set)
return 1;
@@ -1203,7 +1203,7 @@ raptor_rdfxml_generate_statement(raptor_parser *rdf_parser,
/* the bagID mess */
- if(rdf_parser->options[RAPTOR_OPTION_ALLOW_BAGID] &&
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_ALLOW_BAGID) &&
bag_element && bag_element->bag) {
raptor_term* bag = bag_element->bag;
raptor_uri* bag_predicate_uri = NULL;
@@ -1370,7 +1370,7 @@ raptor_rdfxml_process_property_attributes(raptor_parser *rdf_parser,
message = "Property attribute '%s' has a string not in Unicode Normal Form C: %s";
raptor_rdfxml_update_document_locator(rdf_parser);
- if(rdf_parser->options[RAPTOR_OPTION_NON_NFC_FATAL])
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_NON_NFC_FATAL))
raptor_parser_error(rdf_parser, message, name, value);
else
raptor_parser_warning(rdf_parser, message, name, value);
@@ -1477,7 +1477,7 @@ raptor_rdfxml_process_property_attributes(raptor_parser *rdf_parser,
const char *message;
message = "Property attribute '%s' has a string not in Unicode Normal Form C: %s";
raptor_rdfxml_update_document_locator(rdf_parser);
- if(rdf_parser->options[RAPTOR_OPTION_NON_NFC_FATAL])
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_NON_NFC_FATAL))
raptor_parser_error(rdf_parser, message,
raptor_rdf_ns_terms_info[i].name, value);
else
@@ -1600,7 +1600,7 @@ raptor_rdfxml_start_element_grammar(raptor_parser *rdf_parser,
}
/* If scanning for element, can continue */
- if(rdf_parser->options[RAPTOR_OPTION_SCANNING]) {
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_SCANNING)) {
finished = 1;
break;
}
@@ -1811,7 +1811,7 @@ raptor_rdfxml_start_element_grammar(raptor_parser *rdf_parser,
if(element->rdf_attr[RDF_NS_bagID]) {
- if(rdf_parser->options[RAPTOR_OPTION_ALLOW_BAGID]) {
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_ALLOW_BAGID)) {
unsigned char* bag_id;
raptor_uri* bag_uri = NULL;
@@ -1895,7 +1895,7 @@ raptor_rdfxml_start_element_grammar(raptor_parser *rdf_parser,
}
if((element->content_type == RAPTOR_RDFXML_ELEMENT_CONTENT_TYPE_DAML_COLLECTION) ||
- rdf_parser->options[RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST]) {
+ RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST)) {
raptor_uri* class_uri = NULL;
if(element->content_type == RAPTOR_RDFXML_ELEMENT_CONTENT_TYPE_DAML_COLLECTION) {
@@ -2128,7 +2128,7 @@ raptor_rdfxml_start_element_grammar(raptor_parser *rdf_parser,
if(element->rdf_attr[RDF_NS_bagID]) {
- if(rdf_parser->options[RAPTOR_OPTION_ALLOW_BAGID]) {
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_ALLOW_BAGID)) {
if(element->rdf_attr[RDF_NS_resource] ||
element->rdf_attr[RDF_NS_parseType]) {
@@ -2247,14 +2247,14 @@ raptor_rdfxml_start_element_grammar(raptor_parser *rdf_parser,
element->child_state = RAPTOR_STATE_PARSETYPE_COLLECTION;
element->child_content_type = RAPTOR_RDFXML_ELEMENT_CONTENT_TYPE_COLLECTION;
} else {
- if(rdf_parser->options[RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES] &&
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES) &&
!raptor_strcasecmp((char*)parse_type, "daml:collection")) {
/* A DAML collection appears as a single node */
element->content_type = RAPTOR_RDFXML_ELEMENT_CONTENT_TYPE_RESOURCE;
element->child_state = RAPTOR_STATE_PARSETYPE_COLLECTION;
element->child_content_type = RAPTOR_RDFXML_ELEMENT_CONTENT_TYPE_DAML_COLLECTION;
} else {
- if(rdf_parser->options[RAPTOR_OPTION_WARN_OTHER_PARSETYPES]) {
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_WARN_OTHER_PARSETYPES)) {
raptor_parser_warning(rdf_parser, "Unknown rdf:parseType value '%s' taken as 'Literal'", parse_type);
}
is_parseType_Literal = 1;
@@ -2416,7 +2416,7 @@ raptor_rdfxml_end_element_grammar(raptor_parser *rdf_parser,
/* When scanning, another element ending is outside the RDF
* world so this can happen without further work
*/
- if(rdf_parser->options[RAPTOR_OPTION_SCANNING]) {
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_SCANNING)) {
state = RAPTOR_STATE_UNKNOWN;
finished = 1;
break;
@@ -2665,7 +2665,7 @@ raptor_rdfxml_end_element_grammar(raptor_parser *rdf_parser,
if(element->content_type == RAPTOR_RDFXML_ELEMENT_CONTENT_TYPE_LITERAL) {
- if(rdf_parser->options[RAPTOR_OPTION_ALLOW_BAGID]) {
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_ALLOW_BAGID)) {
/* Only an empty literal can have a rdf:bagID */
if(element->bag) {
if(xml_element->content_cdata_length > 0) {
@@ -2766,7 +2766,7 @@ raptor_rdfxml_end_element_grammar(raptor_parser *rdf_parser,
const char *message;
message = "Property element '%s' has a string not in Unicode Normal Form C: %s";
raptor_rdfxml_update_document_locator(rdf_parser);
- if(rdf_parser->options[RAPTOR_OPTION_NON_NFC_FATAL])
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_NON_NFC_FATAL))
raptor_parser_error(rdf_parser, message, el_name, literal);
else
raptor_parser_warning(rdf_parser, message, el_name, literal);
@@ -2819,7 +2819,7 @@ raptor_rdfxml_end_element_grammar(raptor_parser *rdf_parser,
const char *message;
message = "Property element '%s' has XML literal content not in Unicode Normal Form C: %s";
raptor_rdfxml_update_document_locator(rdf_parser);
- if(rdf_parser->options[RAPTOR_OPTION_NON_NFC_FATAL])
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_NON_NFC_FATAL))
raptor_parser_error(rdf_parser, message, el_name, buffer);
else
raptor_parser_warning(rdf_parser, message, el_name, buffer);
@@ -2982,7 +2982,7 @@ raptor_rdfxml_cdata_grammar(raptor_parser *rdf_parser,
if(state == RAPTOR_STATE_UNKNOWN) {
/* Ignore all cdata if still looking for RDF */
- if(rdf_parser->options[RAPTOR_OPTION_SCANNING])
+ if(RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_SCANNING))
return;
/* Ignore all whitespace cdata before first element */
@@ -3108,7 +3108,7 @@ raptor_rdfxml_record_ID(raptor_parser *rdf_parser,
rdf_xml_parser = (raptor_rdfxml_parser*)rdf_parser->context;
- if(!rdf_parser->options[RAPTOR_OPTION_CHECK_RDF_ID])
+ if(!RAPTOR_OPTIONS_GET_NUMERIC(rdf_parser, RAPTOR_OPTION_CHECK_RDF_ID))
return 0;
base_uri = raptor_rdfxml_inscope_base_uri(rdf_parser);