Reputation: 33
I have the xml file which I made a XPath request for. But it works only without the xmlns-namespace
. Can You help me with the adding correct namespace qualifier (I have errors)?
xml:
<Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'>
<EventData>
<Data Name="ObjectServer">Security</Data>
<Data Name="ObjectType">File</Data>
<Data Name="ObjectName">C:\Temp\Project1.txt</Data>
</EventData>
</Event>
XPath:
*[EventData[Data[@Name="ObjectName" and (ends-with(text() ,".exe") or ends-with(text() ,".txt"))]]]
P.S. I'm using C++. My code based on this example from msdn. But I think its not significantly, because of I'm checking this request with online XPath tester.
Thanks.
Upvotes: 1
Views: 697
Reputation: 1008
Try this:
//*[local-name()='EventData' and ./*[local-name()='Data']
[@Name="ObjectName"and
(ends-with(text() ,".exe") or ends-with(text() ,".txt"))]]
Upvotes: 1