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.
2010/9/10 Sandino Flores Moreno <tigrux gmail com>
I know you can use introspection to gather the properties
of a class. And that each property has information about its type, that way you can implement your own serialization methods. But, something like a serialization provided directly but gobject, I don't think there is one. 2010/9/10 Daniel Espinosa <esodan gmail com>:Exist XML Serialization like on XML.Serialization on C#/Mono/.Net forVala?I have a C# classes witch are serialized on a XML file using XML.Serialization, and I would like to port them to Vala. -- Trabajar, la mejor arma para tu superación "de grano en grano, se hace la arena" (R) (en trámite, pero para loscuates:LIBRE) -- Trabajar, la mejor arma para tu superación "de grano en grano, se hace la arena" (R) (en trámite, pero para loscuates:LIBRE) _______________________________________________ vala-list mailing list vala-list gnome org http://mail.gnome.org/mailman/listinfo/vala-list
-- Trabajar, la mejor arma para tu superación "de grano en grano, se hace la arena" (R) (en trámite, pero para los cuates: LIBRE) -- Trabajar, la mejor arma para tu superación "de grano en grano, se hace la arena" (R) (en trámite, pero para los cuates: LIBRE) -- Trabajar, la mejor arma para tu superación "de grano en grano, se hace la arena" (R) (en trámite, pero para los cuates: LIBRE)
Attachment:
xml-serialize.gaphor.tar.lzma
Description: application/lzma