Issue with Complex type with content type SIMPLE 

I am having problems trying to access the content of an element. Any idea what 
I should do? 


>> example.Field[0].Name #works 
status 

>> example.Field[0].Value #doesn't work 
>> example.Field[0].Value.value #doesn't work 
>> example.Field[0].Value.ReferenceValue #doesn't work 


Here is the snippet of the xml and xsd: 

xml: 
  <Field Name="status"> 
    <Value ReferenceValue="Some Ref Value">Open</Value> 
  </Field> 

xsd>: 
  <xs:element name="Field" maxOccurs="unbounded"> 
    <xs:annotation> 
      <xs:documentation>A single field.</xs:documentation> 
    </xs:annotation> 
    <xs:complexType> 
      <xs:sequence> 
        <xs:element name="Value" minOccurs="0" maxOccurs="unbounded"> 
          <xs:annotation> 
            <xs:documentation>The current value of the field in this entity 
instance. Multi-value fields contain multi-value elements. Reference fields 
contain the ReferenceValue attribute.</xs:documentation> 
          </xs:annotation> 
          <xs:complexType> 
            <xs:simpleContent> 
              <xs:extension base="xs:string"> 
                <xs:attribute name="ReferenceValue" type="xs:string" 
use="optional"/> 
              </xs:extension> 
            </xs:simpleContent> 
          </xs:complexType> 
        </xs:element> 
      </xs:sequence> 
      <xs:attribute name="Name" type="xs:string" use="required"> 
        <xs:annotation> 
          <xs:documentation>The field name.</xs:documentation> 
        </xs:annotation> 
      </xs:attribute> 
    </xs:complexType> 
  </xs:element> 

Generated class: 
  
# Complex type [anonymous] with content type SIMPLE 
class CTD_ANON_3 (pyxb.binding.basis.complexTypeDefinition): 
    """The current value of the field in this entity instance. Multi-value 
fields contain multi-value elements. Reference fields contain the 
ReferenceValue attribute.""" 
    _TypeDefinition = pyxb.binding.datatypes.string 
    _ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_SIMPLE 
    _Abstract = False 
    _ExpandedName = None 
    _XSDLocation = 
pyxb.utils.utility.Location('C:\\Temp\\rest\\xsd\\Entity.xsd', 25, 11) 
    # Base type is pyxb.binding.datatypes.string 
    
    # Attribute ReferenceValue uses Python identifier ReferenceValue 
    __ReferenceValue = 
pyxb.binding.content.AttributeUse(pyxb.namespace.ExpandedName(None, 
u'ReferenceValue'), 'ReferenceValue', 
'__AbsentNamespace0_CTD_ANON_3_ReferenceValue', pyxb.binding.datatypes.string) 
    __ReferenceValue._DeclarationLocation = 
pyxb.utils.utility.Location('C:\\Temp\\rest\\xsd\\Entity.xsd', 28, 14) 
    __ReferenceValue._UseLocation = 
pyxb.utils.utility.Location('C:\\Temp\\rest\\xsd\\Entity.xsd', 28, 14) 
    
    ReferenceValue = property(__ReferenceValue.value, __ReferenceValue.set, 
None, None) 


    _ElementMap = { 
        
    } 
    _AttributeMap = { 
        __ReferenceValue.name() : __ReferenceValue 
    } 


Regards,
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users

Reply via email to