세련된 색슨 생산량

세련된 색슨 생산량

후속 조치로이 문제, 이제 다음 명령이 있습니다.

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;")

관련 정보