prop

package
v2.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(s string) string

Escape repaces ", &, ', < and > with their xml representation

func Next

func Next(d *xml.Decoder) (xml.Token, error)

Next returns the next token, if any, in the XML stream of d. RFC 4918 requires to ignore comments, processing instructions and directives. http://www.webdav.org/specs/rfc4918.html#property_values http://www.webdav.org/specs/rfc4918.html#xml-extensibility

Types

type ActiveLock

type ActiveLock struct {
	XMLName   xml.Name  `xml:"activelock"`
	Exclusive *struct{} `xml:"lockscope>exclusive,omitempty"`
	Shared    *struct{} `xml:"lockscope>shared,omitempty"`
	Write     *struct{} `xml:"locktype>write,omitempty"`
	Depth     string    `xml:"depth"`
	Owner     Owner     `xml:"owner,omitempty"`
	Timeout   string    `xml:"timeout,omitempty"`
	Locktoken string    `xml:"locktoken>href"`
	Lockroot  string    `xml:"lockroot>href,omitempty"`
}

ActiveLock holds active lock xml data

http://www.webdav.org/specs/rfc4918.html#ELEMENT_activelock

<!ELEMENT activelock (lockscope, locktype, depth, owner?, timeout?,

locktoken?, lockroot)>

type Owner

type Owner struct {
	InnerXML string `xml:",innerxml"`
}

Owner captures the inner UML of a lock owner element http://www.webdav.org/specs/rfc4918.html#ELEMENT_owner

type PropertyXML

type PropertyXML struct {
	// XMLName is the fully qualified name that identifies this property.
	XMLName xml.Name

	// Lang is an optional xml:lang attribute.
	Lang string `xml:"xml:lang,attr,omitempty"`

	// InnerXML contains the XML representation of the property value.
	// See http://www.webdav.org/specs/rfc4918.html#property_values
	//
	// Property values of complex type or mixed-content must have fully
	// expanded XML namespaces or be self-contained with according
	// XML namespace declarations. They must not rely on any XML
	// namespace declarations within the scope of the XML document,
	// even including the DAV: namespace.
	InnerXML []byte `xml:",innerxml"`
}

PropertyXML represents a single DAV resource property as defined in RFC 4918. http://www.webdav.org/specs/rfc4918.html#data.model.for.resource.properties

func Escaped

func Escaped(key, val string) PropertyXML

Escaped returns a new PropertyXML instance while replacing only * `&` with `&amp;` * `<` with `&lt;` * `>` with `&gt;` as defined in https://www.w3.org/TR/REC-xml/#syntax:

> The ampersand character (&) and the left angle bracket (<) must not appear > in their literal form, except when used as markup delimiters, or within a > comment, a processing instruction, or a CDATA section. If they are needed > elsewhere, they must be escaped using either numeric character references > or the strings " &amp; " and " &lt; " respectively. The right angle > bracket (>) may be represented using the string " &gt; ", and must, for > compatibility, be escaped using either " &gt; " or a character reference > when it appears in the string " ]]> " in content, when that string is not > marking the end of a CDATA section.

The code ignores errors as the legacy Escaped() does TODO properly use the space

func EscapedNS

func EscapedNS(namespace string, local string, val string) PropertyXML

EscapedNS returns a new PropertyXML instance while xml-escaping the value

func NotFound

func NotFound(key string) PropertyXML

NotFound returns a new PropertyXML instance with an empty value

func NotFoundNS

func NotFoundNS(namespace, key string) PropertyXML

NotFoundNS returns a new PropertyXML instance with the given namespace and an empty value

func Raw

func Raw(key, val string) PropertyXML

Raw returns a new PropertyXML instance for the given key/value pair TODO properly use the space

Jump to

Keyboard shortcuts

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