troubleshooting Question

How to check the node exists in xml and returns the string values by reading CDATA values

Avatar of tia_kamakshi
tia_kamakshiFlag for United Arab Emirates asked on
XML.NET ProgrammingC#
4 Comments1 Solution461 ViewsLast Modified:
Hi Experts,

How to check the node exists in xml and returns the string values by reading CDATA values.

string strXML ="<?xml version="1.0"?>
<tcm:Error xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ErrorCode="80040329" Category="17" Source="Kernel" Severity="2">
  <tcm:Line ErrorCode="80040329" Cause="false" MessageID="16137">
    <![CDATA[Unable to save Keyword (tcm:0-0-0).]]><tcm:Token>RESID_4574</tcm:Token><tcm:Token>RESID_15309</tcm:Token><tcm:Token>tcm:0-0-0</tcm:Token>
  </tcm:Line>
  <tcm:Line ErrorCode="80040329" Cause="true" MessageID="15200">
    <![CDATA[Name must be unique for items of type: Keyword within this Category and its BluePrint context. Source or sources  of conflict: tcm:236-215788-1024,tcm:237-215788-1024,tcm:241-215788-1024,tcm:243-215788-1024,tcm:423-215788-1024.]]><tcm:Token>RESID_15214</tcm:Token><tcm:Token>RESID_15309</tcm:Token><tcm:Token>RESID_15293</tcm:Token><tcm:Token>tcm:236-215788-1024,tcm:237-215788-1024,tcm:241-215788-1024,tcm:243-215788-1024,tcm:423-215788-1024</tcm:Token>
  </tcm:Line>
  <tcm:Details>
    <tcm:CallStack>
      <tcm:Location>UtilitiesBL.AssertUniqueTitle</tcm:Location>
      <tcm:Location>UtilitiesBL.AssertUniqueTitle</tcm:Location>
      <tcm:Location>KeywordBL.Create</tcm:Location>
      <tcm:Location>XMLState.Save</tcm:Location>
      <tcm:Location>Keyword.Save</tcm:Location>
    </tcm:CallStack>
  </tcm:Details>
</tcm:Error>"

Now I want to write a function which will first check whether string strXML has the xml node node in it, if there is no such node then return "valid" else my function will return the string values taken from above xml.

So my return result will be "Unable to save Keyword (tcm:0-0-0). Name must be unique for items of type: Keyword within this Category and its BluePrint context. Source or sources of conflict: tcm:236-215788-1024,tcm:237-215788-1024,tcm:241-215788-1024,tcm:243-215788-1024,tcm:423-215788-1024.", these text are there in XML.

Please suggest!!

Thanks.
ASKER CERTIFIED SOLUTION
tia_kamakshi

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros