Show / Hide Table of Contents

Searching Documents

CldrExtensions provides the methods to search mulitple XPath documents with a XPath expression.

Method Description
Elements Find all the elements that match
FirstElement Find the first element that matches
FirstElementOrDefault Find the first element that matches or return the default value

XPath

XPath 1.0 expressions are used to search the CLDR; namespaces are not used.

Example

Query the CLDR for the number of fractional digits of the Japanese Yen

var jpy = Cldr.Instance
  .GetDocuments("common/supplemental/supplementalData.xml")
  .FirstElement("supplementalData/currencyData/fractions/info[@iso4217='JPY']");
Assert.AreEqual("0", jpy.Attribute("digits").Value);
  • Improve this Doc
Back to top Generated by DocFX