From 78e02f5cfeb931db9cdb32f0414f7bf448f3115d Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 6 Jul 2011 16:02:37 +0100 Subject: [PATCH] [webp] Added start element function --- src/moonshot-id.vala | 2 +- src/moonshot-webp-parser.vala | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/moonshot-id.vala b/src/moonshot-id.vala index a68af68..9496970 100644 --- a/src/moonshot-id.vala +++ b/src/moonshot-id.vala @@ -21,7 +21,7 @@ public class IdCard : Object public string issuer { get; set; default = null; } - public Rule[] rules; + public Rule[] rules {get; set; default = {};} public TrustAnchor trust_anchor { get; set; default = new TrustAnchor (); } diff --git a/src/moonshot-webp-parser.vala b/src/moonshot-webp-parser.vala index 4d7969c..36f08a0 100644 --- a/src/moonshot-webp-parser.vala +++ b/src/moonshot-webp-parser.vala @@ -1,6 +1,7 @@ namespace WebProvisioning { - public IdCard card; + IdCard card; + IdCard[] cards; bool check_stack (SList stack, string[] reference) @@ -80,10 +81,20 @@ namespace WebProvisioning return check_stack (stack, display_name_path); } + + public void + start_element_func (MarkupParseContext context, + string element_name, + string[] attribute_names, + string[] attribute_values) throws MarkupError + { + debug ("START %s", element_name); + } - public void text_element_func (MarkupParseContext context, - string text, - size_t text_len) throws MarkupError + public void + text_element_func (MarkupParseContext context, + string text, + size_t text_len) throws MarkupError { unowned SList stack = context.get_element_stack (); @@ -162,6 +173,8 @@ namespace WebProvisioning error ("Could not retreive file size"); } + card = new IdCard(); + MarkupParser parser = {null, null, text_element_func, null, null}; var ctx = new MarkupParseContext(parser, 0, null, null); @@ -189,8 +202,6 @@ namespace WebProvisioning error ("%s does not exist", args[1]); } - card = new IdCard(); - var webp = new WebProvisionParser (args[1]); debug ("'%s' '%s' '%s' '%s'", card.display_name, card.username, card.password, card.issuer); -- 2.1.4