[Xerte] Re: Converting an object to xml

Kemp Johnathan johnathan.kemp at ntlworld.com
Wed Mar 7 15:17:02 GMT 2012


The problem I was trying to solve was one of having an object in a page,
being able to dump that object as xml data to a file and then being able to
recreate that object from the xml data by reloading the file at a later
date.

So if you started with the object
node[0].att

When it was converted to xml would it matter if it was generated as

<node att="value">
or
<node><att>value</att></node>

since either approach would recreate as an object as

node[0].att

I can understand that if you were starting with the xml you would not know
which format of xml to create when converting back from the object you
created and that therefore you could end up with a different XML structure
to that which you started with. But if you were starting off from the
object, would it not be feasible to have a conversion routine that always
adopted the same approach when converting from an object to the xml data.
Thus making it possible to consistently convert from the object to the xml
and back again? (I know I am talking theoretically here - how you would
achieve it I am not currently sure).

Is there something fundamental about xml that I am failing to grasp here?

Kind regards

Johnathan

On 7 March 2012 12:05, Julian Tenney <Julian.Tenney at nottingham.ac.uk> wrote:

> I don’t think you’re going to get bi-directional because
>
>
>
> <node att=”value”> is node[0].att and <node><att>value</att></node> is
> node[0].att
>
>
>
> *From:* xerte-bounces at lists.nottingham.ac.uk [mailto:
> xerte-bounces at lists.nottingham.ac.uk] *On Behalf Of *Kemp Johnathan
>
> *Sent:* 07 March 2012 11:21
> *To:* Xerte discussion list
> *Subject:* [Xerte] Re: Converting an object to xml
>
>
>
> What I was hoping to achieve was a bi-directional capability i.e.
>
>
>
> you could go back and forth, perhaps creating your initial object from xml
> data, then modify the object in a page, then save it out as xml again. Then
> the next time you load the page you have the option of restoring a your
> previously saved data.
>
>
>
> Kind regards
>
>
>
> Johnathan
>
>
>
> On 7 March 2012 11:03, Julian Tenney <Julian.Tenney at nottingham.ac.uk>
> wrote:
>
> Good question. No, not currently. Have a look for a prototype extension
> and I can build it in if it does what you want: it would probably not
> create attributes, rather full nodes for each value, and it would have to
> make some assumptions when naming things I think:
>
>
>
> <object>
>
>   <property>value</property>
>
>   <array>
>
>     <item>value</item>
>
>     ….
>
>   </array>
>
>>
> </object>
>
>
>
> *From:* xerte-bounces at lists.nottingham.ac.uk [mailto:
> xerte-bounces at lists.nottingham.ac.uk] *On Behalf Of *Kemp Johnathan
> *Sent:* 07 March 2012 10:40
> *To:* Xerte discussion list
> *Subject:* [Xerte] Converting an object to xml
>
>
>
> Xerte has the myXML.toObject() method that will construct an object from
> xml data.
>
>
>
> Is there an easy way to go in the other direction and convert an object
> into XML data?
>
>
>
> Kind regards
>
>
>
> Johnathan
>
>
>
> This message and any attachment are intended solely for the addressee and
> may contain confidential information. If you have received this message in
> error, please send it back to me, and immediately delete it. Please do not
> use, copy or disclose the information contained in this message or in any
> attachment. Any views or opinions expressed by the author of this email do
> not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an
> attachment may still contain software viruses which could damage your
> computer system: you are advised to perform your own checks. Email
> communications with the University of Nottingham may be monitored as
> permitted by UK legislation.
>
>
> _______________________________________________
> Xerte mailing list
> Xerte at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>
> This message and any attachment are intended solely for the addressee and
> may contain confidential information. If you have received this message in
> error, please send it back to me, and immediately delete it.   Please do
> not use, copy or disclose the information contained in this message or in
> any attachment.  Any views or opinions expressed by the author of this
> email do not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
>
>
>
> _______________________________________________
> Xerte mailing list
> Xerte at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>
> This message and any attachment are intended solely for the addressee and
> may contain confidential information. If you have received this message in
> error, please send it back to me, and immediately delete it.   Please do
> not use, copy or disclose the information contained in this message or in
> any attachment.  Any views or opinions expressed by the author of this
> email do not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20120307/aaee5eed/attachment-0001.html>


More information about the Xerte mailing list