* Re: [Comm] xmllint
@ 2014-01-19 14:34 ` Dmitry V. Levin
0 siblings, 0 replies; only message in thread
From: Dmitry V. Levin @ 2014-01-19 14:34 UTC (permalink / raw)
To: ALT Linux Community general discussions
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
Hi,
On Sun, Jan 19, 2014 at 06:05:22PM +0400, belka wrote:
> Здравствуйте всем
> может кто нибуть обьяснит мне что я делаю не так ?
Зависит от того, какую задачу вы решаете.
> обнаружил что то странное при парсинге xml файла
Парсинг xml тут не причем.
> [belka@home newfolder]$ ls
> file1 file2 file.xml
> [belka@home newfolder]$ cat ./file.xml
> <?xml version="1.0" encoding="UTF-8"?><root><messages><message id="2743937" userID="5129" userRole="3" channelID="0"><text><![CDATA[*]]></text></message></messages></root>
>
> [belka@home newfolder]$ echo "cat /root/messages/message/text/text()" | xmllint --nocdata --shell file.xml | sed '1d;$d'
> *
> [belka@home newfolder]$ text="$(echo "cat /root/messages/message/text/text()" | xmllint --nocdata --shell file.xml | sed '1d;$d' )"
> [belka@home newfolder]$ echo $text
> file1 file2 file.xml
> [belka@home newfolder]$
Эквивалентный пример без xmllint:
$ ls
file1 file2 file.xml
$ echo "*"
*
$ text="$(echo "*")"
$ echo $text
file1 file2 file.xml
$ echo "$text"
*
Согласно bash(1), "Expansion is performed on the command line after
it has been split into words. [...] The order of expansions is:
brace expansion, tilde expansion, parameter, variable and arithmetic
expansion and command substitution (done in a left-to-right fashion),
word splitting, and pathname expansion."
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-01-19 14:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19 14:34 ` [Comm] xmllint Dmitry V. Levin
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git