Bentley Map VBA XPath locateOp returns broken feature enumerator?

Hi all,

I recently noticed there's an xpath query as part of the locateOp ... thought it was exactly what I needed to scan the file and return all features that have a certain xml sub fragment property....

Heres my problem the code returns a result LocatedFeaturesCount = 28 ...., however the featureEnumerator.Current throws an automation error???

Am I doing something wrong in the code below?

  Dim oLocateOp As New locateOp
  oLocateOp.ScanReferenceAttachments = False
  oLocateOp.IncludeOnlyFeatures = True
  oLocateOp.ClearHilited = True
  oLocateOp.XPath = "//FileName[text()[contains(.,'118101')]]"
  oLocateOp.Mode = LocateOpMode.locateOpModeScan
  oLocateOp.AutoAcceptScanFile = True
  oLocateOp.LoadRootFeatureOnly = True
  Debug.Print oLocateOp.LocatedFeaturesCount
  Dim fe As FeatureEnumerator
  Set fe = oLocateOp.GetLocatedFeatures
  fe.DeferExternalPropertyLoad = True
  fe.RootFeatureOnly = True
  Do While fe.MoveNext
    Dim f As feature
    Set f = fe.Current
    f.AddToSelectionSet (True)

Bentley Map - Version


  • Greetings Adam,

    After modifying the XPath statement for data set differences, your code works as expected. If you would direct message me, and send a sample data set, including XML schema and design file, I will attempt to replicate the error you are experiencing.


    Jeff Bielefeld [Bentley]