Esempio n. 1
0
        public GumboWrapper(string html, bool stopOnFirstError = false, int maxErrors = -1, int tabStopSize = 8)
        {
            _Options = new GumboOptions();
            NativeMethods.gumbo_set_options_defaults(ref _Options);
            _Options.max_errors = maxErrors;
            _Options.stop_on_first_error = stopOnFirstError;
            _Html = NativeUtf8Helper.NativeUtf8FromString(html);

            _OutputPtr = NativeMethods.gumbo_parse(_Html);
            var output = (GumboOutput)Marshal.PtrToStructure(_OutputPtr, typeof(GumboOutput));
            _GumboDocumentNode = output.GetDocument();
            Errors = output.GetErrors();

            var lazyFactory = new DisposalAwareLazyFactory(() => this._Disposed, typeof(GumboWrapper).Name);
            Document = new DocumentWrapper(_GumboDocumentNode, lazyFactory, AddElementWithId);
        }
Esempio n. 2
0
 public static extern void gumbo_set_options_defaults(ref GumboOptions options);
Esempio n. 3
0
 public static extern void gumbo_destroy_output(ref GumboOptions options, IntPtr output);
Esempio n. 4
0
 public static extern IntPtr gumbo_parse_with_options(ref GumboOptions options, IntPtr buffer, [MarshalAs(UnmanagedType.SysUInt)] uint buffer_length);
Esempio n. 5
0
 public static extern void gumbo_set_options_defaults(ref GumboOptions options);
Esempio n. 6
0
 public static extern IntPtr gumbo_parse_with_options(ref GumboOptions options, IntPtr buffer, [MarshalAs(UnmanagedType.SysUInt)] uint buffer_length);
Esempio n. 7
0
 public static extern void gumbo_destroy_output(ref GumboOptions options, IntPtr output);