Exemple #1
0
 private static Cmyk CreateCmyk(byte c, byte m, byte y, byte k, byte r, byte g, byte b)
 {
     if (MappingDictionary.ContainsKey(CmykToInt(c, m, y, k)))
     {
     }
     MappingDictionary.Add(CmykToInt(c, m, y, k), RgbToInt(r, g, b));
     return(new Cmyk(c, m, y, k));
 }
        public Mappings()
        {
            MappingCollection = new List <ClassMapping>()
            {
                Mappings.Map <Element>("<xs:element>",
                                       Mappings.PropertyMap("id", (Element i) => i.ID),
                                       Mappings.PropertyMap("name", (Element i) => i.Name),
                                       Mappings.PropertyMap("type", (Element i) => i.Type),
                                       Mappings.PropertyMap("substitutionGroup", (Element i) => i.SubstitutionGroup),
                                       Mappings.PropertyMap("nillable", (Element i) => i.Nullable),
                                       Mappings.PropertyMap("model:isDefaultMember", (Element i) => i.IsDefaultMember),
                                       Mappings.PropertyMap("xbrli:periodType", (Element i) => i.PeriodType),
                                       Mappings.PropertyMap("*:domain", (Element i) => i.Domain),
                                       Mappings.PropertyMap("model:hierarchy", (Element i) => i.Hierarchy),
                                       Mappings.PropertyMap("model:fromDate", (Element i) => i.FromDate),
                                       Mappings.PropertyMap("model:toDate", (Element i) => i.ToDate),
                                       Mappings.PropertyMap("model:creationDate", (Element i) => i.CreationDate),
                                       Mappings.PropertyMap("xbrldt:typedDomainRef", (Element i) => i.TypedDomainRef),
                                       Mappings.PropertyMap("*:linkrole", (Element i) => i.LinkRole)
                                       ),
                Mappings.Map <XbrlUnit>("<unit>",
                                        Mappings.PropertyMap("<unitId>", (XbrlUnit i) => i.UnitID),
                                        Mappings.PropertyMap("<unitName>", (XbrlUnit i) => i.UnitName),
                                        Mappings.PropertyMap("<nsUnit>", (XbrlUnit i) => i.NsUnit),
                                        Mappings.PropertyMap("<itemType>", (XbrlUnit i) => i.ItemType),
                                        Mappings.PropertyMap("<baseStandard>", (XbrlUnit i) => i.BaseStandard)
                                        ),
                Mappings.Map <Link>("<xlink>",
                                    Mappings.PropertyMap("xlink:type", (Link i) => i.XType),
                                    Mappings.PropertyMap("xlink:role", (Link i) => i.Role),
                                    Mappings.PropertyMap("xlink:href", (Link i) => i.Href)
                                    ),
                Mappings.Map <LogicalModel.Label>("<label>",
                                                  Mappings.PropertyMap("xlink:label", (LogicalModel.Label i) => i.LabelID),
                                                  Mappings.PropertyMap("@content", (LogicalModel.Label i) => i.Content)
                                                  ),
                Mappings.Map <XbrlIdentifiable>("<xbrlidentifiable>",
                                                Mappings.PropertyMap("xlink:label", (XbrlIdentifiable i) => i.LabelID),
                                                Mappings.PropertyMap("id", (XbrlIdentifiable i) => i.ID)
                                                ),
                Mappings.Map <BaseModel.Identifiable>("<identifiable>",
                                                      Mappings.PropertyMap("id", (BaseModel.Identifiable i) => i.ID)
                                                      ),
                Mappings.Map <Arc>("<arc>",
                                   Mappings.PropertyMap("xlink:arcrole", (Arc i) => i.ArcRole),
                                   Mappings.PropertyMap("xlink:from", (Arc i) => i.From),
                                   Mappings.PropertyMap("xlink:to", (Arc i) => i.To),
                                   Mappings.PropertyMap("order", (Arc i) => i.Order)
                                   ),

                Mappings.Map <Locator>("<link:loc>",
                                       Mappings.PropertyMap("xlink:label", (Locator i) => i.LabelID)
                                       ),

                Mappings.Map <BreakDown>("<table:breakdown>",
                                         Mappings.PropertyMap("parentChildOrder", (BreakDown i) => i.ParentChildOrder)
                                         ),

                Mappings.Map <TableNode>("<table:table>",
                                         Mappings.PropertyMap("aspectModel", (TableNode i) => i.AspectModel)
                                         ),

                Mappings.Map <RuleNode>("<table:ruleNode>",
                                        Mappings.PropertyMap("abstract", (RuleNode i) => i.Abstract),
                                        Mappings.PropertyMap("<formula:concept>", (RuleNode i) => i.Concept),
                                        Mappings.PropertyMap("<formula:explicitDimension>", (RuleNode i) => i.Dimensions)
                                        ),

                Mappings.Map <AspectNode>("<table:aspectNode>",
                                          Mappings.PropertyMap("<table:dimensionAspect>", (AspectNode i) => i.DimensionAspect)
                                          ),

                Mappings.Map <ExplicitDimension>("<formula:explicitDimension>",
                                                 Mappings.PropertyMap("dimension", (ExplicitDimension i) => i.Dimension),
                                                 Mappings.PropertyMap("<formula:member>", (ExplicitDimension i) => i.Members)
                                                 ),

                Mappings.Map <Member>("<formula:member>",
                                      Mappings.PropertyMap("<formula:qname>", (Member i) => i.QName)
                                      ),
                Mappings.Map <LogicalModel.Concept>("<formula:concept>",
                                                    Mappings.PropertyMap("<formula:qname>", (LogicalModel.Concept i) => i.Content)
                                                    ),

                Mappings.Map <QName>("<qname>",
                                     Mappings.PropertyMap("@content", (QName i) => i.Content)
                                     ),
                Mappings.Map <LogicalModel.Base.QualifiedName>("<QualifiedName>",
                                                               Mappings.PropertyMap("@content", (LogicalModel.Base.QualifiedName i) => i.Content)
                                                               ),

                Mappings.Map <DimensionAspect>("<table:dimensionAspect>",
                                               Mappings.PropertyMap("includeUnreportedValue", (DimensionAspect i) => i.IncludeUnreportedValue)
                                               ),


                Mappings.Map <DefinitionNodeSubTreeArc>("<table:definitionNodeSubtreeArc>"
                                                        ),

                Mappings.Map <TableBreakDownArc>("<table:tableBreakdownArc>",
                                                 Mappings.PropertyMap("axis", (TableBreakDownArc i) => i.Axis)
                                                 ),

                Mappings.Map <AspectNodeFilterArc>("<table:aspectNodeFilterArc>",
                                                   Mappings.PropertyMap("complement", (AspectNodeFilterArc i) => i.Complement)
                                                   ),

                Mappings.Map <BreakdownTreeArc>("<table:breakdownTreeArc>"
                                                ),

                Mappings.Map <DefinitionLink>("<link:definitionLink>",
                                              Mappings.PropertyMap("<link:loc>", (DefinitionLink i) => i.Locators),
                                              Mappings.PropertyMap("<link:definitionArc>", (DefinitionLink i) => i.DefinitionArcs)
                                              ),

                Mappings.Map <DefinitionArc>("<link:definitionArc>",
                                             Mappings.PropertyMap("xbrldt:closed", (DefinitionArc i) => i.Closed),
                                             Mappings.PropertyMap("xbrldt:usable", (DefinitionArc i) => i.Usable),
                                             Mappings.PropertyMap("xbrldt:targetRole", (DefinitionArc i) => i.TargetRole),
                                             Mappings.PropertyMap("xbrldt:contextElement", (DefinitionArc i) => i.ContextElement)
                                             ),

                Mappings.Map <XbrlTable>("<gen:link>",
                                         Mappings.PropertyMap("<table:table>", (XbrlTable i) => i.Tables),
                                         Mappings.PropertyMap("<table:breakdown>", (XbrlTable i) => i.BreakDowns),
                                         Mappings.PropertyMap("<table:breakdownTreeArc>", (XbrlTable i) => i.BreakdownTrees),
                                         Mappings.PropertyMap("<table:tableBreakdownArc>", (XbrlTable i) => i.TableBreakDowns),
                                         Mappings.PropertyMap("<table:aspectNodeFilterArc>", (XbrlTable i) => i.AspectNodeFilters),
                                         Mappings.PropertyMap("<table:definitionNodeSubtreeArc>", (XbrlTable i) => i.DefinitionNodeSubTrees),
                                         Mappings.PropertyMap("<table:dimensionRelationshipNode>", (XbrlTable i) => i.DimensionRelationShips),
                                         Mappings.PropertyMap("<table:ruleNode>", (XbrlTable i) => i.RuleNodes),
                                         Mappings.PropertyMap("<table:aspectNode>", (XbrlTable i) => i.AspectNodes),
                                         Mappings.PropertyMap("<df:explicitDimension>", (XbrlTable i) => i.DimensionFilters),
                                         Mappings.PropertyMap("<link:definitionLink>", (XbrlTable i) => i.DefinitionLinks)
                                         ),

                Mappings.Map <DimensionFilter>("<DimensionFilter>",
                                               Mappings.PropertyMap("<df:dimension>", (DimensionFilter i) => i.Dimension)
                                               ),

                Mappings.Map <DimensionQName>("<df:dimension>",
                                              Mappings.PropertyMap("<df:qname>", (DimensionQName i) => i.QName),
                                              Mappings.PropertyMap("<df:qnameExpression>", (DimensionQName i) => i.QNameExpression)
                                              ),

                Mappings.Map <DimensionMember>("<df:member>",
                                               Mappings.PropertyMap("<df:qname>", (DimensionMember i) => i.QName),
                                               Mappings.PropertyMap("<df:qnameExpression>", (DimensionMember i) => i.QNameExpression),
                                               Mappings.PropertyMap("<df:linkrole>", (DimensionMember i) => i.LinkRole),
                                               Mappings.PropertyMap("<df:arcrole>", (DimensionMember i) => i.ArcRole),
                                               Mappings.PropertyMap("<df:axis>", (DimensionMember i) => i.Axis)
                                               //Mappings.PropertyMap("<df:axis>", (DimensionMember i) => i.IsDefaultMember)
                                               ),
                Mappings.Map <VariableArc>("<variable:variableArc>",
                                           Mappings.PropertyMap("name", (VariableArc i) => i.Name)
                                           ),
                Mappings.Map <OrFilter>("<bf:orFilter>"),

                Mappings.Map <AndFilter>("<bf:andFilter>"),

                Mappings.Map <ValueAssertion>("<va:valueAssertion>",
                                              Mappings.PropertyMap("test", (ValueAssertion i) => i.Test),
                                              Mappings.PropertyMap("aspectModel", (ValueAssertion i) => i.AspectModel),
                                              Mappings.PropertyMap("implicitFiltering", (ValueAssertion i) => i.ImplicitFiltering)
                                              ),
                Mappings.Map <VariableSetFilterArc>("<variable:variableSetFilterArc>",
                                                    Mappings.PropertyMap("complement", (VariableSetFilterArc i) => i.Complement)
                                                    ),
                Mappings.Map <VariableFilterArc>("<variable:variableFilterArc>",
                                                 Mappings.PropertyMap("complement", (VariableFilterArc i) => i.Complement),
                                                 Mappings.PropertyMap("cover", (VariableFilterArc i) => i.Cover)
                                                 ),

                Mappings.Map <ConceptNameFilter>("<cf:conceptName>",
                                                 Mappings.PropertyMap("<cf:concept>", (ConceptNameFilter i) => i.Concepts)
                                                 ),

                Mappings.Map <AspectCoverFilter>("<acf:aspectCover>",
                                                 Mappings.PropertyMap("/@content", (AspectCoverFilter i) => i.Aspect)
                                                 ),

                Mappings.Map <ConceptQName>("<cf:concept>",
                                            Mappings.PropertyMap("<cf:qname>", (ConceptQName i) => i.QName)
                                            ),

                Mappings.Map <ExplicitDimensionFilter>("<df:explicitDimension>",
                                                       Mappings.PropertyMap("<df:member>", (ExplicitDimensionFilter i) => i.Members)
                                                       ),
                Mappings.Map <DimensionQName>("<table:dimension>",
                                              Mappings.PropertyMap("@content", (DimensionQName i) => i.QName)
                                              ),
                Mappings.Map <QName>("<table:relationshipSource>",
                                     Mappings.PropertyMap("/@content", (QName i) => i.Content)
                                     ),

                Mappings.Map <DimensionRelationShip>("<table:dimensionRelationshipNode>", (System.Xml.XmlNode node, Object target) =>
                {
                    /*
                     * <table:relationshipSource>ebacrr_GA:x0</table:relationshipSource>
                     * <table:linkrole>http://www.bde.es/xbrl/role/dict/dom/ebacrr_GA/GA16</table:linkrole>
                     * <table:dimension>ebacrr_dim:RCP</table:dimension>
                     * <table:formulaAxis>descendant-or-self</table:formulaAxis>
                     */
                    var t                     = target as DimensionRelationShip;
                    var n_rel                 = Utilities.Xml.SelectChildNode(node, "table:relationshipSource");
                    var n_linkrole            = Utilities.Xml.SelectChildNode(node, "table:linkrole");
                    var n_dimension           = Utilities.Xml.SelectChildNode(node, "table:dimension");
                    var n_axis                = Utilities.Xml.SelectChildNode(node, "table:formulaAxis");
                    var a_id                  = node.Attributes["id"];
                    var a_labelid             = node.Attributes["xlink:label"];
                    t.Dimension               = t.Dimension == null ? new DimensionQName() : t.Dimension;
                    t.Dimension.QName.Content = n_dimension == null ? "" : n_dimension.InnerText.Trim();
                    t.Member.Content          = n_rel == null ? "" : n_rel.InnerText.Trim();
                    t.Axis                    = n_axis == null ? "" : n_axis.InnerText.Trim();
                    t.LinkRole                = n_linkrole == null ? "" : n_linkrole.InnerText.Trim();
                    t.ID      = a_id == null ? "" : a_id.Value;
                    t.LabelID = a_labelid == null ? "" : a_labelid.Value;
                }
                                                     ),

                //Mappings.Map<TypedDimensionFilter>("<df:typedDimension>"),
                // general f
                Mappings.Map <GeneralFilter>("<gf:general>",
                                             Mappings.PropertyMap("test", (GeneralFilter i) => i.Test)
                                             ),
                //
                //tuplefilters
                Mappings.Map <ParentFilter>("<tf:parentFilter>",
                                            Mappings.PropertyMap("/@content", (ParentFilter i) => i.Parents)
                                            ),
                Mappings.Map <AncestorFilter>("<tf:ancestorFilter>",
                                              Mappings.PropertyMap("/@content", (AncestorFilter i) => i.Ancestors)
                                              ),
                Mappings.Map <SiblingFilter>("<tf:siblingFilter>",
                                             Mappings.PropertyMap("variable", (SiblingFilter i) => i.Variable)
                                             ),
                Mappings.Map <LocationFilter>("<tf:locationFilter>",
                                              Mappings.PropertyMap("variable", (LocationFilter i) => i.Variable),
                                              Mappings.PropertyMap("location", (LocationFilter i) => i.Location)
                                              ),
                //
                Mappings.Map <FactVariable>("<variable:factVariable>"),

                Mappings.Map <Variable>("<variable>",
                                        Mappings.PropertyMap("bindAsSequence", (Variable i) => i.BindAsSequence),
                                        Mappings.PropertyMap("fallbackValue", (Variable i) => i.FallbackValue)
                                        ),

                Mappings.Map <TypedDimensionFilter>("<df:typedDimension>",
                                                    Mappings.PropertyMap("<df:test>", (TypedDimensionFilter i) => i.Test)
                                                    ),
                //Logical
                Mappings.Map <LogicalModel.Dimension>("<xbrldi:explicitMember>",
                                                      Mappings.PropertyMap("dimension", (LogicalModel.Dimension i) => i.DimensionItem),
                                                      Mappings.PropertyMap("@content", (LogicalModel.Dimension i) => i.DomainAndMember)
                                                      ),
                Mappings.Map <LogicalModel.Dimension>("<xbrldi:typedMember>",
                                                      Mappings.PropertyMap("#true", (LogicalModel.Dimension i) => i.IsTyped),
                                                      Mappings.PropertyMap("dimension", (LogicalModel.Dimension i) => i.DimensionItem),
                                                      Mappings.PropertyMap("/@name", (LogicalModel.Dimension i) => i.Domain),
                                                      Mappings.PropertyMap("/@content", (LogicalModel.Dimension i) => i.DomainMember)
                                                      ),
                //Mappings.Map<LogicalModel.Base.QualifiedName>("<qname>",
                //    Mappings.PropertyMap("@content", (LogicalModel.Base.QualifiedName i) => i.Content)
                //),
                //Instance
                Mappings.Map <LogicalModel.Base.QualifiedName>("<*:measure>",
                                                               Mappings.PropertyMap("@content", (LogicalModel.Base.QualifiedName i) => i.Content)
                                                               ),
                Mappings.Map <LogicalModel.InstanceUnit>("<*:instanceunit>",
                                                         Mappings.PropertyMap("<*:measure>", (LogicalModel.InstanceUnit i) => i.Measure)
                                                         ),
                Mappings.Map <LogicalModel.Entity>("<*:entity>",
                                                   Mappings.PropertyMap("/scheme", (LogicalModel.Entity i) => i.Scheme),
                                                   Mappings.PropertyMap("/@content", (LogicalModel.Entity i) => i.ID)
                                                   ),
                Mappings.Map <LogicalModel.Period>("<*:period>",
                                                   Mappings.PropertyMap("<*:instant>", (LogicalModel.Period i) => i.Instant),
                                                   Mappings.PropertyMap("<*:forever>", (LogicalModel.Period i) => i.Forever),
                                                   Mappings.PropertyMap("<*:startdate>", (LogicalModel.Period i) => i.StartDate),
                                                   Mappings.PropertyMap("<*:enddate>", (LogicalModel.Period i) => i.EndDate)
                                                   ),
                Mappings.Map <Scenario>("<*:scenario>",
                                        Mappings.PropertyMap("<xbrldi:explicitMember>", (Scenario i) => i.Dimensions),
                                        Mappings.PropertyMap("<xbrldi:typedMember>", (Scenario i) => i.Dimensions)
                                        ),
                Mappings.Map <FilingIndicator>("<find:filingIndicator>",
                                               Mappings.PropertyMap("contextRef", (FilingIndicator i) => i.ContextID),
                                               Mappings.PropertyMap("find:filed", (FilingIndicator i) => i.Filed),
                                               Mappings.PropertyMap("@content", (FilingIndicator i) => i.Value)
                                               ),
                Mappings.Map <XbrlContext>("<*:context>",
                                           Mappings.PropertyMap("<*:entity>", (XbrlContext i) => i.Entity),
                                           Mappings.PropertyMap("<*:period>", (XbrlContext i) => i.Period),
                                           Mappings.PropertyMap("<*:scenario>", (XbrlContext i) => i.Scenario)
                                           ),

                Mappings.Map <XbrlFact>("<XbrlFact>",
                                        Mappings.PropertyMap("@name", (XbrlFact i) => i.Concept),
                                        Mappings.PropertyMap("decimals", (XbrlFact i) => i.Decimals),
                                        Mappings.PropertyMap("contextRef", (XbrlFact i) => i.ContextRef),
                                        Mappings.PropertyMap("id", (XbrlFact i) => i.ID),
                                        Mappings.PropertyMap("unitRef", (XbrlFact i) => i.UnitRef),
                                        Mappings.PropertyMap("@content", (XbrlFact i) => i.Value)
                                        ),
                Mappings.Map <Link>("<link:schemaRef>",
                                    Mappings.PropertyMap("xlink:type", (Link i) => i.XType),
                                    Mappings.PropertyMap("xlink:role", (Link i) => i.Role),
                                    Mappings.PropertyMap("xlink:href", (Link i) => i.Href)
                                    ),

                Mappings.Map <XbrlInstance>("<xbrli:xbrl>",
                                            Mappings.PropertyMap("<link:schemaRef>", (XbrlInstance i) => i.SchemaRef),
                                            //Mappings.PropertyMap("<*:context>", (XbrlInstance i) => i.Contexts),
                                            Mappings.PropertyMap("<*:unit>", (XbrlInstance i) => i.Units)
                                            ),
                //End Instance
                //hier
                Mappings.Map <Hier>("<hier>",
                                    Mappings.PropertyMap("<link:definitionLink>", (Hier i) => i.DefinitionLinks)
                                    ),
                //validation
                Mappings.Map <XbrlIdentifiable>("<val:assertionSet>",
                                                Mappings.PropertyMap("id", (XbrlIdentifiable i) => i.ID)
                                                ),
                Mappings.Map <XbrlValidation>("<validation>",
                                              Mappings.PropertyMap("<val:assertionSet>", (XbrlValidation i) => i.AssertionSet),
                                              Mappings.PropertyMap("<variable:variableArc>", (XbrlValidation i) => i.VariableArcs),
                                              Mappings.PropertyMap("<variable:variableFilterArc>", (XbrlValidation i) => i.VariableFilterArcs),
                                              Mappings.PropertyMap("<variable:variableSetFilterArc>", (XbrlValidation i) => i.VariableSetFilterArcs),
                                              Mappings.PropertyMap("<df:explicitDimension>", (XbrlValidation i) => i.DimensionFilters),
                                              Mappings.PropertyMap("<tf:*>", (XbrlValidation i) => i.TupleFilters),
                                              Mappings.PropertyMap("<gf:general>", (XbrlValidation i) => i.GeneralFilters),
                                              Mappings.PropertyMap("<df:typedDimension>", (XbrlValidation i) => i.DimensionFilters),
                                              Mappings.PropertyMap("<cf:conceptName>", (XbrlValidation i) => i.ConceptFilters),
                                              Mappings.PropertyMap("<acf:aspectCover>", (XbrlValidation i) => i.AspectFilters),
                                              Mappings.PropertyMap("<va:valueAssertion>", (XbrlValidation i) => i.ValueAssertions),
                                              Mappings.PropertyMap("<bf:orFilter>", (XbrlValidation i) => i.Filters),
                                              Mappings.PropertyMap("<bf:andFilter>", (XbrlValidation i) => i.Filters),
                                              Mappings.PropertyMap("<variable:factVariable>", (XbrlValidation i) => i.FactVariables)

                                              ),
                //end validation
            };
            foreach (var cm in MappingCollection)
            {
                MappingDictionary.Add(cm.XmlSelector, cm);
            }
        }