gokogiri

package module
v0.0.0-...-37eb07c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 2 Imported by: 0

README

Gokogiri

Original Repo

https://github.com/moovweb/gokogiri

Need for creating a fork of this repo in Runscope

The latest version of this Repo has an open defect wherein we're getting the below error.

# github.com/moovweb/gokogiri/xml
../../github.com/moovweb/gokogiri/xml/document.go:330:19: identifier "_Ctype_struct__xmlDoc" may conflict with identifiers generated by cgo

To fix this issue, we had to fork it out in Runscope as the original owner is not merging an open PR https://github.com/moovweb/gokogiri/pull/97

If in future there are changes in the original repo, we may need to take a pull every time to sync it up with the original repo.

Documentation

Overview

The gokogiri package provides a Go interface to the libxml2 library.

It is inspired by the ruby-based Nokogiri API, and allows one to parse, manipulate, and create HTML and XML documents. Nodes can be selected using either CSS selectors (in much the same fashion as jQuery) or XPath 1.0 expressions, and a simple DOM-like inteface allows for building up documents from scratch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseHtml

func ParseHtml(content []byte) (doc *html.HtmlDocument, err error)

ParseHtml parses an UTF-8 encoded byte array and returns an html.HtmlDocument. It uses parsing default options that ignore errors or warnings, making it suitable for the poorly-formed 'tag soup' often found on the web.

If the content is not UTF-8 encoded or you want to customize the parsing options, you should call html.Parse directly.

func ParseXml

func ParseXml(content []byte) (doc *xml.XmlDocument, err error)

ParseXml parses an UTF-8 encoded byte array and returns an xml.XmlDocument. By default the parsing options ignore validation and suppress errors and warnings. This allows one to liberal in accepting badly-formed documents, but is not standards-compliant.

If the content is not UTF-8 encoded or you want to customize the parsing options, you should call the Parse or ReadFile functions found in the github.com/Runscope/gokogiri/xml package. The xml.StrictParsingOption is conveniently provided for standards-compliant behaviour.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL