"LStatie" wrote:
>
>
> "(E-Mail Removed)" wrote:
>
> > String xq = String.Format(
> > "//downloadmodule[@Architecture=\"{0}\" and @Name=\"{4}\" " +
> > "and ( version/@Major>{1} or version/@Major={1} " +
> > " and (version/@Minor > {2} or version/@Minor = {2}" +
> > "and version/@Build > {3}))]",
> > Architecture, Major, Minor, Build, Name);
> > XmlElement nodeUpdate =
> > (XmlElement)xmlUpdateCfg["updateinfo"].SelectSingleNode(xq);
> >
> > Works fine for me. If you have specific code that fails then please
> > a) provide code that is droppable into any project that exhibits this
> > behavior and often times specifying "how it fails" would also be
> > helpful.
> >
> >
> The code that fails is below:
>
> String xPath = String.Format( "//transactions/transaction[Completed=1 and
> (EffectiveDate < '{0}' and EffectiveDate = '{0}')][last()]", ClaimDate);
>
> XmlElement root = doc.DocumentElement;
> XmlElement node = (XmlElement) root.SelectSingleNode( xPath );
>
> I tried \" instead of ' around {0}.
> I tried XmlNode instead of XmlElement
> I tried @"//transa..." instead of "//transa..."
>
> What keeps happening is that as soon as there is a < or > in the xPath, the
> SelectSingleNode returns null.
>
> P.S. I know that the xml loaded fine and all else works, because all I have
> to do is remove the < from the xPath and I get a node back.
Correction:
String xPath = String.Format( "//transactions/transaction[Completed=1 and
(EffectiveDate < '{0}' or EffectiveDate = '{0}')][last()]", ClaimDate);
|