Utilities

com.phasmidsoftware.xmldoc.core.Utilities
object Utilities

Object containing various utility methods for sequence filtering, XML parsing, and rendering XML nodes as strings. CONSIDER splitting this object among FP and XML.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Utilities.type

Members list

Value members

Concrete methods

def lensFilter[T, A](lens: T => A)(a: A)(ts: Seq[T]): Seq[T]

Method to filter a sequence of object according to a value and a lens function.

Method to filter a sequence of object according to a value and a lens function.

CONSIDER is there a method in the standard library which does this?

Type parameters

A

the type of the value to be matched.

T

the underlying type of the input and output sequences.

Value parameters

a

the value that must be matched.

lens

the function which will extract an A from a T.

ts

the sequence to be filtered.

Attributes

Returns

the filtered version of the sequence.

def parseUnparsed(w: String): Elem

The purpose of this method is to allow a String to be parsed as an XML entity, WITHOUT replace " by "

The purpose of this method is to allow a String to be parsed as an XML entity, WITHOUT replace " by "

Value parameters

w

the XML string to be parsed.

Attributes

Returns

an XML element.

def renderNode(node: Node, deep: Boolean = ...): String

Renders a detailed representation of an XML node, including its attributes, descendants, and optionally its children in a deep or shallow manner.

Renders a detailed representation of an XML node, including its attributes, descendants, and optionally its children in a deep or shallow manner.

Value parameters

deep

a boolean indicating if children should be rendered recursively. Defaults to false.

node

the XML node to be rendered.

Attributes

Returns

a string containing the rendered representation of the XML node.

def renderNodes(nodes: NodeSeq): String

Renders a sequence of XML nodes into a single formatted string.

Renders a sequence of XML nodes into a single formatted string.

Value parameters

nodes

the sequence of XML nodes to be rendered.

Attributes

Returns

a string representation of the rendered XML nodes.

def show(node: Node)(f: String => Unit = ...): IO[Unit]

Prints the rendered representation of an XML node using the provided function.

Prints the rendered representation of an XML node using the provided function.

Value parameters

f

the function used to output the rendered node as a string. Defaults to println.

node

the XML node to be rendered and displayed.

Attributes

Returns

an IO[Unit] representing the execution of the display action.