Page 1 of 1

Akelpad+xmllint (XML validator)

Posted: Sat Apr 11, 2015 3:39 pm
by oddi
Hello guys, need help about how use xmllint for check validation XML files.
With notepad ++ used this command and parameters:

xmllint.exe --valid --noout $(FULL_CURRENT_PATH),

where $(FULL_CURRENT_PATH) is path to current open file
Hope somebody help me how convert this line to use with Akelpad and show log status.
Many tnx :)

Posted: Sat Apr 11, 2015 4:03 pm
by Skif_off
oddi
May be XMLValidator.js or XML tester?

Posted: Sat Apr 11, 2015 5:16 pm
by oddi
Tnx for replay, but i wanna use xmllint, I try self write script but not luck :(
Hope for help. Tnx :)

Posted: Sat Apr 11, 2015 5:33 pm
by oddi
I read topics for xml validator and tidy

now my script is :

-"XML tester" Call("Log::Output", 1, `"xmllint.exe" --valid --noout`) Icon(0)

need help which parameter need for current open file [/quote]

Posted: Sat Apr 11, 2015 6:25 pm
by Skif_off
oddi
May be

Code: Select all

-"XML tester" Call("Log::Output", 1, `"xmllint.exe" --valid --noout`, "", "", "", "", "", 4096) Icon(0)
?
See \AkelFiles\Docs\Log-End.txt:
4096 - Source input - selection or all document if selection is empty.

Posted: Sat Apr 11, 2015 7:46 pm
by KDJ
oddi
%f - active file

Code: Select all

"XML tester" Call("Log::Output", 1, `"xmllint.exe" --valid --noout "%f"`)

Posted: Sun Apr 12, 2015 2:34 am
by oddi
Many tnx guys, now woks ! :)
but show log only when have errors, how enable always show log

Posted: Sun Apr 12, 2015 12:12 pm
by Skif_off
xmllint uses Error Return Codes and it's not very convenient because xmllint does not write "valid" or "invalid" in STDOUT/STDERR).

XMLStarlet is more interesting (one file!):

Code: Select all

"Validate XML (well-formedness only)" Call("Log::Output", 1, `"%a\AkelFiles\Tools\XMLStarlet\xml.exe" val --well-formed --err "%f"`, "", "^file:///([A-Za-z]:/[^:]+):(\d+)\.(\d+):", "/GOTOLINE=\2:\3")

Code: Select all

"Validate XML (XSD schema)" Call("Log::Output", 1, `"%a\AkelFiles\Tools\XMLStarlet\xml.exe" val --xsd "%a\AkelFiles\Tools\XMLStarlet\name.xsd" --err "%f"`, "", "^file:///([A-Za-z]:/[^:]+):(\d+)\.(\d+):", "/GOTOLINE=\2:\3")
(with jump to the text from the panel)

Posted: Sun Apr 12, 2015 1:47 pm
by KDJ
oddi
What is the meaning of the --noout parameter ?
Maybe you should run xmllint.exe without this parameter or with other parameters.

Posted: Sun Apr 12, 2015 6:38 pm
by oddi
@Skif off - many tnx , later i watch this xmlstarlet :)

@KDJ : in notepad++ i used this:
xmllint.exe --valid --noout $(FULL_CURRENT_PATH),
and report is :
if file is correct -i see error 0 in log window
if file is broken - i see in log window all errors and lines where have this errors.
Now i wanna reproduce this in Akelpad with same results in log window, but atm not luck :(

PS:
@Skif off - many tnx again for idea with XMLstarlet :)
worked amazing , with errors, lines and etc etc :)

Posted: Mon Feb 15, 2016 4:32 pm
by InFive
Skif_off wrote:

Code: Select all

"Validate XML (well-formedness only)" Call("Log::Output", 1, `"%a\AkelFiles\Tools\XMLStarlet\xml.exe val --well-formed --err "%f"`, "", "^file:///([A-Za-z]:/[^:]+):(\d+)\.(\d+):", "/GOTOLINE=\2:\3")

Code: Select all

"Validate XML (XSD schema)" Call("Log::Output", 1, `"%a\AkelFiles\Tools\XMLStarlet\xml.exe val --xsd "%a\AkelFiles\Tools\XMLStarlet\name.xsd" --err "%f"`, "", "^file:///([A-Za-z]:/[^:]+):(\d+)\.(\d+):", "/GOTOLINE=\2:\3")
I get an error

Code: Select all

Can't execute command: "D:\Program Files\AkelPad\AkelFiles\Tools\XMLStarlet\xml.exe val --well-formed --err "E:\backup\building\Content.xml"
It turned out that the template commands no quotation marks after xml.exe ... placing quotation marks, the commands began work. Thanks, great validator.

but it is unclear what it means "(with jump to the text from the panel)" - from the Log:Output? from the Log:Output not going jump ...

Posted: Tue Feb 16, 2016 1:15 am
by Skif_off
InFive wrote:I get an error
Fixed.
InFive wrote:but it is unclear what it means "(with jump to the text from the panel)" - from the Log:Output? from the Log:Output not going jump ...
На русском, извиняюсь :)
Вывод утилиты идёт в Log:Output, сообщение об ошибке начинается с новой строки и выглядит так:
file:///полное имя файла:номер строки с ошибкой.позиция от начала строки: ошибка
Плагин парсит вывод утилиты и когда вы в панели Log:Output дважды кликаете по строке с ошибкой, курсор прыгает в документ в позицию номер строки с ошибкой:позиция ошибки от начала строки.
Если не работает, то попробуйте запустить в консоли с файлом с ошибками - формат не изменился с выходом новой версии? Уже засыпаю, могу забыть посмотреть. Хотя обычно не меняют без крайней нужды, тем более у чисто консольной утилиты.

Posted: Sat Feb 20, 2016 5:50 pm
by InFive
Skif_off
Thank you, my native Russian ...

I realized that I did not understand the last time - for some reason it goes from the log is not always to the place of the error, and the cursor can be put in place well before the error ... I will logically calculate the principle of its going to the error ...

One sorry - he only checks the file saved on the disk, not the currently open document and after every edit is necessary to save the document to better check ...

Posted: Sat Feb 20, 2016 7:21 pm
by Skif_off
InFive wrote:for some reason it goes from the log is not always to the place of the error, and the cursor can be put in place well before the error
I don't know the reason, it may be the case in the opening or closing tag: that is, the moment from which the structure is broken - not invalid closing tag, for example, but the beginning of an element with an error. I mainly use XMLValidator.js and he sometimes behaves as.
InFive wrote:he only checks the file saved on the disk, not the currently open document
It's possible (only?) with js-script and temp-file (aka MarkdownPreview.js), maybe later.