有没有一种方法可以在Jackrabbit filevault xml文档中垂直格式化多值属性? [英] Is there a way to format multi-valued properties vertically in a Jackrabbit filevault xml doc?

查看:123
本文介绍了有没有一种方法可以在Jackrabbit filevault xml文档中垂直格式化多值属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在git repo中使用 FileVault xml文件来配置自定义OSGi服务在我们的Adobe Experience Manager实例中运行。

We use FileVault xml files in a git repo to configure our custom OSGi services running in our Adobe Experience Manager instance.

在许多情况下,效果很好,但似乎我们必须水平列出多值属性,以逗号分隔-唯一分隔的字符串,例如:

This works out really well in many cases, but it seems like we have to list multi-valued properties horizontally, in a comma-only-separated string, like this:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
  jcr:primaryType="sling:OsgiConfig"
  aLongMultiValuedProperty="[first,second,third,fourth,fifth]"/>

这个例子看起来并不糟糕,但是我最近编辑了一个行长为1998个字符的文件,而git diff非常丑陋。

This example doesn't look that bad, but I recently edited a file with a line 1998 characters long, and the git diff was incredibly ugly.

因此,我宁愿能够格式化这样的列表:

So I'd rather be able to format our lists something like this:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
  jcr:primaryType="sling:OsgiConfig"
  aLongMultiValuedProperty="[
    first,
    second,
    third,
    fourth,
    fifth]"/>

但是,这样做会导致JCR属性值中出现多余的空格。

However, doing that results in extra whitespace in the JCR property values.

是否有其他垂直格式不会导致类似的空白?

Is there a different vertical formatting that doesn't result in extra whitespace like that?

推荐答案

根据您的情况,我建议使用(较新的)属性格式。加上反斜杠 \ ,您可以指定一行在下一行继续。

In your situation I would recommend to use the (newer) properties format. With a trailing backslash \ you can specify that a line continued on the next line.

不幸的是,几乎没有网络上的有用文档。最好执行以下XPath查询以找到一些示例:

Unfortunately there is little useful documentation in the web. Best do the following XPath query to find some examples:

/jcr:root/apps//*[jcr:like(fn:name(), '%.config')]

这是我的一个真实示例:

Here is a real-world example from me:

com.day.cq.wcm.msm.impl.actions.ContentUpdateActionFactory.config

cq.wcm.msm.action.excludednodetypes=[ \
  "cq:LiveSyncConfig", \
  "cq:BlueprintSyncConfig", \
  "cq:LiveSyncAction", \
  "cq:CatalogSyncConfig", \
  "cq:CatalogSyncAction", \
  "cq:meta", \
  ]
cq.wcm.msm.action.excludedparagraphitems=[ \
  "cq:propertyInheritanceCancelled", \
  ]
cq.wcm.msm.action.excludedprops=[ \
  "jcr:(?!(title|description)$).*", \
  "sling:(?!(resourceType|resourceSuperType)$).*", \
  "cq:(?!(designPath|template|lastTranslationUpdate|targetEngine)$).*", \
  "publishCampaignId", \
  ]
cq.wcm.msm.action.ignoredMixin=[ \
  ".*", \
  ]    

简而言之,它是带有后缀的属性文件。配置。其他所有内容都类似于sling:OsgiConfig节点(运行模式,文件名)。请注意,数据类型(布尔,长,...)的指定方式不同。但是您可以混合使用两种格式,因此不必迁移每个配置节点。

In short it is a property file with the suffix .config. Everything else is just like the sling:OsgiConfig nodes (run-modes, file name). Only be aware that data-types (boolean, long, ...) are specified differently. But you can mix both formats, so you don't have to migrate every config-node.

这篇关于有没有一种方法可以在Jackrabbit filevault xml文档中垂直格式化多值属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆