Akelpad+xmllint (XML validator)

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 5
Joined: Sat Apr 11, 2015 3:33 pm

Akelpad+xmllint (XML validator)

Post 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 :)

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

oddi
May be XMLValidator.js or XML tester?

Offline
Posts: 5
Joined: Sat Apr 11, 2015 3:33 pm

Post by oddi »

Tnx for replay, but i wanna use xmllint, I try self write script but not luck :(
Hope for help. Tnx :)

Offline
Posts: 5
Joined: Sat Apr 11, 2015 3:33 pm

Post 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]

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post 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.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

oddi
%f - active file

Code: Select all

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

Offline
Posts: 5
Joined: Sat Apr 11, 2015 3:33 pm

Post by oddi »

Many tnx guys, now woks ! :)
but show log only when have errors, how enable always show log

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post 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)
Last edited by Skif_off on Tue Feb 16, 2016 12:57 am, edited 1 time in total.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

oddi
What is the meaning of the --noout parameter ?
Maybe you should run xmllint.exe without this parameter or with other parameters.

Offline
Posts: 5
Joined: Sat Apr 11, 2015 3:33 pm

Post 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 :)

Offline
Posts: 96
Joined: Tue Nov 10, 2015 4:56 am

Post 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 ...

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post 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 дважды кликаете по строке с ошибкой, курсор прыгает в документ в позицию номер строки с ошибкой:позиция ошибки от начала строки.
Если не работает, то попробуйте запустить в консоли с файлом с ошибками - формат не изменился с выходом новой версии? Уже засыпаю, могу забыть посмотреть. Хотя обычно не меняют без крайней нужды, тем более у чисто консольной утилиты.

Offline
Posts: 96
Joined: Tue Nov 10, 2015 4:56 am

Post 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 ...

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post 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.
Post Reply