[Lazarus] XPath expression with Namespaces

2020-11-02 Thread Simon Ameis via lazarus
Hello all,

could somebody help me with using XML namespaces in an XPath expression?

I constantly get an EDOMNamespace exception with message
'TXPathScanner.ParseStep', even if I provide an TXPathNSResolver
instance. The exception only disappears if I use an own TXPathNSResolver
descendant class which resolves the namespace prefix 'D' to any URI.
However, then the resultset is still empty. The Wiki page about xpath
doesn't mention namespaces at all.

program Project1;
{$mode objfpc}{$H+}

uses
  SysUtils, Classes,
  Laz2_DOM, laz2_XMLRead, laz2_xpath;

// example document
const
  XML = ''
+''
+'http://apache.org/dav/props/";
xmlns:lp4="http://calendarserver.org/ns/";
xmlns:lp3="urn:ietf:params:xml:ns:caldav" xmlns:lp1="DAV:">'
+'/'
+''
+'';

var
  s: TStringStream = nil;
  doc: TXMLDocument = nil;
  ResponseList: TXPathVariable = nil;
  ResponseNode: TDOMElement;
  Resolver: TXPathNSResolver = nil;
begin
  try
    s := TStringStream.Create(XML);
    ReadXMLFile(doc, s);
    Resolver := TXPathNSResolver.Create(doc.DocumentElement);
    // this call raises EDOMNamespace exception with message
'TXPathScanner.ParseStep'
    ResponseList := EvaluateXPathExpression('//D:Response',
doc.DocumentElement, Resolver);
    for Pointer(ResponseNode) in ResponseList.AsNodeSet do
  WriteLn(ResponseNode.TextContent);
  finally
    FreeAndNil(ResponseList);
    FreeAndNil(Resolver);
    FreeAndNil(doc);
    FreeAndNil(s);
  end;
  WriteLn('End');
  readLn;
end.

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] FindWindow return sequence (Windows 10)?

2020-11-02 Thread Bo Berglund via lazarus
On Mon, 2 Nov 2020 11:08:32 +0100, Sven Barth via lazarus
 wrote:

>Bo Berglund via lazarus  schrieb am Mo., 2.
>Nov. 2020, 08:07:
>
>> I thought that GetWindow(hWndTemp, GW_HWNDNEXT); would return the next
>> larger handle following hWndTemp, but it seems like this is not the
>> case. Is the result random or is there some known sequence when using
>> the flag GW_HWNDNEXT??
>>
>
>
>The documentation about GW_HWNDNEXT on MSDN says this:
>
>=== MSDN begin ===
>
>The retrieved handle identifies the window below the specified window in
>the Z order.
>If the specified window is a topmost window, the handle identifies a
>topmost window. If the specified window is a top-level window, the handle
>identifies a top-level window. If the specified window is a child window,
>the handle identifies a sibling window.
>
>=== MSDN end ===
>
>So nowhere does it guarantee that the handles values themselves are ordered
>only that the resulting windows are ordered in some way.
>
>In general you should not rely on the order of Handle values, because from
>the perspective of the application they are to be considered as random.
>

OK, thanks!
I just want to find the handles of windows related to each other...
So I will disregard the numerical order.


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] FindWindow return sequence (Windows 10)?

2020-11-02 Thread Sven Barth via lazarus
Bo Berglund via lazarus  schrieb am Mo., 2.
Nov. 2020, 08:07:

> I thought that GetWindow(hWndTemp, GW_HWNDNEXT); would return the next
> larger handle following hWndTemp, but it seems like this is not the
> case. Is the result random or is there some known sequence when using
> the flag GW_HWNDNEXT??
>


The documentation about GW_HWNDNEXT on MSDN says this:

=== MSDN begin ===

The retrieved handle identifies the window below the specified window in
the Z order.
If the specified window is a topmost window, the handle identifies a
topmost window. If the specified window is a top-level window, the handle
identifies a top-level window. If the specified window is a child window,
the handle identifies a sibling window.

=== MSDN end ===

So nowhere does it guarantee that the handles values themselves are ordered
only that the resulting windows are ordered in some way.

In general you should not rely on the order of Handle values, because from
the perspective of the application they are to be considered as random.

Regards,
Sven
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Best way to record a displayed video to file?

2020-11-02 Thread Bo Berglund via lazarus
On Mon, 2 Nov 2020 02:00:01 -0700 (MST), leledumbo via lazarus
 wrote:

>> What are my options to record a video playing in a web browser to a disk
>file (mp4) for later off-line viewing?
>
>Browser extension, but they can communicate with a native app. Take a look
>at Video DownloadHelper, they have both Chrome extension and a native
>downloader. I haven't checked how the extension communicates with the native
>downloader, though, but I suspect the extension is small enough to be
>examined.
>
Well, that was my first attempt..
But when I look in the VideoDownloadHelper extension settings I find a
gazillion small parts of the video (ranging from a few to a few tenths
of kb only) so that it is nearly impossible to use.
That is why I am going for a Lazarus/Fpc solution to download the
video.

My video editor uses PasLibVlc to plug into VLC and it works fine for
playing a video in my viewer, even from a website. But it relies on
the URL to contain a file name...
This is not the case mostly.

And I also want to use my new application to record actions within the
window such as mouse arrow movements and selections etc. Basically
making a tutorial using the new application.

It must result in an mp4 complete file (video and audio).


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Best way to record a displayed video to file?

2020-11-02 Thread leledumbo via lazarus
> What are my options to record a video playing in a web browser to a disk
file (mp4) for later off-line viewing?

Browser extension, but they can communicate with a native app. Take a look
at Video DownloadHelper, they have both Chrome extension and a native
downloader. I haven't checked how the extension communicates with the native
downloader, though, but I suspect the extension is small enough to be
examined.



--
Sent from: http://free-pascal-lazarus.989080.n3.nabble.com/
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Best way to record a displayed video to file?

2020-11-02 Thread Bo Berglund via lazarus
What are my options to record a video playing in a web browser to a
disk file (mp4) for later off-line viewing?
I have used the PasLibVlc package earlier for playing videos in my
application but now I need to go the other way to record a video (with
audio) which is playing inside Crome or FireFox (on Windows 10).

What are my options?
I have read Michael's doc: Displaying video files using Free Pascal
and Lazarus
but it is the oether way artound...


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus