Note: This API documentation is for FAKE version 4. The migration API documentation can be found here. The API documentation for the new fake 5 modules can be found here

XMLHelper

Contains functions to read and write XML files.

Functions and values

Function or valueDescription
DocElement(doc)
Signature: doc:XmlDocument -> XmlElement

Gets the DocumentElement of the XmlDocument

getAttribute name node
Signature: name:string -> node:'a -> string
Type parameters: 'a

Gets the attribute with the given name from the given XmlNode

getChilds(node)
Signature: node:'a -> seq<XmlNode>
Type parameters: 'a

Gets a sequence of all child nodes for the given XmlNode

getSubNode name node
Signature: name:string -> node:XmlNode -> XmlNode

Gets the first sub node with the given name from the given XmlNode

parse name f node
Signature: name:string -> f:('a -> 'b) -> node:'a -> 'b
Type parameters: 'a, 'b

Parses a XmlNode

parseSubNode name f
Signature: name:string -> f:(XmlNode -> 'a) -> XmlNode -> 'a
Type parameters: 'a

Parses a XML subnode

XmlAttribute name value writer
Signature: name:string -> value:'?13703 -> writer:XmlTextWriter -> XmlTextWriter
Type parameters: '?13703

Writes an XML attribute to current element of the given XmlTextWriter

XmlCDataElement elementName data writer
Signature: elementName:string -> data:string -> writer:XmlTextWriter -> XmlTextWriter

Writes an CData element to the given XmlTextWriter

XmlComment comment writer
Signature: comment:string -> writer:XmlTextWriter -> XmlTextWriter

Writes an XML comment to the given XmlTextWriter

XMLDoc(text)
Signature: text:string -> XmlDocument

Loads the given text into a XmlDocument

XmlEndElement(writer)
Signature: writer:XmlTextWriter -> XmlTextWriter

Writes an XML end element to the given XmlTextWriter

XmlPoke fileName xpath value
Signature: fileName:string -> xpath:string -> value:string -> unit

Replaces text in a XML file at the location specified by a XPath expression.

XmlPokeInnerText(...)
Signature: fileName:string -> xpath:string -> innerTextValue:string -> unit

Replaces the inner text of an xml node in a XML file at the location specified by a XPath expression.

XmlPokeInnerTextNS(...)
Signature: fileName:string -> namespaces:seq<string * string> -> xpath:string -> innerTextValue:string -> unit

Replaces inner text of an xml node in a XML file at the location specified by a XPath expression, with support for namespaces.

XmlPokeNS(...)
Signature: fileName:string -> namespaces:seq<string * string> -> xpath:string -> value:string -> unit

Replaces text in a XML file at the location specified by a XPath expression, with support for namespaces.

XMLRead(...)
Signature: failOnError:bool -> xmlFileName:string -> nameSpace:string -> prefix:string -> xPath:string -> seq<string>

Reads a value from a XML document using a XPath

XMLRead_Int(...)
Signature: failOnError:bool -> xmlFileName:string -> nameSpace:string -> prefix:string -> xPath:string -> bool * int

Reads a value from a XML document using a XPath Returns if the value is an int and the value

XmlStartElement name writer
Signature: name:string -> writer:XmlTextWriter -> XmlTextWriter

Writes an XML start element to the given XmlTextWriter

XmlTransform stylesheetUri fileName
Signature: stylesheetUri:string -> fileName:string -> unit

Transforms a XML file using a XSL stylesheet file.

Parameters

  • stylesheetUri - The Uri for the XSL stylesheet file.
  • fileName - The XML file to transform.
XmlWriter(fileName)
Signature: fileName:string -> XmlTextWriter

Creates a XmlWriter which writes to the given file name

XPathReplace xpath value doc
Signature: xpath:string -> value:string -> doc:XmlDocument -> XmlDocument

Replaces text in the XML document specified by a XPath expression.

XPathReplaceInnerText(...)
Signature: xpath:string -> innerTextValue:string -> doc:XmlDocument -> XmlDocument

Replaces the inner text of an xml node in the XML document specified by a XPath expression.

XPathReplaceInnerTextNS(...)
Signature: xpath:string -> innerTextValue:string -> namespaces:'?13726 -> doc:XmlDocument -> XmlDocument
Type parameters: '?13726

Replaces inner text in a XML document specified by a XPath expression, with support for namespaces.

XPathReplaceNS(...)
Signature: xpath:string -> value:string -> namespaces:'a -> doc:XmlDocument -> XmlDocument
Type parameters: 'a

Replaces text in a XML document specified by a XPath expression, with support for namespaces.

XPathValue xpath namespaces doc
Signature: xpath:string -> namespaces:'a -> doc:XmlDocument -> string
Type parameters: 'a

Selects a xml node value via XPath from the given document

XslTransform xsl doc
Signature: xsl:XslCompiledTransform -> doc:XmlDocument -> XmlDocument

Transforms a XmlDocument using a XslCompiledTransform.

Parameters

  • xsl - The XslCompiledTransform which should be applied.
  • doc - The XmlDocument to transform.
XslTransformer(text)
Signature: text:string -> XslCompiledTransform

Loads the given text into a XslCompiledTransform.