Avoid size limit for xpath regular expressions by using two patterns. See https://bugs.gentoo.org/show_bug.cgi?id=188114 for discussion and references. The following bash script will recreate the long patterns: S="\\s*" NCName='[^./|:*@\s]+' QName="${NCName}:${NCName}" NameTest="(child::${S})?(${NCName}:)?(${NCName}|\\*)" Step="${S}(\\.|${NameTest})${S}" Path="(${S}\\.${S}//)?${Step}(/${Step})*" Selector="${Path}(\\|${Path})*" echo "selector: ${Selector}" LastStep="${Step}|${S}(@|attribute::)${S}${NameTest}${S}" Path="(${S}\\.${S}//)?(${Step}/)*(${LastStep})" Selector="${Path}(\\|${Path})*" echo "field: ${Selector}" 2007-09-12 Martin von Gagern --- nxml-mode-20041004.orig/schema/xmlschema.rnc 2007-08-10 01:56:18.000000000 +0200 +++ nxml-mode-20041004/schema/xmlschema.rnc 2007-09-12 11:31:26.000000000 +0200 @@ -809,8 +809,9 @@ annotated, attribute xpath { xsd:token { + pattern = "[./|:*@\s]*([^\I:][^\C:]*[./|:*@\s]+)*([^\I:][^\C:]*)?" pattern = - "(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*" + "(\s*\.\s*//)?\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*(/\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*)*(\|(\s*\.\s*//)?\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*(/\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*)*)*" } } } @@ -829,8 +830,9 @@ annotated, attribute xpath { xsd:token { + pattern = "[./|:*@\s]*([^\I:][^\C:]*[./|:*@\s]+)*([^\I:][^\C:]*)?" pattern = - "(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*" + "(\s*\.\s*//)?(\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*/)*(\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*|\s*(@|attribute::)\s*(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*)\s*)(\|(\s*\.\s*//)?(\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*/)*(\s*(\.|(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*))\s*|\s*(@|attribute::)\s*(child::\s*)?([^./|:*@\s]+:)?([^./|:*@\s]+|\*)\s*))*" } } }