Below is the response XML my programmer is getting from business service -
Expand|Select|Wrap|Line Numbers
- <Data>
- <Maintain>
- <AssetList>
- <AssetDetails>
- <AssetDescriptor>
- <ns1:ParentProductCat category="ABC">ABC</ns1:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- <AssetDetails>
- <AssetDescriptor>
- <ns2:ParentProductCat category="DEF">DEF</ns2:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- <AssetDetails>
- <AssetDescriptor>
- <ns3:ParentProductCat category="GHI">GHI</ns3:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- <AssetDetails>
- <AssetDescriptor>
- <ns4:ParentProductCat category="JKL">JKL</ns4:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- <AssetDetails>
- <AssetDescriptor>
- <ns5:ParentProductCat category="MNP">MNP</ns5:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- <AssetDetails>
- <AssetDescriptor>
- <ns6:ParentProductCat category="PQR">PQR</ns6:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- <AssetDetails>
- <AssetDescriptor>
- <ns7:ParentProductCat category="YES">YES</ns7:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- <AssetDetails>
- <AssetDescriptor>
- <ns8:ParentProductCat category="col">col</ns8:ParentProductCat
- </AssetDescriptor>
- </AssetDetails>
- </AssetList>
- </Maintain>
- </Data>
My XSLT code only checkes for the ParentProductCat but since it is prefixed with "ns*:" (* is integer) it fails to find it. So that in C# code replace function is used to replace ns*: a for loop is used for this and it goes until 1000
But now my response crossed the 1000 mark and this time the XML contains total 14500 lines.
So I want to replace all ns:*
For this I want to count the number of lines present in the XML so that the for loop will run until that line number.
Please let me know how to do that?