How can I get all the sqls under the Customer tag id

  • Thread starter Thread starter polachan
  • Start date Start date
P

polachan

Guest
I want to get the all sqls under one tag id. When I call the function GETSQL , the _resultxml.tagid would be 'CUSTOMER1'. how can I get all the sqls under the tagid 'CUSTOMER1. How can I get all the sql under the customer tag id 'CUSTOMER1' FROM xml


public static xmlResult GetSQL(XmlNode element)
{
_resultxml.Tagid = element.Attributes["ID"].Value;

List<string> sql_strings1 = ((IEnumerable<object>)xml1.XPathEvaluate("/*/CUSTOMER/SQL/comment()"))
.Cast<XComment>()
.Select(c => c.Value.Trim())
.ToList();
// in xpathEvaluate argument i want to use Tagid value rather than element.name.

}


xml

<?xml version="1.0" encoding="utf-8" ?>
<STATEMENT>
<CUSTOMER ID = "CUSTOMER1">
<SQL ID="SQLS1">
<!--
SELECT * FROM CUSTOMER WHERE CODE = '123'
-->
</SQL>
<SQL ID="SQLS2">
<!--
SELECT * FROM CUSTOMER WHERE CODE = '567'
-->
</SQL>
<Address>test@gmail.com</Address>
<Address>test1@gmail.com</Address>
<Address></Address>
<MailSubject>Please find statement</MailSubject>
<MailBody>Please find statement</MailBody>

<FILENAME>file1</FILENAME>

</CUSTOMER>
<CUSTOMER ID = "CUSTOMER2">
<SQL ID="SQLS">
<!--
SELECT * FROM CUSTOMER WHERE CODE = '1234'
-->
</SQL>
<Address>test@gmail.com</Address>
<Address>test1@gmail.com</Address>
<Address></Address>
<MailSubject>Please find statement</MailSubject>
<MailBody>Please find statement</MailBody>
<FILENAME>file2</FILENAME>

</CUSTOMER>
</STATEMENT>





polachan

Continue reading...
 
Back
Top