Re: [Generateds-discuss] Using parseLiteral()
Brought to you by:
dkuhlman
|
From: Dave K. <dku...@da...> - 2022-05-07 16:12:17
|
Pete,
Great. Glad you found that.
I'll apply your improved patch for stripping whitespace from around
boolean values Monday.
Dave
Quoting Pete Forman <pe...@gm...>:
> I have resolved the parseLiteral() failure by RTFM. I needed to use the
> --export option to generateDS.py.
>
> It turns out that literals are for the XML where I was trying to extract
> the expanded XSD.
>
> The django extract and generate scripts should help me on my way.
>
> --
> Pete Forman
>
>
>
> On Fri, 6 May 2022 at 11:17, Pete Forman <pe...@gm...> wrote:
>
>> My high level goal is to read an XML schema (XSD), expand its imports and
>> extract the types. I can use XPath on my XML document to extract values as
>> text. I'd like then to use XPath or similar on the XSD to correctly coerce
>> the text values to their types.
>>
>> It looks as if parseLiteral() / exportLiteral() might do the trick.
>> However I have not been able to use them. I've got the test data and this
>> successfully pretty prints the XML.
>>
>> $ python3 -c "import people; people.parse('people.xml')"
>>
>> I've tried a number of things but they all are unable to resolve
>> exportLiteral().
>>
>> $ python3 -c "import people; people.parseLiteral('people.xml')"
>> #from people import *
>>
>> import people as model_
>>
>> rootObj = model_.rootClass(
>> Traceback (most recent call last):
>> File "<string>", line 1, in <module>
>> File "[...]/people.py", line 3345, in parseLiteral
>> rootObj.exportLiteral(sys.stdout, 0, name_=rootTag)
>> AttributeError: 'people' object has no attribute 'exportLiteral'
>>
>> --
>> Pete Forman
>>
>>
>>
>>
--
Dave Kuhlman
http://www.davekuhlman.org
|