You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by chaman bagga <ch...@yahoo.com> on 2013/06/06 11:20:21 UTC

fixed value of attribute in xerces using XSAttributeDeclaration

 
 
I am trying to get the value marked as fixed for the attribute in following schema excerpt using xerces grammar model. Using xerces 2.8
 
            <xsd:element name="MyRef">
               <xsd:complexType>
                 <xsd:simpleContent>
                   <xsd:extension base="xsd:string">
                     <xsd:attribute name="MyAttr" type="xsd:string" fixed="MyFixedValue"/>
                   </xsd:extension>
                 </xsd:simpleContent>
               </xsd:complexType>
             </xsd:element>

 
Following is code snippet of what I'm using
 
XSAttributeDeclaration* const attrDecl; // This is initialized by traversing through XSAttributeUseList
assert(attrDecl->getConstraintType() == XSConstants::VALUE_CONSTRAINT_FIXED);
const XMLCh* attrVal = attrDecl->getConstraintValue();
 
 
getConstraintType() always returns 0.
attrVal is always 0.
 
Note that other parameters in attrDecl seem to be OK.