[gnome-builder] xml-pack: set options for doc to validate



commit 019b6fe600e352199fd76d69eece09e5b0899e1b
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Thu Sep 14 21:57:45 2017 +0200

    xml-pack: set options for doc to validate
    
    When creating the xml doc before validation, we need to set some options:
    
    - no errors and warning so we don't see them on terminal.
    - compact to gain some memory space.
    - recover to not stop on errors if possible.

 plugins/xml-pack/ide-xml-tree-builder.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-tree-builder.c b/plugins/xml-pack/ide-xml-tree-builder.c
index 1d1d86d..11ea220 100644
--- a/plugins/xml-pack/ide-xml-tree-builder.c
+++ b/plugins/xml-pack/ide-xml-tree-builder.c
@@ -267,6 +267,7 @@ ide_xml_tree_builder_parse_worker (GTask        *task,
   xmlDoc *doc;
   gsize doc_size;
   IdeXmlSchemaKind kind;
+  gint parser_flags;
 
   g_assert (IDE_IS_XML_TREE_BUILDER (self));
   g_assert (G_IS_TASK (task));
@@ -283,7 +284,11 @@ ide_xml_tree_builder_parse_worker (GTask        *task,
   xmlInitParser ();
 
   doc_data = g_bytes_get_data (state->content, &doc_size);
-  if (NULL != (doc = xmlParseMemory (doc_data, doc_size)))
+  parser_flags = XML_PARSE_RECOVER | XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_COMPACT;
+  if (NULL != (doc = xmlReadMemory (doc_data,
+                                    doc_size,
+                                    NULL, NULL,
+                                    parser_flags)))
     {
       doc->URL = (guchar *)g_file_get_uri (state->file);
 


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