Re: [Vala] Fwd: Fwd: XML Serialization



On Tue, Sep 14, 2010 at 11:09:15AM -0500, Daniel Espinosa wrote:
I'm trying to figure out how to implement a serialization to XML could be.

Find attached a Graphor's file, using UML, where I trying to model the
required infrastructure for this to be done.

Actual C# XML serialization use attributes and classes annotations, with
almost all information required to construct the XML representation of the
object. I don't know if Vala compiler could be extended to reach this.

Any way, I've found that may be is needed a base class Serializable, in
order to create Attribute and Node class representation of the derived
Object. The last must construct its own representation on construction
time.

Does Vala could use custom annotations by a package imported by the <using>
directive? If Vala compiler could translate this information to code could
be really useful.

Example:

[Xml.Serialization.Node: nodetype=root, ns=custome_name_space,
xmlversion=1.0]
class RootNode {

    [Xml.Serialization.Attribute: name=node1, xmltype=tp]
    string node1;
}

I'm sure this is not a valid information to declare a valid Root and XML
document, but just is an example.

With this annotations this class could be parsed to code to derive from
Serializable class, a root node with a custome name space and a xml document
version 1.0. This Node will have an attribute called node1 type tp with a
value from the class field's node1.

There's no such feature. Think you can actually use GObject properties to
inspect a class and therefore write down your XML serializer quite easily.

---
http://www.debian.org - The Universal Operating System

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]