You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks a lot for the django-xml, it is pretty nice to work for XML files. and I have 2 questions when keep me in trouble for several weeks, could you help to explain for it?
In your advance exmaple, the element etnries is mapped via following code
entries = xmlmodels.XPathListField("/atom:feed/atom:entry", required=False)
then it will return a node_set list to entries field, but how can map as a list of plain object? The plain object looks like
class entry
title = xmlmodels.XPathTextFiled("("/atom:feed/atom:entry/atom:title)
.....
I tried lxml_extension to map each element as the plain object ,but it reports "This is not a supported node-set result: <entry: entry object>", do you have any solution for this?
is it possible to store the XmlModel back into database after parser the XML?
The text was updated successfully, but these errors were encountered:
To answer you first question: yes, there is a way to do what you're asking. django-xml has "embedded" fields which act similarly to the Django ForeignKey fields (the code can be found here). Here is how you would point each atom:entry to an instance of another XmlModel:
With regard to your second question, I'm afraid the answer is no. I have not built the functionality that would allow setting data and serializing it back to XML. I can definitely see the usefulness of such a feature, but I haven't ever gotten around to writing it.
Thanks a lot for your kindly support. Via the experience in C#, serialize/deserialize from/to XML is really an elegant method to deal with markup files. And I also like to see any method to serialzie the XmlModel into database, as we know, it is hard to doing statistics across XML.
Thanks a lot for the django-xml, it is pretty nice to work for XML files. and I have 2 questions when keep me in trouble for several weeks, could you help to explain for it?
entries = xmlmodels.XPathListField("/atom:feed/atom:entry", required=False)
then it will return a node_set list to entries field, but how can map as a list of plain object? The plain object looks like
class entry
title = xmlmodels.XPathTextFiled("("/atom:feed/atom:entry/atom:title)
.....
I tried lxml_extension to map each element as the plain object ,but it reports "This is not a supported node-set result: <entry: entry object>", do you have any solution for this?
The text was updated successfully, but these errors were encountered: