From 874d7b4987fe015ecb999434a9e016a7f1a91050 Mon Sep 17 00:00:00 2001 From: Bruce Date: Fri, 1 Mar 2019 22:27:43 +0800 Subject: [PATCH] Practice sync map and xml Signed-off-by: Bruce --- playground/panic/trypanic.go | 10 + playground/parse/parseInt_test.go | 14 + playground/pointer/pointer_test.go | 6 + playground/syncmap/syncmap_test.go | 52 + playground/xml/2018Q1.xml | 4089 ++++++++++++++++++++++++++++ playground/xml/xml_test.go | 63 + 6 files changed, 4234 insertions(+) create mode 100644 playground/panic/trypanic.go create mode 100644 playground/parse/parseInt_test.go create mode 100644 playground/syncmap/syncmap_test.go create mode 100755 playground/xml/2018Q1.xml create mode 100644 playground/xml/xml_test.go diff --git a/playground/panic/trypanic.go b/playground/panic/trypanic.go new file mode 100644 index 0000000..2a0cb25 --- /dev/null +++ b/playground/panic/trypanic.go @@ -0,0 +1,10 @@ +package trypanic + +import ( + "fmt" +) + +func Try() { + var test *string + fmt.Println(*test) +} diff --git a/playground/parse/parseInt_test.go b/playground/parse/parseInt_test.go new file mode 100644 index 0000000..4cd44eb --- /dev/null +++ b/playground/parse/parseInt_test.go @@ -0,0 +1,14 @@ +package parse + +import ( + "fmt" + "strconv" + "testing" +) + +func TestParseInt(t *testing.T) { + var _, err = strconv.ParseInt("127", 0, 8) + if err != nil { + fmt.Println(err) + } +} diff --git a/playground/pointer/pointer_test.go b/playground/pointer/pointer_test.go index 56e5016..53593ca 100644 --- a/playground/pointer/pointer_test.go +++ b/playground/pointer/pointer_test.go @@ -18,3 +18,9 @@ func TestBasic(t *testing.T) { fmt.Println(*address2) } + +func TestPointer(t *testing.T) { + var test *string = new(string) + *test = "123" + fmt.Println(test) +} diff --git a/playground/syncmap/syncmap_test.go b/playground/syncmap/syncmap_test.go new file mode 100644 index 0000000..b53fb59 --- /dev/null +++ b/playground/syncmap/syncmap_test.go @@ -0,0 +1,52 @@ +package syncmap + +import ( + "fmt" + "sync" + "testing" +) + +type Order struct { + Id int +} + +func TestSync(t *testing.T) { + var waitGroup sync.WaitGroup + waitGroup.Add(10) + var cache sync.Map + + for i := 0; i < 10; i++ { + go func() { + cache.Store("test", &Order{}) + order, _ := cache.Load("test") + o := order.(*Order) + fmt.Println(o) + waitGroup.Done() + }() + } + waitGroup.Wait() +} + +func TestSync2(t *testing.T) { + var cache sync.Map + + cache.Store("test", nil) + + if order, ok := cache.Load("test"); ok && order != nil { + fmt.Println(order) + } else { + fmt.Println("not exist") + } +} + +func TestSync3(t *testing.T) { + var cache sync.Map + orders := make([]Order, 2) + + cache.Store("test2", orders[0]) + cache.Store("test", orders[0]) + + order, ok := cache.Load("test") + fmt.Println(ok, order) + +} diff --git a/playground/xml/2018Q1.xml b/playground/xml/2018Q1.xml new file mode 100755 index 0000000..d7376d8 --- /dev/null +++ b/playground/xml/2018Q1.xml @@ -0,0 +1,4089 @@ + + + + + 2408 + + + 2018-05-09 + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:TotalEquityMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:NoncontrollingInterestsMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:EquityAttributableToFomerOwnerOfBusinessCombinationUnderCommonControl + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:EquityAttributableToOwnersOfParentMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:TreasurySharesMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:OtherEquityInterestMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:Others-OtherEquityInterestMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:EquityRelatedToNoncurrentAssetsOrDisposalGroupsClassifiedAsHeldForDistributionToOwnersMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:AmountRecognisedInOtherComprehensiveIncomeAndAccumulatedInEquityRelatingToNoncurrentAssetsOrDisposalGroupsHeldForSaleMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:RevaluationSurplusMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:ReserveOfRemeasurementsOfDefinedBenefitPlansMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:ReserveOfChangeInFairValueOfFinancialLiabilityAttributableToChangeInCreditRiskOfLiabilityMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:GainsLossesOnEffectivePortionOfHedgesOfNetInvestmentsInForeignOperationsMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:ReserveOfCashFlowHedgesMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnRemeasuringAvailableforsaleFinancialAssetsMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnFinancialAssetsMeasuredAtFairValueThroughOtherComprehensiveIncomeMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:ReserveOfExchangeDifferencesOnTranslationMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:RetainedEarningsMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:UnappropriatedRetainedEarningsAccumulatedDeficitMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:SpecialReserveMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:StatutoryReserveMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:CapitalReserveMember + + + + + 2408 + + + 2017-03-31 + + + ifrs-full:IssuedCapitalMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:Other-ShareCapitalMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:StockDividendToBeDistributedMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:AdvanceReceiptsForShareCapitalMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:CertificateOfEntitlementToNewSharesFromConvertibleBondMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:PreferenceShareMember + + + + + 2408 + + + 2017-03-31 + + + tifrs-es:OrdinaryShareMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:TotalEquityMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:NoncontrollingInterestsMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:EquityAttributableToFomerOwnerOfBusinessCombinationUnderCommonControl + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:EquityAttributableToOwnersOfParentMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:TreasurySharesMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:OtherEquityInterestMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:Others-OtherEquityInterestMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:EquityRelatedToNoncurrentAssetsOrDisposalGroupsClassifiedAsHeldForDistributionToOwnersMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:AmountRecognisedInOtherComprehensiveIncomeAndAccumulatedInEquityRelatingToNoncurrentAssetsOrDisposalGroupsHeldForSaleMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:RevaluationSurplusMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:ReserveOfRemeasurementsOfDefinedBenefitPlansMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:ReserveOfChangeInFairValueOfFinancialLiabilityAttributableToChangeInCreditRiskOfLiabilityMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:GainsLossesOnEffectivePortionOfHedgesOfNetInvestmentsInForeignOperationsMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:ReserveOfCashFlowHedgesMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnRemeasuringAvailableforsaleFinancialAssetsMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnFinancialAssetsMeasuredAtFairValueThroughOtherComprehensiveIncomeMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:ReserveOfExchangeDifferencesOnTranslationMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:RetainedEarningsMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:UnappropriatedRetainedEarningsAccumulatedDeficitMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:SpecialReserveMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:StatutoryReserveMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:CapitalReserveMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + ifrs-full:IssuedCapitalMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:Other-ShareCapitalMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:StockDividendToBeDistributedMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:AdvanceReceiptsForShareCapitalMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:CertificateOfEntitlementToNewSharesFromConvertibleBondMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:PreferenceShareMember + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + tifrs-es:OrdinaryShareMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:TotalEquityMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:NoncontrollingInterestsMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:EquityAttributableToFomerOwnerOfBusinessCombinationUnderCommonControl + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:EquityAttributableToOwnersOfParentMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:TreasurySharesMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:OtherEquityInterestMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:Others-OtherEquityInterestMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:EquityRelatedToNoncurrentAssetsOrDisposalGroupsClassifiedAsHeldForDistributionToOwnersMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:AmountRecognisedInOtherComprehensiveIncomeAndAccumulatedInEquityRelatingToNoncurrentAssetsOrDisposalGroupsHeldForSaleMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:RevaluationSurplusMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:ReserveOfRemeasurementsOfDefinedBenefitPlansMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:ReserveOfChangeInFairValueOfFinancialLiabilityAttributableToChangeInCreditRiskOfLiabilityMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:GainsLossesOnEffectivePortionOfHedgesOfNetInvestmentsInForeignOperationsMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:ReserveOfCashFlowHedgesMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:ReserveOfGainsAndLossesOnRemeasuringAvailableforsaleFinancialAssetsMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:ReserveOfGainsAndLossesOnFinancialAssetsMeasuredAtFairValueThroughOtherComprehensiveIncomeMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:ReserveOfExchangeDifferencesOnTranslationMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:RetainedEarningsMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:UnappropriatedRetainedEarningsAccumulatedDeficitMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:SpecialReserveMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:StatutoryReserveMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:CapitalReserveMember + + + + + 2408 + + + 2017-01-01 + + + ifrs-full:IssuedCapitalMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:Other-ShareCapitalMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:StockDividendToBeDistributedMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:AdvanceReceiptsForShareCapitalMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:CertificateOfEntitlementToNewSharesFromConvertibleBondMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:PreferenceShareMember + + + + + 2408 + + + 2017-01-01 + + + tifrs-es:OrdinaryShareMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:TotalEquityMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:NoncontrollingInterestsMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:EquityAttributableToFomerOwnerOfBusinessCombinationUnderCommonControl + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:EquityAttributableToOwnersOfParentMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:TreasurySharesMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:OtherEquityInterestMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:Others-OtherEquityInterestMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:EquityRelatedToNoncurrentAssetsOrDisposalGroupsClassifiedAsHeldForDistributionToOwnersMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:AmountRecognisedInOtherComprehensiveIncomeAndAccumulatedInEquityRelatingToNoncurrentAssetsOrDisposalGroupsHeldForSaleMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:RevaluationSurplusMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:ReserveOfRemeasurementsOfDefinedBenefitPlansMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:ReserveOfChangeInFairValueOfFinancialLiabilityAttributableToChangeInCreditRiskOfLiabilityMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:GainsLossesOnEffectivePortionOfHedgesOfNetInvestmentsInForeignOperationsMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:ReserveOfCashFlowHedgesMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnRemeasuringAvailableforsaleFinancialAssetsMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnFinancialAssetsMeasuredAtFairValueThroughOtherComprehensiveIncomeMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:ReserveOfExchangeDifferencesOnTranslationMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:RetainedEarningsMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:UnappropriatedRetainedEarningsAccumulatedDeficitMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:SpecialReserveMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:StatutoryReserveMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:CapitalReserveMember + + + + + 2408 + + + 2018-03-31 + + + ifrs-full:IssuedCapitalMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:Other-ShareCapitalMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:StockDividendToBeDistributedMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:AdvanceReceiptsForShareCapitalMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:CertificateOfEntitlementToNewSharesFromConvertibleBondMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:PreferenceShareMember + + + + + 2408 + + + 2018-03-31 + + + tifrs-es:OrdinaryShareMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:TotalEquityMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:NoncontrollingInterestsMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:EquityAttributableToFomerOwnerOfBusinessCombinationUnderCommonControl + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:EquityAttributableToOwnersOfParentMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:TreasurySharesMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:OtherEquityInterestMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:Others-OtherEquityInterestMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:EquityRelatedToNoncurrentAssetsOrDisposalGroupsClassifiedAsHeldForDistributionToOwnersMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:AmountRecognisedInOtherComprehensiveIncomeAndAccumulatedInEquityRelatingToNoncurrentAssetsOrDisposalGroupsHeldForSaleMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:RevaluationSurplusMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:ReserveOfRemeasurementsOfDefinedBenefitPlansMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:ReserveOfChangeInFairValueOfFinancialLiabilityAttributableToChangeInCreditRiskOfLiabilityMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:GainsLossesOnEffectivePortionOfHedgesOfNetInvestmentsInForeignOperationsMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:ReserveOfCashFlowHedgesMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnRemeasuringAvailableforsaleFinancialAssetsMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:ReserveOfGainsAndLossesOnFinancialAssetsMeasuredAtFairValueThroughOtherComprehensiveIncomeMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:ReserveOfExchangeDifferencesOnTranslationMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:RetainedEarningsMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:UnappropriatedRetainedEarningsAccumulatedDeficitMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:SpecialReserveMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:StatutoryReserveMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:CapitalReserveMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + ifrs-full:IssuedCapitalMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:Other-ShareCapitalMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:StockDividendToBeDistributedMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:AdvanceReceiptsForShareCapitalMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:CertificateOfEntitlementToNewSharesFromConvertibleBondMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:PreferenceShareMember + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + tifrs-es:OrdinaryShareMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:TotalEquityMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:NoncontrollingInterestsMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:EquityAttributableToFomerOwnerOfBusinessCombinationUnderCommonControl + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:EquityAttributableToOwnersOfParentMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:TreasurySharesMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:OtherEquityInterestMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:Others-OtherEquityInterestMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:EquityRelatedToNoncurrentAssetsOrDisposalGroupsClassifiedAsHeldForDistributionToOwnersMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:AmountRecognisedInOtherComprehensiveIncomeAndAccumulatedInEquityRelatingToNoncurrentAssetsOrDisposalGroupsHeldForSaleMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:RevaluationSurplusMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:ReserveOfRemeasurementsOfDefinedBenefitPlansMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:ReserveOfChangeInFairValueOfFinancialLiabilityAttributableToChangeInCreditRiskOfLiabilityMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:GainsLossesOnEffectivePortionOfHedgesOfNetInvestmentsInForeignOperationsMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:ReserveOfCashFlowHedgesMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:ReserveOfGainsAndLossesOnRemeasuringAvailableforsaleFinancialAssetsMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:ReserveOfGainsAndLossesOnFinancialAssetsMeasuredAtFairValueThroughOtherComprehensiveIncomeMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:ReserveOfExchangeDifferencesOnTranslationMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:RetainedEarningsMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:UnappropriatedRetainedEarningsAccumulatedDeficitMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:SpecialReserveMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:StatutoryReserveMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:CapitalReserveMember + + + + + 2408 + + + 2018-01-01 + + + ifrs-full:IssuedCapitalMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:Other-ShareCapitalMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:StockDividendToBeDistributedMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:AdvanceReceiptsForShareCapitalMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:CertificateOfEntitlementToNewSharesFromConvertibleBondMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:PreferenceShareMember + + + + + 2408 + + + 2018-01-01 + + + tifrs-es:OrdinaryShareMember + + + + + 2408 + + + 2017-12-31 + + + + + 2408 + + + 2017-01-01 + 2017-03-31 + + + + + 2408 + + + 2017-03-31 + + + + + 2408 + + + 2018-01-01 + 2018-03-31 + + + + + 2408 + + + 2018-03-31 + + + + iso4217:TWD + + + xbrli:shares + + + + + iso4217:TWD + + + xbrli:shares + + + + + xbrli:pure + + 2018 + 1 + Financial report (general) + Consolidated report + Listed company + Commercial and industrial + 50196810000 + 33768677000 + 20299894000 + 11044995000 + 8525608000 + 5782714000 + 858673000 + 11601416000 + 1454256000 + 0 + 0 + 0 + 7868893000 + 6888530000 + 4656170000 + 1996194000 + 1622096000 + 1430620000 + 71965565000 + 62406327000 + 33623654000 + 0 + 0 + 50728048000 + 84607717000 + 86241880000 + 71886199000 + 102331000 + 136550000 + 238424000 + 859732000 + 922559000 + 846975000 + 1032293000 + 1071986000 + 1602634000 + 1003224000 + 1043501000 + 1278815000 + 1003224000 + 1043501000 + 1278815000 + 29069000 + 28485000 + 323819000 + 86602073000 + 88372975000 + 125302280000 + 158567638000 + 150779302000 + 158925934000 + 0 + 2238441000 + 1439801000 + 3195934000 + 3072987000 + 5328595000 + 327777000 + 299746000 + 192637000 + 7167115000 + 6297730000 + 4039590000 + 995508000 + 1065854000 + 10900041000 + 1713782000 + 1726392000 + 2088872000 + 1617000 + 1954000 + 7187658000 + 0 + 0 + 7186625000 + 0 + 0 + 7186625000 + 1617000 + 1954000 + 1033000 + 13401733000 + 14703104000 + 31177194000 + 0 + 3286711000 + 14002436000 + 0 + 0 + 12776825000 + 553000 + 63699000 + 3264513000 + 635359000 + 610600000 + 567206000 + 525020000 + 525797000 + 449279000 + 110339000 + 84803000 + 117927000 + 635912000 + 3961010000 + 30610980000 + 14037645000 + 18664114000 + 61788174000 + 30028820000 + 29639382000 + 27485658000 + 567359000 + 223958000 + 0 + 30596179000 + 29863340000 + 27485658000 + 29654480000 + 25150157000 + 9852246000 + 29654480000 + 25150157000 + 9852246000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2192903000 + 2127034000 + 1782354000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3300000 + 31847383000 + 27277191000 + 11637900000 + 5164057000 + 5164057000 + 2791929000 + 0 + 0 + 4570000 + 76961794000 + 69734440000 + 39571384000 + 82125851000 + 74898497000 + 42367883000 + -39420000 + -39163000 + 15883901000 + 0 + 0 + 347533000 + 144529993000 + 131999865000 + 97027809000 + 0 + 0 + 0 + 0 + 115323000 + 109951000 + 144529993000 + 132115188000 + 97137760000 + 158567638000 + 150779302000 + 158925934000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 687558 + 18797439000 + 12230574000 + 9056761000 + 7330057000 + 9740678000 + 4900517000 + 9740678000 + 4900517000 + 195492000 + 173460000 + 350091000 + 347654000 + 876079000 + 526763000 + 1421662000 + 1047877000 + 8319016000 + 3852640000 + 235627000 + 88313000 + -1322009000 + -532488000 + 5298000 + 121997000 + -1091680000 + -566172000 + 7227336000 + 3286468000 + 1181000 + 3778000 + 7226155000 + 3282690000 + 7226155000 + 3282690000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -424000 + 0 + 424000 + 0 + -257000 + -20404000 + 0 + 9776747000 + 0 + 1661543000 + -257000 + 8094800000 + 167000 + 8094800000 + 7226322000 + 11377490000 + 7226930000 + 3275298000 + -775000 + 7392000 + 7227097000 + 11370098000 + -775000 + 7392000 + 2.39 + 1.19 + 2.39 + 1.19 + 2.31 + 1.01 + 2.31 + 1.01 + 7227336000 + 3286468000 + 7227336000 + 3286468000 + 2882097000 + 1534865000 + 35647000 + 70406000 + 281107000 + 262158000 + 5298000 + 121997000 + -235628000 + -88313000 + 65869000 + 114893000 + 0 + -70684000 + -46000 + -24000 + 0 + -770000 + -497000 + 0 + -105403000 + 11677000 + 161805000 + -206229000 + 0 + -63542000 + 3090249000 + 1686434000 + -2579688000 + -87476000 + 158843000 + 519652000 + -1117269000 + 193322000 + -377265000 + 83662000 + -3915379000 + 709160000 + -523136000 + 0 + 273544000 + 33864000 + 1667694000 + 120650000 + -337000 + -235302000 + -777000 + -4234000 + 916000 + -10450000 + 1417904000 + -95472000 + -2497475000 + 613688000 + 592774000 + 2300122000 + 7820110000 + 5586590000 + 145040000 + 26698000 + 0 + 0 + -292000 + -106345000 + -21368000 + -8823000 + 7943490000 + 5498120000 + 0 + 2000771000 + -85937000 + 0 + -1940662000 + -6147471000 + 46000 + 80000 + -1501000 + -1899000 + 10616574000 + 0 + 107333000 + 107332000 + -1278000 + 72297000 + 8694575000 + -3968890000 + 0 + 15681000000 + 0 + -3000000000 + 25316000 + 30494000 + 4530000 + -2696964000 + 0 + -4138000 + 0 + 0 + 0 + 230000 + 29846000 + 10010622000 + -239778000 + -341590000 + 16428133000 + 11198262000 + 33768677000 + 9101632000 + 50196810000 + 20299894000 + 29639382000 + 0 + 223958000 + 0 + 0 + 0 + 29863340000 + 27277191000 + 5164057000 + 0 + 69734440000 + 74898497000 + -39163000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -39163000 + 0 + 131999865000 + 0 + 115323000 + 132115188000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 29639382000 + 0 + 223958000 + 0 + 0 + 0 + 29863340000 + 27277191000 + 5164057000 + 0 + 69734440000 + 74898497000 + -39163000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -39163000 + 0 + 131999865000 + 0 + 115323000 + 132115188000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 7226930000 + 7226930000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 7226930000 + 0 + -775000 + 7226155000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 424000 + 424000 + -257000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -257000 + 0 + 167000 + 0 + 0 + 167000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 7227354000 + 7227354000 + -257000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -257000 + 0 + 7227097000 + 0 + -775000 + 7226322000 + 165480000 + 0 + 567359000 + 0 + 0 + 0 + 732839000 + 4504323000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 5237162000 + 0 + 0 + 5237162000 + 223958000 + 0 + -223958000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -114548000 + -114548000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 65869000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 65869000 + 0 + 0 + 65869000 + 389438000 + 0 + 343401000 + 0 + 0 + 0 + 732839000 + 4570192000 + 0 + 0 + 7227354000 + 7227354000 + -257000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -257000 + 0 + 12530128000 + 0 + -115323000 + 12414805000 + 30028820000 + 0 + 567359000 + 0 + 0 + 0 + 30596179000 + 31847383000 + 5164057000 + 0 + 76961794000 + 82125851000 + -39420000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -39420000 + 0 + 144529993000 + 0 + 0 + 144529993000 + 27485658000 + 0 + 0 + 0 + 0 + 0 + 27485658000 + 11523007000 + 2791929000 + 4570000 + 36296086000 + 39092585000 + -16846000 + 0 + 7805947000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 7789101000 + -347533000 + 85542818000 + 0 + 102329000 + 85645147000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 27485658000 + 0 + 0 + 0 + 0 + 0 + 27485658000 + 11523007000 + 2791929000 + 4570000 + 36296086000 + 39092585000 + -16846000 + 0 + 7805947000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 7789101000 + -347533000 + 85542818000 + 0 + 102329000 + 85645147000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3275298000 + 3275298000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3275298000 + 0 + 7392000 + 3282690000 + -20404000 + 0 + 8115204000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8094800000 + 0 + 8094800000 + 0 + 0 + 8094800000 + 3275298000 + 3275298000 + -20404000 + 0 + 8115204000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8094800000 + 0 + 11370098000 + 0 + 7392000 + 11377490000 + 0 + 0 + 0 + 0 + 230000 + 230000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 114893000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 114893000 + 0 + 0 + 114893000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 114893000 + 0 + 0 + 3275298000 + 3275298000 + -20404000 + 0 + 8115204000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8094800000 + 0 + 11484991000 + 0 + 7622000 + 11492613000 + 27485658000 + 0 + 0 + 0 + 0 + 0 + 27485658000 + 11637900000 + 2791929000 + 4570000 + 39571384000 + 42367883000 + -37250000 + 0 + 15921151000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 15883901000 + -347533000 + 97027809000 + 0 + 109951000 + 97137760000 + 2018-05-09 + Y + Y + Y + + + + + + + + + + + + + 0 + 0 + 0 + 0 + 3840102000 + -73176000 + 0 + 0 + + + + + + + + + + + + + + + + + 1.0000 + 1.0000 + 1.0000 + + + + + + + + 1.0000 + 1.0000 + 1.0000 + + + + + + + + 1.0000 + 1.0000 + 1.0000 + + + + + + + + 1.0000 + 1.0000 + 1.0000 + + + + + + + + 1.0000 + 1.0000 + 1.0000 + + + + + + + + 0.0000 + 0.5356 + 0.5357 + + + + + + + + 1.0000 + 1.0000 + 1.0000 + + + + + + + + 1.0000 + 1.0000 + 1.0000 + + + + + + + 2390000 + 3577000 + 11978000 + + + + + 11051779000 + 8530890000 + 5779819000 + + + + + -9174000 + -8859000 + -9083000 + + + + 11044995000 + 8525608000 + 5782714000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 6023000 + + + + 0 + 6023000 + + + 15104000 + 12314000 + + + + + 419527000 + 269562000 + + + + + 22470000 + 8250000 + + + + 457101000 + 290126000 + + + + 5597000 + 4750000 + 3936000 + + + + + + 315826000 + 290134000 + 186508000 + + + + + + 6354000 + 4862000 + 2193000 + + + + + + 0 + 0 + 0 + + + + + + 891118000 + 889629000 + 703498000 + + + + 1218895000 + 1189375000 + 896135000 + + + 391000 + 2489000 + + + + + 2111000 + 41176000 + + + + 2502000 + 43665000 + + + 0 + 0 + 8000000000 + + + + + 8322000 + 2282000 + 0 + + + + + 0 + 5934000 + 0 + + + + + 4624000 + 0 + 0 + + + + + 0 + 200000 + 2045308000 + + + + 12946000 + 8416000 + 10045308000 + 12192000 + 11918000 + 0 + 0 + 0 + 0 + 0 + 0 + 1694000 + 3001000 + 13886000 + 14919000 + + 0 + + + + + + 1354923000 + + 0.0721 + + + + + 0 + + + + + + 1060546000 + + 0.0564 + + + + + 0 + + + + + + 1103852000 + + 0.0587 + + + + + 0 + + + + + + 1075876000 + + 0.0068 + + + + + 0 + + + + + + 950444000 + + 0.0060 + + + + + 0 + + + + + + 1313134000 + + 0.0083 + + + + + + + + + + + 20392000 + 20392000 + + + 2000 + 1.0000 + 107754000 + + 1067000 + 1067000 + + + + + + + + + + + 36005000 + 36005000 + + + 0 + 1.0000 + 130032000 + + 3262000 + 3262000 + + + + + + + + + + + 325348000 + 325348000 + + + 2935000 + 1.0000 + 43734000 + + 43000 + 43000 + + + + + + + + + + + 66271000 + 66271000 + + + 20000 + 1.0000 + 55483000 + + 12733000 + 12733000 + + + + + + + + + + + 20161000 + 20161000 + + + 1000 + 1.0000 + 84358000 + + -88612000 + -88612000 + + + + + + + + + + + 0 + 21246000 + + + 0 + 0.0000 + 0 + + -1669000 + -894000 + + + + + + + + + + + 30056000 + 30056000 + + + 0 + 1.0000 + 76947000 + + 17125000 + 17125000 + + + + + + + + 28683000 + + 28683000 + + 0 + 0 + + 28683000 + -4830000 + 1.0000 + -4830000 + 2587000 + 0 + + + + + + 28683000 + 28683000 + 86717996000 + + + + 202732000 + 48050000 + 32895000 + 40263000 + 235627000 + 88313000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 235627000 + 88313000 + 46000 + 24000 + -1178033000 + -574814000 + -281107000 + -262158000 + 105403000 + -11677000 + 105403000 + -11677000 + 31682000 + 316137000 + -1322009000 + -532488000 + 5250000 + 121990000 + 48000 + 7000 + 5298000 + 121997000 + + + diff --git a/playground/xml/xml_test.go b/playground/xml/xml_test.go new file mode 100644 index 0000000..26b98f7 --- /dev/null +++ b/playground/xml/xml_test.go @@ -0,0 +1,63 @@ +package xml + +import ( + "fmt" + xj "github.com/basgys/goxml2json" + "github.com/buger/jsonparser" + "os" + "testing" +) + +type Person struct { + Name string `xml:"name"` +} + +func TestParse(t *testing.T) { + xmlFile, err := os.Open("2018Q1.xml") + if err != nil { + fmt.Println(err) + return + } + defer xmlFile.Close() + json, err := xj.Convert(xmlFile) + if err != nil { + fmt.Println(err) + return + } + + fmt.Println(json.String()) + + //err = jsonparser.ObjectEach(json.Bytes(), objectEach,"xbrl") + //if err != nil { + // fmt.Println(err) + // return + //} + + // 營業收入 + var revenue string + _, err = jsonparser.ArrayEach(json.Bytes(), func(value []byte, dataType jsonparser.ValueType, offset int, err error) { + revenue, err = jsonparser.GetString(value, "#content") + fmt.Println(revenue) + }, "xbrl", "Revenue") + if err != nil { + fmt.Println(err) + return + } +} + +func parse(b []byte) { + err := jsonparser.ObjectEach(b, objectEach, "xbrl") + if err != nil { + fmt.Println(err) + return + } +} + +func objectEach(key []byte, value []byte, dataType jsonparser.ValueType, offset int) error { + fmt.Printf("[Key]: [%s]\n Value: '%s'\n Type: %s\n", string(key), string(value), dataType) + return nil +} + +func arrayEach(value []byte, dataType jsonparser.ValueType, offset int, err error) { + fmt.Printf("Array Value: '%s'\n Type: %s\n", string(value), dataType) +}