使用<pre>标签,里面的xml被转义

本文介绍了在发现Apache Commons Lang3部分功能被标记为过时后,寻找并使用其替代品Apache Commons Text的过程。文章详细解释了如何在项目中引入新的依赖,并探讨了这一变化对代码库的影响。

官网上面有介绍:

如果在后端可以使用:

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
        </dependency>

 正当兴致冲冲去使用时发现@Deprecated 意味着使用就要被标记成下划线,太难看。既然官方已经弃用了找到替代品:

 <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.8</version>
        </dependency>

 

 

/** * NOTE: This file has been copied and slightly modified from {com.alibaba.csp.sentinel.datasource.redis}. * <p> * <h2>Redis Datasource Task Elements Operation</h2> * * This class is a concrete implementation of a remote configuration data source, * built on top of Redis's high-performance read/write capabilities and Pub/Sub real-time * messaging mechanism. It enables dynamic loading, listening, and publishing of rule or * configuration data with low latency and strong consistency. * * <p>The primary design objectives are:</p> * * <ul> * <li><b>Real-time Updates</b>: Subscribes to a designated Redis Pub/Sub channel to detect * configuration changes immediately and trigger hot-reload events.</li> * <li><b>Deployment Flexibility</b>: Supports multiple Redis deployment modes including * standalone, Sentinel (for high availability), and Redis Cluster (for horizontal scaling).</li> * <li><b>Security Support</b>: Provides full SSL/TLS encryption support with compatibility for * both JKS and PEM certificate formats, meeting production security requirements.</li> * <li><b>Extensibility</b>: Extends {@link RemoteDatasourceTaskElementsOperation}, adhering to a unified * datasource abstraction contract. Can be seamlessly integrated into systems requiring * runtime reconfiguration, such as rule engines, policy managers, or distributed gateways.</li> * </ul> * * <h3>Working Principle</h3> * <p>During initialization, the class automatically selects the appropriate client based on * the provided {@link RedisConnectionConfig}: * <ul> * <li>If cluster nodes are configured, it creates a {@link RedisClusterClient}.</li> * <li>Otherwise, it uses a {@link RedisClient} for standalone or Sentinel mode connections.</li> * </ul> * * Additionally, it sets up a "lazy-loaded" subscription via {@link #setLazyListener(java.util.function.Supplier)} — * meaning the actual Pub/Sub connection and subscription occur only when an external system * explicitly requests listening (e.g., during startup of a configuration watcher). * This lazy initialization strategy reduces resource consumption and improves application startup time. * * <h3>Key Method Overview</h3> * <table border="1" cell-padding="8"> * <tr><th>Method</th><th>Purpose</th></tr> * <tr> * <td>{@link #getRemoteConfigInfo()}</td> * <td>Retrieves the current configuration value associated with {@code ruleKey} from Redis (via GET)</td> * </tr> * <tr> * <td>{@link #publishConfig(String)}</td> * <td>Publishes new configuration data to Redis (via SET), typically used to broadcast updates</td> * </tr> * <tr> * <td>{@link #subscribeFromChannel(String)}</td> * <td>Establishes a Pub/Sub connection and subscribes to a specific channel; incoming messages * are dispatched through {@link DelegatingRedisPubSubListener}</td> * </tr> * <tr> * <td>{@link #close()}</td> * <td>Gracefully shuts down the Redis client and releases all underlying resources</td> * </tr> * </table> * * <h3>Typical Use Cases</h3> * <ul> * <li>Dynamic rule loading in rule engines (e.g., Drools, Easy Rules)</li> * <li>Hot-reloading of distributed configurations in microservices</li> * <li>Real-time policy or permission updates in access control systems</li> * <li>Centralized rate-limiting or circuit-breaker configuration management</li> * </ul> * <h3>Example Usage</h3> * <pre>{@code * RedisConnectionConfig config = new RedisConnectionConfig(); * config.setHost("localhost"); * config.setPort(6379); * config.setTimeout(5000); * * RedisDatasourceTaskElementsOperation redisSource = * new RedisDatasourceTaskElementsOperation(config, "rule:flow", "channel:rule-update", ConfigFormat.JSON); * * // Retrieve current configuration * String currentConfig = redisSource.getRemoteConfigInfo(); * * // Start listening (triggers lazy subscription) * redisSource.startListen(); * * // Publish new config (other instances will receive notification) * redisSource.publishConfig("{\"rateLimit\": 1000}"); * * // Clean up resources * redisSource.close(); * }</pre> * * @author <a href="mailto:929160069@qq.com">zhangpengfei</a> * @since 3.0.2 */ 编译报错 [ERROR] /Users/zhangpengfei/workspace/assembly/assembly-simplified-cron/cron-redis-datasource-driven-scheduled/src/main/java/top/osjf/cron/datasource/driven/scheduled/redis/RedisDatasourceTaskElementsOperation.java:97: 错误: 此处不允许使用标记: <tr> [ERROR] * <tr>
11-20
<html><head><meta http-equiv="Content-Type" content="text/html; charset= =iso-8859-1"> <title>Trioptics Certificate</title> <link type="text/css" rel="stylesheet" href="certificate.css"></link> <base href="file:///C:/Program%20Files%20(x86)/TRIOPTICS%20GmbH/MTF-LAB%2= 05/Certificates/"></base></head> <body id="IBodyCert" class="CBodyCert"> <!-- open certificate table --> <table align="left" id="ITableCert" class="CTableCert"> <!-- Header --> <tbody><tr id="ITRCompany" class="CTRHeader"> <td id="ITDCompany" class="CTDHeader"> <div id="IDivCompany" class="CDivHeader">ImageMaster - Certificate</div> </td> <td id="ITDLogo" class="CTDHeader"> <img src="./img/Trioptics-Logo-250x65.png" id="ITDLogo" class="CTDHea= der"> </td> </tr> <tr id="ITDSlogan" class="CTRHeader"> <td colspan="2" id="ITDSlogan" class="CTDHeader"> </td> </tr> <tr> <td colspan="2"> <pre>Company : ****** Operator : ****** Time/Date : 13:30:33 June 12, 2025 Sample ID : ****** Measure Program : MTF vs. Field Temperature : 20°C Measured with : <a href="http://www.trioptics.com/">TRIOPTICS</a> - MT= F-LAB - Vers. 5.16.1 Instrument S/N : 09-113-0519 Comments : SN215U0540 </pre> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> <hr> <b>Measurement Parameter: MTF vs. Image Height</b> <pre>Setup Type : Object Infinite / Image Finite EFL (Collimator): 50 mm Wavelength : 940 nm (NIR) EFL (Sample) : 1.5550 mm F-Number : 2.0000 Object Angle : -0.0198 ° Focus Position : 85.8471 Sample Azimuth : 0.0 ° </pre></td> </tr> <tr> <td colspan="2"> <hr> <b>Measurement Graph: MTF vs. Image Height</b> <br><br> <right> <img src="Chart12.png"> </right> </td> </tr> <tr> <td colspan="2"> <hr> <b>Measurement Table: MTF vs. Image Height</b> <br><br> <!-- open measurement table --> <table cellspacing="0" align="left" id="ITableDataItems" class="CTa= bleDataItems"> <!-- begin table caption --> <tbody><tr id="ITRDataCaption" class="CTRDataCaption"> <td id="ITDCaptionBlank" class="CTDCaptionBlank"></td> <td align="center" colspan="5" id="ITDDataCaption" class="CTDDataCa= ption">Image Height (mm)</td> </tr> <tr id="ITRDataCaption" class="CTRDataCaption"> <td id="ITDDataCaption" class="CTDDataCaption">MTF</td> <td id="ITDDataCaption" class="CTDDataCaption">0.42800</td> <td id="ITDDataCaption" class="CTDDataCaption">0.29960</td> <td id="ITDDataCaption" class="CTDDataCaption">-0.00114</td> <td id="ITDDataCaption" class="CTDDataCaption">-0.29960</td> <td id="ITDDataCaption" class="CTDDataCaption">-0.42800</td> <td id="ITDDataCaption" class="CTDDataCaption">Legend</td> </tr> <!-- end table caption --> <!-- begin measurement data --> <tr id="ITRDataItem" class="CTRDataItem"> <td id="ITDEven" class="CTDDataItem">Tan 100(lp/mm)</td> <td id="ITDEven" class="CTDDataItem">0.599</td> <td id="ITDEven" class="CTDDataItem">0.677</td> <td id="ITDEven" class="CTDDataItem">0.668</td> <td id="ITDEven" class="CTDDataItem">0.703</td> <td id="ITDEven" class="CTDDataItem">0.645</td> <td colspan="1" id="ITDLegend" class="CTDLegend"><font color="ff000= 0">— — —</font></td> </tr> <tr id="ITRDataItem" class="CTRDataItem"> <td id="ITDEven" class="CTDDataItem">Sag 100(lp/mm)</td> <td id="ITDEven" class="CTDDataItem">0.558</td> <td id="ITDEven" class="CTDDataItem">0.659</td> <td id="ITDEven" class="CTDDataItem">0.673</td> <td id="ITDEven" class="CTDDataItem">0.688</td> <td id="ITDEven" class="CTDDataItem">0.642</td> <td colspan="1" id="ITDLegend" class="CTDLegend"><font color="ff000= 0">————</font></td> </tr> <!-- end measurement data --> <!-- close measurement table --> </tbody></table><br clear="all"> </td> </tr> <tr> <td colspan="2"> <hr> <b>Measurement Parameter: MTF vs. Object Angle</b> <pre>Setup Type : Object Infinite / Image Finite EFL (Collimator): 50 mm Wavelength : 940 nm (NIR) EFL (Sample) : 1.5550 mm F-Number : 2.0000 Object Angle : -0.0198 ° Focus Position : 85.8471 Sample Azimuth : 0.0 ° </pre></td> </tr> <tr> <td colspan="2"> <hr> <b>Measurement Graph: MTF vs. Object Angle</b> <br><br> <right> <img src="Chart11.png"> </right> </td> </tr> <tr> <td colspan="2"> <hr> <b>Measurement Table: MTF vs. Object Angle</b> <br><br> <!-- open measurement table --> <table cellspacing="0" align="left" id="ITableDataItems" class="CTa= bleDataItems"> <!-- begin table caption --> <tbody><tr id="ITRDataCaption" class="CTRDataCaption"> <td id="ITDCaptionBlank" class="CTDCaptionBlank"></td> <td align="center" colspan="5" id="ITDDataCaption" class="CTDDataCa= ption">Object Angle (?</td> </tr> <tr id="ITRDataCaption" class="CTRDataCaption"> <td id="ITDDataCaption" class="CTDDataCaption">MTF</td> <td id="ITDDataCaption" class="CTDDataCaption">-15.33590</td> <td id="ITDDataCaption" class="CTDDataCaption">-10.72937</td> <td id="ITDDataCaption" class="CTDDataCaption">0.00072</td> <td id="ITDDataCaption" class="CTDDataCaption">10.77662</td> <td id="ITDDataCaption" class="CTDDataCaption">15.40352</td> <td id="ITDDataCaption" class="CTDDataCaption">Legend</td> </tr> <!-- end table caption --> <!-- begin measurement data --> <tr id="ITRDataItem" class="CTRDataItem"> <td id="ITDEven" class="CTDDataItem">Tan 100(lp/mm)</td> <td id="ITDEven" class="CTDDataItem">0.599</td> <td id="ITDEven" class="CTDDataItem">0.677</td> <td id="ITDEven" class="CTDDataItem">0.668</td> <td id="ITDEven" class="CTDDataItem">0.703</td> <td id="ITDEven" class="CTDDataItem">0.645</td> <td colspan="1" id="ITDLegend" class="CTDLegend"><font color="ff000= 0">— — —</font></td> </tr> <tr id="ITRDataItem" class="CTRDataItem"> <td id="ITDEven" class="CTDDataItem">Sag 100(lp/mm)</td> <td id="ITDEven" class="CTDDataItem">0.558</td> <td id="ITDEven" class="CTDDataItem">0.659</td> <td id="ITDEven" class="CTDDataItem">0.673</td> <td id="ITDEven" class="CTDDataItem">0.688</td> <td id="ITDEven" class="CTDDataItem">0.642</td> <td colspan="1" id="ITDLegend" class="CTDLegend"><font color="ff000= 0">————</font></td> </tr> <!-- end measurement data --> <!-- close measurement table --> </tbody></table><br clear="all"> </td> </tr> <!-- close certificate table --> </tbody></table> </body></html> 为啥这个内容调用QDomDocument的setContent会失败
06-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码海无涯苦做舟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值