我尝试像这样从xmlns属性获取痛苦的类型:
XPathNavigator pymntsTypeNode =
mPymntsNavigator.SelectSingleNode("Document");
bool success = pymntsTypeNode.MoveToFirstAttribute();
if (success)
{
if (pymntsTypeNode.Value.Contains("pain.001") || pymntsTypeNode.Value.Contains("pain.008"))
{
return pymntsTypeNode.Value;
}
throw new Exception("invalid attribute of payment type");
}
来自此xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CstmrCdtTrfInitn>
<GrpHdr>
...
...
...