xs:anyType just means that the values element is compatible with any type
at all. It does, though, have to be a type that inherits from
pyxb.binding.basis._TypeBinding_mixin, i.e. a type that was defined from an
XML complexType or simpleType. A simple example:
import pyxb.bundles.opengis.oseo_1_0 as oseo
import pyxb.binding.datatypes as xs
pd = oseo.ParameterData(encoding='TextEncoding')
pd.values = xs.string("test data")
pd.toxml('utf-8')
Presumably instead of xsd.string() you want some complexType that has a
name attribute; I don't know anything about oseo so can't guess what you
should use. (I'd expect, though, in that case you would need to use
XmlEncoding instead of TextEncoding.)
http://schemas.opengis.net/SCHEMAS_OPENGIS_NET.tgz includes, along with the
schemas, some sample documents for oseo. Those might help in figuring out
what should be assigned to the values.
Peter
On Thu, Feb 20, 2014 at 6:34 PM, Ricardo Filipe Soares Garcia da <
ricardo.garcia.si...@gmail.com> wrote:
> Hi Peter
>
> I got it working now, thanks for your help!
>
> Now I am failing at building an oseo.ParameterData. I can't seem to create
> the 'values' element, which should be an AnyType element. I am still a
> beginner with these things so maybe this is something obvious...
>
> By the way, I am following the oseo specification section 7.3.9
> ParameterData, Figure 7-12, if it is relevant
>
> # Python code
> import pyxb
> import pyxb.bundles.opengis.oseo as oseo
> pd = oseo.ParameterData()
> pd.encoding = 'TextEncoding'
> pd.values = pyxb.BIND()
> pd.values.name = 'test option'
> pd.values = 'test value'
> pd.toxml()
>
> ...AttributeError: 'str' object has no attribute 'toDOM'
>
> Am I adding the 'name' attribute correctly? How can I set the 'values'
> element?
>
> Thanks in advance
>
>
>
> On Thu, Feb 20, 2014 at 3:12 PM, Peter Bigot <big...@acm.org> wrote:
>
>> You need to create the instance using an element, not the underlying
>> type, so PyXB can tell what string to put in the start and end tags of the
>> XML.
>>
>> See
>> https://sourceforge.net/p/pyxb/discussion/956708/thread/1204a2fa/#e804and
>> any or all of these three threads for more information:
>>
>> https://sourceforge.net/p/pyxb/discussion/956708/thread/1204a2fa/
>> https://sourceforge.net/p/pyxb/discussion/956708/thread/fe705025/
>> https://sourceforge.net/p/pyxb/discussion/956708/thread/5d5e0320/
>>
>> Peter
>>
>>
>>
>> On Thu, Feb 20, 2014 at 9:05 AM, Ricardo Filipe Soares Garcia da <
>> ricardo.garcia.si...@gmail.com> wrote:
>>
>>> Hi list
>>>
>>> I am trying to use a pyxb.bundles.opengis.oseo.DeliveryInformationType
>>> but keep getting an error. I want to create the element, fill it with
>>> values and then get its XML representation.
>>>
>>> # Python code
>>> import pyxb.bundles.opengis.oseo as oseo
>>> dit = oseo.DeliveryInformationType()
>>> dit.mailAddress = oseo.DeliveryAddressType(firstName='Ricardo')
>>> dit.toxml()
>>>
>>> UnboundElementError: Instance of type {
>>> http://www.opengis.net/oseo/1.0}DeliveryInformationType has no bound
>>> element for start tag
>>>
>>> I'm using pyxb version 1.2.3 downloaded from pypi
>>>
>>> How can I overcome this issue?
>>>
>>> Thanks in advance
>>>
>>> --
>>> ___________________________ ___ __
>>> Ricardo Garcia Silva
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Managing the Performance of Cloud-Based Applications
>>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>>> Read the Whitepaper.
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> pyxb-users mailing list
>>> pyxb-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/pyxb-users
>>>
>>>
>>
>
>
> --
> ___________________________ ___ __
> Ricardo Garcia Silva
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> pyxb-users mailing list
> pyxb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyxb-users
>
>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users