Groups | Blog | Home
all groups > dotnet xml > december 2004 >

dotnet xml : XPath problem


gonzalez
12/28/2004 4:32:34 PM
Hi all,

How come the following XPath expression doesn't return any nodes?

descendant::*[node()=SignerInfo]

Here's how it's called on the document root node:

XmlNodeList list = m_xmlDoc.DocumentElement.SelectNodes(sXPathExpression);
Here's the XML:

<?xml version="1.0" encoding="utf-8"?><Deal BPApplication="WCC"
xmlns="http://tempuri.org/TestWCDealSchema.xsd"><Applicants><SignerInfo
ApplicantType=""><FirtName /><MiddleName /><LastName /><SSN
/><Adress><Street /><City /><State /><Zip /><Country
/></Adress><ContactInfo><PrimaryHomePhone /><SecondaryHomePhone
/><PrimaryWorkPhone /><SecondaryWorkPhone /><MobilPhone /><FaxPhone
/><EmailAdress
/></ContactInfo><YrsCreditBureau>0.00</YrsCreditBureau><Install_Balance>0.00
</Install_Balance><Revolving_Balance>0.00</Revolving_Balance><RevolvingAvail
[quoted text, click to view]
_DelDrg><Ch7last5yrs>false</Ch7last5yrs><CustOwnsHome>false</CustOwnsHome><F
ICOScore>0.00</FICOScore><WestlakeReferral>false</WestlakeReferral><YrsOnPre
sentJob>0.00</YrsOnPresentJob><GrossMonthlyIncome>0.00</GrossMonthlyIncome><
RentMortgage>0.00</RentMortgage><OtherBureauDebts>0.00</OtherBureauDebts><Ph
UtlChcknginName>false</PhUtlChcknginName><SpousePrtnr>false</SpousePrtnr></S
ignerInfo><CosignerInfo ApplicantType=""><FirtName /><MiddleName /><LastName
/><SSN /><Adress><Street /><City /><State /><Zip /><Country
/></Adress><ContactInfo><PrimaryHomePhone /><SecondaryHomePhone
/><PrimaryWorkPhone /><SecondaryWorkPhone /><MobilPhone /><FaxPhone
/><EmailAdress
/></ContactInfo><YrsCreditBureau>0.00</YrsCreditBureau><Install_Balance>0.00
</Install_Balance><Revolving_Balance>0.00</Revolving_Balance><RevolvingAvail
[quoted text, click to view]
_DelDrg><Ch7last5yrs>false</Ch7last5yrs><CustOwnsHome>false</CustOwnsHome><F
ICOScore>0.00</FICOScore><WestlakeReferral>false</WestlakeReferral><YrsOnPre
sentJob>0.00</YrsOnPresentJob><GrossMonthlyIncome>0.00</GrossMonthlyIncome><
RentMortgage>0.00</RentMortgage><OtherBureauDebts>0.00</OtherBureauDebts><Ph
UtlChcknginName>false</PhUtlChcknginName><SpousePrtnr>false</SpousePrtnr></C
osignerInfo></Applicants><Vehicle><ModelYr>0.00</ModelYr><BBook>0.00</BBook>
<Mileage>0.00</Mileage><Class>0.00</Class><Engine>false</Engine><Trans>false
</Trans><AirCond>false</AirCond><Upholst>false</Upholst><Dash>false</Dash><P
aint>false</Paint><FrntDmg>false</FrntDmg><RearDmg>false</RearDmg><OthDmg>fa
lse</OthDmg></Vehicle><DealParameters><Reason
/><CustChk>0.00</CustChk><CheckTo>0.00</CheckTo><Payoff>0.00</Payoff><Other>
0.00</Other><Title>0.00</Title><Ins>false</Ins><APR>0.00</APR><PymtsTerm>0.0
0</PymtsTerm><LoanFee>0.00</LoanFee><ReasonFull
/><SubTotal>0.00</SubTotal><InsAmount>0.00</InsAmount><AmtFinan>0.00</AmtFin
an><FinanceCharge>0.00</FinanceCharge><Pymts>0.00</Pymts><MAXOKTOFIN>0.00</M
AXOKTOFIN><CustFactor>0.00</CustFactor><StructOK>false</StructOK><AmtFinOK>f
alse</AmtFinOK><Hint /></DealParameters></Deal>

Thanks a lot!

--Ader.

P.S.

Sorry, I think outlook express messed up the xml when pasted.

Oleg Tkachenko [MVP]
12/29/2004 12:26:37 PM
[quoted text, click to view]

That's sort of weird expression, but it should work though. What do you
want to select actually? If you want to select an element which has
SignerInfo child, use descendant::*[SignerInfo], if you want to select
SignerInfo element at any level, use descendant::SignerInfo.

--
Oleg Tkachenko [XML MVP]
gonzalez
12/30/2004 10:51:03 AM
Thanks for your response Oleg,

I know the expression can be specified in a simpler way, but the problem I
have is that even the
expressions you suggested don't work with XPath on .net 1.1 and the _xml
document that I included_.

If I use the same code against a different xml document (i.e. one formatted
like an XmlDataDocument)
then those expressions work. So I was wondering if there is a
problem/limitation with .net 1.1 XPath support?

Thanks,
--Ader.


[quoted text, click to view]

AddThis Social Bookmark Button