You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Herm Fischer (Jira)" <xe...@xml.apache.org> on 2020/06/07 19:37:00 UTC

[jira] [Comment Edited] (XERCESC-2193) Validation error for prefix declaration on element whose value uses a prefix

    [ https://issues.apache.org/jira/browse/XERCESC-2193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17127740#comment-17127740 ] 

Herm Fischer edited comment on XERCESC-2193 at 6/7/20, 7:36 PM:
----------------------------------------------------------------

It was difficult to isolate the issue, the situation where this misbehaves is only during schema loading with validate annotations.  It doesn't occur with SAX validation of xml files. It doesn't occur without import of the annotation's element schema.  Here are the setup and example annotation (apologies, it's in "Cython"):

{{  cdef XercesDOMParser* parser = new XercesDOMParser()}}
 {{  cdef bool bTrue = True}}
 {{  parser.setDoNamespaces( bTrue )}}
 {{  parser.setDoSchema( bTrue )}}
 {{  parser.setLoadSchema( bTrue )}}
 {{  parser.setGenerateSyntheticAnnotations( bTrue )}}
 {{  parser.setValidationSchemaFullChecking( bTrue )}}
 {{  parser.setValidateAnnotations( bTrue )}}
 {{  parser.setCalculateSrcOfs( bTrue )}}
 {{  parser.cacheGrammarFromParse( bTrue )}}
 {{  parser.useCachedGrammarInParse( bTrue )}}
 {{  parser.setCreateSchemaInfo( bTrue )}}
 {{  parser.setCreateCommentNodes( bTrue )}}
 {{  ...}}
 {{  cdef SchemaGrammar* schemaGrammar = <SchemaGrammar*>parser.loadGrammar( deref( inpSrc ), GrammarType.SchemaGrammarType, bTrue)}}

The sample schema file must have the annotation and import to misbehave:

{{<xsd:schema targetNamespace="http://xbrl.org/conformance" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c="http://xbrl.org/conformance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink">}}
{{   <xsd:annotation>}}
{{     <xsd:appinfo>}}
{{       <link:arcroleType arcroleURI="http://xbrl.org/role/conformance" cyclesAllowed="any" id="conformance">}}
{{         <link:usedOn xmlns:this="http://example.com/this">this:someArc</link:usedOn>}}
{{         <link:usedOn xmlns:this="http://example.com/that">this:someArc</link:usedOn>}}
{{       </link:arcroleType>}}
{{     </xsd:appinfo>}}
{{   </xsd:annotation>}}
{{   <xsd:import namespace="http://www.xbrl.org/2003/linkbase" schemaLocation="http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd"/>}}
{{ </xsd:schema>}}

 

 


was (Author: hefischer):
It was difficult to isolate the issue, the situation where this misbehaves is only during schema loading with validate annotations.  It doesn't occur with SAX validation of xml files. It doesn't occur without import of the annotation's element schema.  Here are the setup and example annotation (apologies, it's in "Cython"):

{{  cdef XercesDOMParser* parser = new XercesDOMParser()}}
{{  cdef bool bTrue = True}}
{{  parser.setDoNamespaces( bTrue )}}
{{  parser.setDoSchema( bTrue )}}
{{  parser.setLoadSchema( bTrue )}}
{{  parser.setGenerateSyntheticAnnotations( bTrue )}}
{{  parser.setValidationSchemaFullChecking( bTrue )}}
{{  parser.setValidateAnnotations( bTrue )}}
{{  parser.setCalculateSrcOfs( bTrue )}}
{{  parser.cacheGrammarFromParse( bTrue )}}
{{  parser.useCachedGrammarInParse( bTrue )}}
{{  parser.setCreateSchemaInfo( bTrue )}}
{{  parser.setCreateCommentNodes( bTrue )}}
{{  ...}}
{{  cdef SchemaGrammar* schemaGrammar = <SchemaGrammar*>parser.loadGrammar( deref( inpSrc ), GrammarType.SchemaGrammarType, bTrue)}}

The sample schema file must have the annotation and import to misbehave:

{{<xsd:schema targetNamespace="http://xbrl.org/conformance" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c="http://xbrl.org/conformance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink">}}
{{   <xsd:annotation>}}
{{     <xsd:appinfo>}}
{{       <link:arcroleType arcroleURI="http://xbrl.org/role/conformance" cyclesAllowed="any" id="conformance">}}
{{         <link:usedOn xmlns:this="http://example.com/this">this:someArc</link:usedOn>}}
{{         <link:usedOn xmlns:this="http://example.com/that">this:someArc</link:usedOn>}}
{{       </link:arcroleType>}}
{{     </xsd:appinfo>}}
{{   </xsd:annotation>}}
{{   <xsd:import namespace="http://www.xbrl.org/2003/linkbase" schemaLocation="http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd"/>}}
{{ </xsd:schema>}}

 

 

> Validation error for prefix declaration on element whose value uses a prefix
> ----------------------------------------------------------------------------
>
>                 Key: XERCESC-2193
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2193
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 3.2.2
>         Environment: Linux
>            Reporter: Herm Fischer
>            Priority: Major
>
> Xerces schema validation reports the prefix is undefined when QName content of an element is using a prefix defined on the element (works fine with Xerces-J, etc).  
> <link:usedOn xmlns:this="http://example.com/this">this:someArc</link:usedOn>
> validation message: undefined prefix in QName value 'this:someArc' 
> Is there a parameter, usage pattern, or code patch which will make this validate cleanly?  (isPrefixUnknown seems to look in element stack instead of looking first at current element?)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org