Re: [Vala] Fwd: Fwd: XML Serialization



When convert on memory representation of information to XML, may the model
have temporal values not to be serialize; then you need to "mark" what
properties you want to serialize.

For XML you need to establish if your XML serialization includes name spaces
or other information; if the Xml.Node's name is the same of the class' name
or you need a custom one (GtkImage could be <gtkimage> or just <image>); and
the same for Node's attributes.

Childs nodes (other GObjects properties), must include the same information.

Is this class libraries useful for any budy? I haven't time enough to full
time development. I need help to figure out and hack on it as far as my free
time helps.

2010/9/14 Luca Bruno <lethalman88 gmail com>

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCAAGBQJMj6XTAAoJEETrFmfSwntrR3oQAJvHKhWZjenK+daJ5mX4w6mJ
4eMn9cR7B0TOsYmAdWQy6BSPOehSJSyIIhFhOVng3wz51yTveQLy6qoKmdq+BnUQ
g0CaKQkrZZP75po3ExqfXIcC4txygylC2Yn/q6GENu1mqPWFGXO/KCakZKwZI9/e
6d16lqHjwFXxXSDcCi8aekKlA4E0Uq6+h34XFVpFH5imFkRwdDZYnrcQtDVXGoHc
11oj3SGzFY2MY5pD2SsgvbyIYoccM6o/RQkL06wWo/jwsLyr81OGEPtWAMm5KFDz
UICJg8hU5EHHDxF1MPEdq3mIXZJsWSgNKLvLaojOfVIHUd7DFm4fkgsbJAzNNymp
7lP29Hgx1mmrMouQtuxWKGengx8thDXceG5mQUbY8b2YqIYbXGaWosRWs3efmUbI
2yVXp9xPtzd2xP/GNh5AZRdsU9LCQzOPTsjun8r/fbicKK4yJNypqda9hzRJoyUV
a0owdm8+8KrdhV98OcbGjkX2PJ189FGtWIi+ocUE4PRAlTCHS4CLxmfmOYfn0cOO
vMsV97luNfFiHJb44nvcKZfFS0oZxTDXy3E4g+Yc/7Jh0K8QoCxQfLb7P2zHR3+A
QzYPaUluK0rPxADm63bTNlWH0mL1YbOrvoGszj4b3sILTGXql6HZ//8u+fMyMDBI
T00TiBUZun+qOpXYOOG9
=8Sm1
-----END PGP SIGNATURE-----




-- 
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)


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