| MapleLeaf 2005-08-27, 8:49 pm |
| ah..I got the count working by the following statement
recordCount = System.Convert.ToInt32(xpath(FileMessage,
"count(//*[local-name()='Record' and
namespace-uri()='http://iwaysoftware.com/exposed/gracew/TXI/Tables/WORK_BUNDLE_QUALITY_CODES'])"));
But in a similar fashion, I tried to get only the 'Record' node and all it's
children by the following:
pathString = System.String.Format("//*[local-name()='Record' and
namespace-uri()='http://iwaysoftware.com/exposed/gracew/TXI/Tables/WORK_BUNDLE_QUALITY_CODES'][{0}]", recordCount);
xDoc = new System.Xml.XmlDocument();
xDoc = xpath(FileMessage, pathString);
But it seems like that I'm not getting anything casue I re-assign the xDoc
to a message and did the following and it's just an empty string in the event
viewer:
WorkXML = xDoc;
strQualityCode = xpath(WorkXML, "string(/Record/QUALITY_CODE)");
strQualityCode = xpath(FileMessage, "string(/Record/QUALITY_CODE)");
System.Diagnostics.EventLog.WriteEntry("QualityCode", strQualityCode);
What have I done wrong? Any suggestion?
"MapleLeaf" wrote:
> Hi,
>
> If I have the following message (listed at the end of this mesage), how can
> I get the count of the <WORK_BUNDLE_QUAL:Record> element? and how can I get
> to extract the node <WORK_BUNDLE_QUAL:Record> and assign to a message (which
> I defined it as an xml document)? Any help is much appreciated.
>
> I tried to count with the following statement but it's always zero.
>
> recordCount = System.Convert.ToInt32(xpath(FileMessage,
> "count(/*[local- name()='WORK_BUNDLE_QUAL:TableChangeEven
t' and
> namespace-uri()='http://iwaysoftware.com/exposed/gracew/TXI/Tables/WORK_BUNDLE_QUALITY_CODES']/*[local-name()='WORK_BUNDLE_QUAL:UpdatedRows'
> and
> namespace-uri()='http://iwaysoftware.com/exposed/gracew/TXI/Tables/WORK_BUNDLE_QUALITY_CODES']/*[local-name()='WORK_BUNDLE_QUAL:Record'
> and
> namespace-uri()='http://iwaysoftware.com/exposed/gracew/TXI/Tables/WORK_BUNDLE_QUALITY_CODES'])"));
>
>
> Message is as follows:
> ----------------
> <?xml version="1.0" encoding="utf-8"?>
> <WORK_BUNDLE_QUAL:TableChangeEvent
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:exposed="http://iwaysoftware.com/exposed"
> xmlns:WORK_BUNDLE_QUAL="http://iwaysoftware.com/exposed/gracew/TXI/Tables/WORK_BUNDLE_QUALITY_CODES">
> <WORK_BUNDLE_QUAL:UpdatedRows>
> <WORK_BUNDLE_QUAL:Record>
> <WORK_BUNDLE_QUAL:QUALITY_CODE>02</WORK_BUNDLE_QUAL:QUALITY_CODE>
> <WORK_BUNDLE_QUAL:DESCRIPTION>grace 2 test table
> change</WORK_BUNDLE_QUAL:DESCRIPTION>
> <WORK_BUNDLE_QUAL:ACTION>U</WORK_BUNDLE_QUAL:ACTION>
> WORK_BUNDLE_QUAL:ROWID>AAAHZ2AALAAAAAmAAA</WORK_BUNDLE_QUAL:ROWID>
> </WORK_BUNDLE_QUAL:Record>
> </WORK_BUNDLE_QUAL:UpdatedRows>
> </WORK_BUNDLE_QUAL:TableChangeEvent>
>
|