GData.Parsable

g GData.Parsable GData.Parsable GObject.Object GObject.Object GObject.Object->GData.Parsable

Subclasses:

GData.APPCategories, GData.Author, GData.Category, GData.DocumentsMetadata, GData.DocumentsProperty, GData.Entry, GData.Feed, GData.GContactCalendar, GData.GContactEvent, GData.GContactExternalID, GData.GContactJot, GData.GContactLanguage, GData.GContactRelation, GData.GContactWebsite, GData.GDEmailAddress, GData.GDIMAddress, GData.GDName, GData.GDOrganization, GData.GDPhoneNumber, GData.GDPostalAddress, GData.GDReminder, GData.GDWhen, GData.GDWhere, GData.GDWho, GData.Generator, GData.Link, GData.MediaCategory, GData.MediaContent, GData.MediaCredit, GData.MediaThumbnail, GData.YouTubeState

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new_from_json (parsable_type, json, length)

class

new_from_xml (parsable_type, xml, length)

get_content_type ()

get_json ()

get_xml ()

Virtual Methods

Inherited:

GObject.Object (7)

do_get_json (builder)

do_get_namespaces (namespaces)

do_get_xml (xml_string)

do_parse_json (reader, *user_data)

do_parse_xml (doc, node, *user_data)

do_post_parse_json (*user_data)

do_post_parse_xml (*user_data)

do_pre_get_xml (xml_string)

do_pre_parse_xml (doc, root_node, *user_data)

Properties

Name

Type

Flags

Short Description

constructed-from-xml

bool

r/w/co

Specifies whether the object was constructed by parsing XML or manually.

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GData.Parsable(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

GData.ParsableClass

All the fields in the GData.Parsable structure are private and should never be accessed directly.

New in version 0.3.0.

classmethod new_from_json(parsable_type, json, length)
Parameters:
  • parsable_type (GObject.GType) – the type of the class represented by the JSON

  • json (str) – the JSON for just the parsable object

  • length (int) – the length of json, or -1

Raises:

GLib.Error

Returns:

a new GData.Parsable, or None; unref with GObject.Object.unref()

Return type:

GData.Parsable

Creates a new GData.Parsable subclass (of the given parsable_type) from the given json.

An object of the given parsable_type is created, and its parse_json and post_parse_json class functions called on the JSON node obtained from json. post_parse_json is called once on the root node, while parse_json is called for each of the node’s members.

If length is -1, json will be assumed to be nul-terminated.

If an error occurs during parsing, a suitable error from GData.ParserError will be returned.

New in version 0.15.0.

classmethod new_from_xml(parsable_type, xml, length)
Parameters:
  • parsable_type (GObject.GType) – the type of the class represented by the XML

  • xml (str) – the XML for just the parsable object, with full namespace declarations

  • length (int) – the length of xml, or -1

Raises:

GLib.Error

Returns:

a new GData.Parsable, or None; unref with GObject.Object.unref()

Return type:

GData.Parsable

Creates a new GData.Parsable subclass (of the given parsable_type) from the given xml.

An object of the given parsable_type is created, and its pre_parse_xml, parse_xml and post_parse_xml class functions called on the XML tree obtained from xml. pre_parse_xml and post_parse_xml are called once each on the root node of the tree, while parse_xml is called for each of the child nodes of the root node.

If length is -1, xml will be assumed to be null-terminated.

If an error occurs during parsing, a suitable error from GData.ParserError will be returned.

New in version 0.4.0.

get_content_type()
Returns:

the parsable’s content type

Return type:

str

Returns the content type upon which the GData.Parsable is built. For example, application/atom+xml or application/json.

New in version 0.17.7.

get_json()
Returns:

the object’s JSON; free with GLib.free()

Return type:

str

Builds a JSON representation of the GData.Parsable in its current state, such that it could be inserted on the server. The JSON is valid for stand-alone use.

New in version 0.15.0.

get_xml()
Returns:

the object’s XML; free with GLib.free()

Return type:

str

Builds an XML representation of the GData.Parsable in its current state, such that it could be inserted on the server. The XML is guaranteed to have all its namespaces declared properly in a self-contained fashion, and is valid for stand-alone use.

New in version 0.4.0.

do_get_json(builder) virtual
Parameters:

builder (Json.Builder) –

do_get_namespaces(namespaces) virtual
Parameters:

namespaces ({object: object}) –

do_get_xml(xml_string) virtual
Parameters:

xml_string (GLib.String) –

do_parse_json(reader, *user_data) virtual
Parameters:
Return type:

bool

do_parse_xml(doc, node, *user_data) virtual
Parameters:
Return type:

bool

do_post_parse_json(*user_data) virtual
Parameters:

user_data (object or None) –

Return type:

bool

do_post_parse_xml(*user_data) virtual
Parameters:

user_data (object or None) –

Return type:

bool

do_pre_get_xml(xml_string) virtual
Parameters:

xml_string (GLib.String) –

do_pre_parse_xml(doc, root_node, *user_data) virtual
Parameters:
Return type:

bool

Property Details

GData.Parsable.props.constructed_from_xml
Name:

constructed-from-xml

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Specifies whether the object was constructed by parsing XML or manually.

New in version 0.7.0.