スタイリッシュなサクソンの生産量

スタイリッシュなサクソンの生産量

フォローアップとしてこの問題、今、次のコマンドがあります。

set +H && java -cp saxon-he-10.5.jar net.sf.saxon.Query -config:saxon.xml -s:rss.xml -qs:'//item/link!substring-after(., "_")'

サクソン文書

<?xml version="1.0"?>
<!--
     For documentation on the contents of a Saxon configuration file, see
     http://www.saxonica.com/html/documentation/configuration/configuration-file/index.html
-->
<configuration edition="HE" xmlns="http://saxon.sf.net/ns/configuration"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://saxon.sf.net/ns/configuration config.xsd">
  <global optimizationLevel="10"
          stripSpace="ignorable"
          recoveryPolicy="doNotRecover"
          dtdValidationRecoverable="no" />
</configuration>

希望の出力を得るにはどのように調整する必要がありますか?

希望の出力

92.204.241.167
181.24.239.244
193.243.195.66

電流出力

<?xml version="1.0" encoding="UTF-8"?>92.204.241.167 181.24.239.244 193.243.195.66

ベストアンサー1

コマンドライン、クエリ自体の一部、または構成ファイルでシリアライゼーション属性を指定できます。コマンドラインで次を使用してください。

!indent=yes

一部のシェルで!は、これは\!

クエリでは、たとえばdeclare option output:indent "yes";

構成ファイルで指定<serialization indent="yes"/>

ここで考慮できる直列化パラメータは次のとおりです。

  • method=text- XML宣言を抑制します&

  • omit-xml-declaration=yes- XML宣言を抑制しますが、エスケープを防止しません。

  • item-separator=\n- 項目間の区切り記号として単一のスペースの代わりに改行を使用します。ここで問題は改行文字をどのように表現するかである。シェルの場合、\n最も有力な候補ですが、引用が必要な場合があり、シェルによって異なる場合があります。クエリまたは設定ファイルでは&#xa;

最後に、項目区切り文字を使用して属性を直列化する代わりに、次のように作成してクエリ自体の一部として改行文字を導入できます。

(//item/link!substring-after(., "_")) => string-join("&#xa;")

おすすめ記事