Cool Thanks Peter :)
On Fri, Oct 9, 2015 at 12:33 PM, Peter Bigot <pabi...@gmail.com> wrote: > Normally you would simply use the contained element as an object, and if > you needed to know the type use standard Python operations. For example: > > >>> print(fes_2_0.PropertyIsEqualTo == e._element()) > True > >>> e = f1.content()[0] > >>> print type(e) > <class 'pyxb.bundles.opengis.raw.fes_2_0.BinaryComparisonOpType'> > >>> print isinstance(e, fes_2_0.BinaryComparisonOpType) > True > > However it appears that schema encodes the type of the comparison in the > element tag itself rather than as an attribute of the type. For that you > need to compare the element against the available options, using a > back-door function to get the element associated with the object: > > >>> print e._element() > Element {http://www.opengis.net/fes/2.0}PropertyIsEqualTo > >>> print fes_2_0.PropertyIsEqualTo == e._element() > True > > Peter > > On Thu, Oct 8, 2015 at 7:40 PM, Ricardo Filipe Soares Garcia da < > ricardo.garcia.si...@gmail.com> wrote: > >> Hi all >> >> I'm trying to use PyXB with the opengis fes_2_0 schema. >> >> I've installed the schemas as per the instructions in [1] and they seem >> to work OK. >> Now I am parsing one of the examples present in the OGC schema >> repository[2]. I am able to parse the example, as in: >> >> >>> import pyxb.bundles.opengis.fes_2_0 as fes_2_0 >> >>> f1 = >> fes_2_0.CreateFromDocument(open("/home/ricardo/Downloads/SCHEMAS_OPENGIS_NET/filter/2.0/examples/3.2.1/filter01.xml").read()) >> >> >> Now I'd like to know what type of filter I have just parsed, but I cannot >> seem to find any way to do it (other than calling the .toxml() method). >> >> >> >>> predicate = f1.content()[0] # now what type of predicate is this? >> >> If I call >> >> >>> predicate.toxml() >> u'<?xml version="1.0" ?><ns1:PropertyIsEqualTo xmlns:ns1=" >> http://www.opengis.net/fes/2.0 >> "><ns1:ValueReference>SomeProperty</ns1:ValueReference><ns1:Literal>100</ns1:Literal></ns1:PropertyIsEqualTo>' >> >> I can see that it is a fes:PropertyIsEqualTo operator. However I am not >> finding any other way to extract this information from the object. How can >> retrieve it? >> >> Thanks a lot >> >> >> [1] - >> https://github.com/pabigot/pyxb/blob/next/pyxb/bundles/opengis/README.txt >> [2] - http://schemas.opengis.net/filter/2.0/examples/3.2.1/filter01.xml >> >> -- >> ___________________________ ___ __ >> Ricardo Garcia Silva >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> pyxb-users mailing list >> pyxb-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/pyxb-users >> >> > -- ___________________________ ___ __ Ricardo Garcia Silva
------------------------------------------------------------------------------
_______________________________________________ pyxb-users mailing list pyxb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyxb-users