mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-12-23 22:11:10 +02:00
* Use XML parser based on encoding/xml * Implement raw XML parser * Speed-up xml parser * Add line number to XML parser syntax errors * Add svgparser.StartElement.SelfClosing * Utilize bufio.Reader.ReadSlice in XML parser * Polish XML parser tests; Add XML parser benchmark * Move XML parser to ./xmlparser * Use all XML parser tokens as pointers * Add xmlparser.Document.ReplaceEntities method * Combine xmlparser.Text and xmlparset.CData * Optimize entities replacement in xmlparser * xmlparser.parseEntityMap: ignore comments * xmlparser: add document parsing benchmark * xmlparser: Refactor attributes * xmlparser: simplify Attributes.Filter * xmlparser: add Attributes.Has, Node.FilterChildren, and Node.FilterChildNodes * xmlparser: add Node.ChildNodes
22 lines
383 B
Go
22 lines
383 B
Go
package xmlparser
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/imgproxy/imgproxy/v3/errctx"
|
|
)
|
|
|
|
type (
|
|
SyntaxError struct{ *errctx.TextError }
|
|
)
|
|
|
|
func newSyntaxError(msg string, args ...any) error {
|
|
return SyntaxError{errctx.NewTextError(
|
|
fmt.Sprintf(msg, args...),
|
|
1,
|
|
errctx.WithPublicMessage("SVG syntax error"),
|
|
errctx.WithStatusCode(http.StatusUnprocessableEntity),
|
|
)}
|
|
}
|