MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / NewDocument

Function NewDocument

xmlparser/document.go:11–25  ·  view source on GitHub ↗
(r io.Reader)

Source from the content-addressed store, hash-verified

9}
10
11func NewDocument(r io.Reader) (*Document, error) {
12 doc := &Document{
13 Node: Node{
14 // Attributes for document are always empty, but they are exposed,
15 // so we need to initialize them to avoid nil pointer dereference.
16 Attrs: NewAttributes(),
17 },
18 }
19
20 if err := doc.readFrom(r); err != nil {
21 return nil, err
22 }
23
24 return doc, nil
25}
26
27// ReplaceEntities replaces XML entities in the document
28// according to the entity declarations in the DOCTYPE.

Callers 4

TestDocumentParsingFunction · 0.92
TestEntityReplacementFunction · 0.92
BenchmarkDocumentParsingFunction · 0.92
sanitizeMethod · 0.92

Calls 2

NewAttributesFunction · 0.85
readFromMethod · 0.80

Tested by 3

TestDocumentParsingFunction · 0.74
TestEntityReplacementFunction · 0.74
BenchmarkDocumentParsingFunction · 0.74