Beispiel #1
0
        public Gumbo(string html, GumboLibraryOptions?options = null)
        {
            _options   = CreateOptions(options);
            _html      = NativeUtf8.NativeUtf8FromString(html);
            _outputPtr = NativeMethods.gumbo_parse(_html);
            var output = Marshal.PtrToStructure <GumboOutput>(_outputPtr);

            _gumboDocumentNode = output.GetDocument();
            Errors             = output.GetErrors();
            var lazyFactory = new LazyFactory(() => _disposed, typeof(Gumbo).Name);

            _gumboFactory = new GumboFactory(lazyFactory);
            Document      = (Document)_gumboFactory.CreateNode(_gumboDocumentNode);
        }
Beispiel #2
0
 /// <summary>
 /// Release the memory used for the parse tree and parse errors.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="output"></param>
 [DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)] public static extern void gumbo_destroy_output(ref GumboOptions options, IntPtr output);
Beispiel #3
0
 /// <summary>
 /// Extended version of <see cref="gumbo_parse"/> that takes an explicit options structure,
 /// buffer, and length.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="buffer"></param>
 /// <param name="buffer_length"></param>
 /// <returns></returns>
 [DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr gumbo_parse_with_options(ref GumboOptions options, IntPtr buffer, [MarshalAs(UnmanagedType.SysUInt)] uint buffer_length);
Beispiel #4
0
 public static extern IntPtr gumbo_parse_with_options(ref GumboOptions options, IntPtr buffer, [MarshalAs(UnmanagedType.SysUInt)] uint buffer_length);
Beispiel #5
0
 public static extern void gumbo_destroy_output(ref GumboOptions options, IntPtr output);
Beispiel #6
0
 public static extern void gumbo_destroy_output(ref GumboOptions options, IntPtr output);
Beispiel #7
0
 public static extern IntPtr gumbo_parse_with_options(ref GumboOptions options, IntPtr buffer, [MarshalAs(UnmanagedType.SysUInt)] uint buffer_length);