regex - Linq query not matching hrefs -


i'm trying write out matches found using regex code below:

  var source = "<content><link><a xlink:href=\"tcm:363-48948\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">read more</a></link><links xlink:href=\"tcm:362-65596\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"/></content>";   var tridionhref = new regex("tcm:([^\"]*)");   var elem = xelement.parse(source);    xnamespace xlink = "http://www.w3.org/1999/xlink";    if (tridionhref.ismatch(elem.tostring()))   {       foreach (var id in elem.elements().where(x => x.attribute(xlink + "href") != null))       {           console.writeline(id.attribute(xlink + "href").value); //for testing           id.attribute(xlink + "href").value = id.attribute(xlink + "href").value.replace("value1", "value2"); //just show example        }   } 

my console window outputs tcm:362-65596 not tcm:363-48948. looks code doesn't see value of xlink:href inside <a> tag attribute? can point me in right direction? need match instances of tcm:([^\"]*).

the problem not looking in right place. elem.elements looking @ link element , links element. 1 of these has attribute looking for. you'll need select elements want check more precisely before looking right attribute.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -