Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. looping problem

looping problem

Scheduled Pinned Locked Moved C#
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    ybasha
    wrote on last edited by
    #1

    Hi there, i have a little problem with the looping can any one help to solve me this problem. the following are the code snippets. objTempNodes = objXml.SelectNodes("//dc:relation/dcterms:isPartOf",objNameSpaceMgr); sData[29] = ""; string relation_ispartof=""; string relation_ispartofURL=""; string relation_ispartofCol=""; foreach(XmlNode objNode in objTempNodes) { if (objNode.Attributes.Count == 0) { relation_ispartof=objNode.InnerText; if (relation_ispartof.Trim()!="") relation_ispartof = RemoveDups(relation_ispartof); objNode.InnerText = relation_ispartof; } else { foreach(XmlAttribute ElementAttr in objNode.Attributes) { if (ElementAttr.Value=="dcterms:URL") { relation_ispartofURL=objNode.InnerText; if (relation_ispartofURL.Trim()!="") relation_ispartofURL = RemoveDups(relation_ispartofURL); objNode.InnerText = relation_ispartofURL; } if (ElementAttr.Value=="nlbterms:Collections") { string strtmpCol=""; strtmpCol=objNode.InnerText; int r = 0; r=strtmpCol.IndexOf("~",0,strtmpCol.Length); if (r!=-1) { string [] arrCollection = strtmpCol.Split("~",strtmpCol.Length); string [] newarrCollect; for (int collectCount=0;collectCount

    G 1 Reply Last reply
    0
    • Y ybasha

      Hi there, i have a little problem with the looping can any one help to solve me this problem. the following are the code snippets. objTempNodes = objXml.SelectNodes("//dc:relation/dcterms:isPartOf",objNameSpaceMgr); sData[29] = ""; string relation_ispartof=""; string relation_ispartofURL=""; string relation_ispartofCol=""; foreach(XmlNode objNode in objTempNodes) { if (objNode.Attributes.Count == 0) { relation_ispartof=objNode.InnerText; if (relation_ispartof.Trim()!="") relation_ispartof = RemoveDups(relation_ispartof); objNode.InnerText = relation_ispartof; } else { foreach(XmlAttribute ElementAttr in objNode.Attributes) { if (ElementAttr.Value=="dcterms:URL") { relation_ispartofURL=objNode.InnerText; if (relation_ispartofURL.Trim()!="") relation_ispartofURL = RemoveDups(relation_ispartofURL); objNode.InnerText = relation_ispartofURL; } if (ElementAttr.Value=="nlbterms:Collections") { string strtmpCol=""; strtmpCol=objNode.InnerText; int r = 0; r=strtmpCol.IndexOf("~",0,strtmpCol.Length); if (r!=-1) { string [] arrCollection = strtmpCol.Split("~",strtmpCol.Length); string [] newarrCollect; for (int collectCount=0;collectCount

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Use the pre tag when pasting code so that the indentation is preserved, that will make the code readable. --- b { font-weight: normal; }

      Y 1 Reply Last reply
      0
      • G Guffa

        Use the pre tag when pasting code so that the indentation is preserved, that will make the code readable. --- b { font-weight: normal; }

        Y Offline
        Y Offline
        ybasha
        wrote on last edited by
        #3

        if (ElementAttr.Value=="nlbterms:Collections") { string strtmpCol=""; strtmpCol=objNode.InnerText; int r = 0; r=strtmpCol.IndexOf("~",0,strtmpCol.Length); if (r!=-1) { string [] arrCollection = strtmpCol.Split("~",strtmpCol.Length); string [] newarrCollect; for (int collectCount=0;collectCount { string strArrCollection = arrCollection[collectCount]; if (newarrCollect.Length ==0) { newarrCollect.SetValue(strArrCollection,collectCount); } { int r1 =0; r1 = strtmpCol.IndexOf("~",0,strtmpCol.Length); } } } string [] arrCollection = strtmpCol.Split(new Char []{'~'},strtmpCol.Length); string [] newarrCollect = RemoveDupsSp(arrCollection); early it was using the below hardcode syntax which take only single value when i get value like 10100~10200 or 10100~10100 it cant able to display the data if we get value like 10100~10100 then it show display general same we we get value like 10100~10200~10400 then it show display general | Reference | Exclusive and if i get value like 10100~10100~10200 then it show display like general | referenc..etc { if (strtmpCol.Trim()=="10100") relation_ispartofCol = "General"; if (strtmpCol.Trim()=="10200") relation_ispartofCol = "Reference"; if (strtmpCol.Trim()=="10400") relation_ispartofCol = "Exclusive"; //Final Storage of relation_ispartof sData[29] = "Collection:" + relation_ispartofCol + "~URL:" + relation_ispartofURL + "~DOI:~" + relation_ispartof;

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups