private static void ShowUnitsInFragment(XbrlFragment currentFragment) { foreach (var currentUnit in currentFragment.Units) { ShowUnit(currentUnit); } }
private static void ShowFactsInFragment(XbrlFragment currentFragment) { foreach (var currentFact in currentFragment.Facts) { ShowFact(currentFact); } }
private static void ShowContextsInFragment(XbrlFragment currentFragment) { foreach (var currentContext in currentFragment.Contexts) { ShowContext(currentContext); } }
internal void Validate(XbrlFragment fragment, Context context) { this.validatingFragment = fragment; this.validatingContext = context; ValidateContextPeriod(); ValidateScenario(); ValidateSegment(); }
/// <summary> /// Initialize the attribute's typed value. /// </summary> /// <param name="containingFragment"> /// The fragment containing the attribute. /// </param> private void InitializeTypedValue(XbrlFragment containingFragment) { var nodeType = containingFragment.Schemas.GetNodeType(this); if (nodeType == null) { thisTypedValue = this.InnerText; return; } if (nodeType is Xsd.String) { thisTypedValue = this.InnerText; return; } if (nodeType is Xsd.Decimal) { thisTypedValue = Convert.ToDecimal(this.InnerText, CultureInfo.InvariantCulture); return; } if (nodeType is Xsd.Double) { // Handle "INF" and "-INF" separately, since those values are defined in the XBRL Specification // but not supported by Convert.ToDouble(). if (Value.Equals("INF") == true) { thisTypedValue = Double.PositiveInfinity; } else if (Value.Equals("-INF") == true) { thisTypedValue = Double.NegativeInfinity; } else { thisTypedValue = Convert.ToDouble(this.InnerText, CultureInfo.InvariantCulture); } return; } if (nodeType is Xsd.Boolean) { // The explicit checks for "1" and "0" are in place to satisfy conformance test // 331-equivalentRelationships-instance-13.xml. Convert.ToBoolean() does not convert these values //to Booleans. if (this.InnerText.Equals("1") == true) { thisTypedValue = true; } else if (this.InnerText.Equals("0") == true) { thisTypedValue = false; } else { thisTypedValue = Convert.ToBoolean(this.InnerText, CultureInfo.InvariantCulture); } return; } thisTypedValue = this.InnerText; }
/// <summary> /// The value of the node typed to the data type specified in /// the schema definition for the node. If no data type is available, /// then a string representation is returned, in which case TypedValue /// returns the same string as what the InnerText property returns. /// </summary> /// <param name="containingFragment"> /// The fragment containing the attributes. /// </param> /// <returns> /// The value of the node typed to the data type specified in /// the schema definition for the node. If no data type is available, /// then a string representation is returned. /// </returns> public object GetTypedValue(XbrlFragment containingFragment) { if (thisTypedValueInitialized == false) { InitializeTypedValue(containingFragment); thisTypedValueInitialized = true; } return(thisTypedValue); }
private static void FindFactInFragment(XbrlFragment currentFragment, string factName) { var factFound = currentFragment.Facts.GetFactByName(factName); if (factFound != null) { ShowFact(factFound); } }
internal void Validate(XbrlFragment fragment, Fact fact) { this.validatingFragment = fragment; this.validatingFact = fact; ValidateAttributes(); this.validatingItem = fact as Item; if (validatingItem != null) { ValidateItem(); } }
/// <summary> /// Compares the typed value of this attribute with the typed value of another attribute. /// </summary> /// <param name="otherAttribute"> /// The other attribute whose typed value is to be compared with this attribute's typed value. /// </param> /// <param name="containingFragment"> /// The fragment containing the attribute. /// </param> /// <returns> /// True if the attributes have the same typed value; false otherwise. /// </returns> public bool TypedValueEquals(IAttribute otherAttribute, XbrlFragment containingFragment) { var thisTypedValue = this.GetTypedValue(containingFragment); var otherTypedValue = otherAttribute.GetTypedValue(containingFragment); if (thisTypedValue.GetType() == otherTypedValue.GetType()) { return(thisTypedValue.Equals(otherTypedValue)); } return(false); }
internal void Validate(XbrlFragment fragment) { validatingFragment = fragment; ValidateRoleReferences(); ValidateArcroleReferences(); ValidateContexts(); ValidateContextRefs(); ValidateUnitRefs(); ValidateContextTimeSpansAgainstPeriodTypes(); ValidateFootnoteLocations(); ValidateFootnoteArcs(); ValidateItems(); }
private static int GetFiscalYear(string symbol, XbrlFragment frag) { int yr = 0; foreach (XmlAttribute attrib in frag.XbrlRootNode.Attributes) { if (attrib.LocalName == symbol) { yr = Convert.ToInt32(System.IO.Path.GetFileNameWithoutExtension(attrib.Value).Substring(0, 4)); } } return(yr); }
public void Example13Row4() { XbrlDocument NewXbrlDocument = new XbrlDocument(); NewXbrlDocument.Load(@"..\..\..\JeffFerguson.Test.Gepsio\InferPrecisionTestDocuments\Example13Row4.xbrl"); Assert.AreEqual <int>(1, NewXbrlDocument.XbrlFragments.Count, "No XBRL fragments found."); XbrlFragment FirstFragment = NewXbrlDocument.XbrlFragments[0]; Assert.AreEqual <int>(1, FirstFragment.Facts.Count, "No facts found in fragment."); Item FirstFact = FirstFragment.Facts[0] as Item; Assert.IsTrue(FirstFact.DecimalsSpecified); Assert.IsFalse(FirstFact.PrecisionSpecified); Assert.IsTrue(FirstFact.PrecisionInferred); Assert.AreEqual <int>(5, FirstFact.Precision); }
/// <summary> /// Compares the typed value of this node with the typed value of another node. /// </summary> /// <param name="otherNode"> /// The other node whose typed value is to be compared with this node's typed value. /// </param> /// <param name="containingFragment"> /// The fragment containing the attributes. /// </param> /// <returns> /// True if the nodes have the same typed value; false otherwise. /// </returns> public bool TypedValueEquals(INode otherNode, XbrlFragment containingFragment) { var thisTypedValue = this.GetTypedValue(containingFragment); var otherTypedValue = otherNode.GetTypedValue(containingFragment); if ((thisTypedValue == null) && (otherTypedValue == null)) { return(this.InnerText.Equals(otherNode.Value)); } if ((thisTypedValue == null) || (otherTypedValue == null)) { return(false); } if (thisTypedValue.GetType() == otherTypedValue.GetType()) { return(thisTypedValue.Equals(otherTypedValue)); } return(false); }
public bool StructureEquals(INode OtherNode, XbrlFragment containingFragment) { if (OtherNode == null) { return(false); } if (this.NamespaceURI.Equals(OtherNode.NamespaceURI) == false) { return(false); } if (this.LocalName.Equals(OtherNode.LocalName) == false) { return(false); } if (this.Value.Equals(OtherNode.Value) == false) { return(false); } return(this.ChildNodes.StructureEquals(OtherNode.ChildNodes, containingFragment)); }
/// <summary> /// Tests the attributes in the list against the attributes in another /// list for equality. /// </summary> /// <param name="otherAttributeList"> /// The other attribute list to compare against thie list. /// </param> /// <param name="containingFragment"> /// The fragment containing the attributes. /// </param> /// <returns> /// True if the attribute lists are equal; false otherwise. /// </returns> public bool StructureEquals(IAttributeList otherAttributeList, XbrlFragment containingFragment) { if (otherAttributeList == null) { return(false); } if (this.Count != otherAttributeList.Count) { return(false); } foreach (var currentAttribute in thisAttributeList) { var matchingAttribute = otherAttributeList[currentAttribute.Name]; if (matchingAttribute == null) { return(false); } if (currentAttribute.TypedValueEquals(matchingAttribute, containingFragment) == false) { return(false); } } return(true); }
/// <summary> /// The value of the attribute typed to the data type specified in /// the schema definition for the attribute. If no data type is available, /// then a string representation is returned, in which case TypedValue /// returns the same string as what the Value property returns. /// </summary> /// <returns> /// The value of the attribute typed to the data type specified in /// the schema definition for the attribute. If no data type is available, /// then a string representation is returned. /// </returns> public object GetTypedValue(XbrlFragment containingFragment) { throw new NotImplementedException(); }
/// <summary> /// Compares the typed value of this node with the typed value of another node. /// </summary> /// <param name="otherNode"> /// The other node whose typed value is to be compared with this node's typed value. /// </param> /// <param name="containingFragment"> /// The fragment containing the attributes. /// </param> /// <returns> /// True if the nodes have the same typed value; false otherwise. /// </returns> public bool TypedValueEquals(INode otherNode, XbrlFragment containingFragment) { throw new NotImplementedException(); }
internal SummationConceptValidator(XbrlFragment fragment) { this.ValidatedFragment = fragment; }