[
https://issues.apache.org/jira/browse/CAMEL-27274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27274:
--------------------------------
Issue Type: New Feature (was: Bug)
> [Simple] Add new XML functions for Simple language
> --------------------------------------------------
>
> Key: CAMEL-27274
> URL: https://issues.apache.org/jira/browse/CAMEL-27274
> Project: Camel
> Issue Type: New Feature
> Affects Versions: 4.23.0
> Reporter: Raymond
> Priority: Minor
>
> Currently Simple has a few XML functions, such as to prettyify XML, escape
> XML (no unescape it seems) or use Xpath.
> As I work a lot with XML I still miss a few, such as:
> h2. Strip:
>
> * *{{stripXmlNamespaces(...)}} / {{{}stripNamespace(...){}}}:* Removes all
> namespace declarations ({{{}xmlns{}}} and {{{}xmlns:*{}}}) and strips
> namespace prefixes from elements and attributes (e.g., turning {{<ns1:Order
> xmlns:ns1="[http://example.com](http://example.com)" ns1:id="1">}} into
> {{{}<Order id="1">{}}}). This eliminates the need for verbose
> {{local-name()}} predicates in subsequent {{xpath(...)}} expressions or
> downstream processors when integrating with legacy SOAP services or
> multi-schema XML payloads.
> * *{{{}stripXmlDeclaration(...){}}}:* Removes the {{<?xml version="1.0"
> encoding="UTF-8"?>}} prolog. This is frequently needed when embedding one XML
> document inside another wrapper element or concatenating XML fragments.
> * *{{{}stripXmlComments(...){}}}:* Strips {{<!-- ... -->}} blocks before
> forwarding payloads to external partners or downstream parsers that choke on
> internal metadata comments.
> h2. Others:
> * *{{compactXml(...)}} (and {{{}compactJson(...){}}}):* The exact inverse of
> {{prettyPrintXml}} / {{{}prettyPrintJson{}}}. Stripping insignificant
> whitespace and newlines is very common before logging payloads on a single
> line.
> * *{{canonicalXml(...)}} (C14N):* Normalizes attribute ordering, namespace
> declarations, and empty tags ({{{}<tag/>{}}} vs {{{}<tag></tag>{}}}). This is
> essential when comparing two XML payloads for semantic equality in
> idempotency checks or test assertions, where formatting differences would
> otherwise cause false mismatches.
> * *{{isValidXml(...)}} / {{{}isValidJson(...){}}}:* A boolean predicate
> function for content-based routers
> ({{{}choice().when(simple("${isValidXml(body)}")){}}}). Currently, checking
> well-formedness in a route usually requires a {{{}doTry{}}}/{{{}doCatch{}}}
> block around an unmarshal or XPath expression.
> It would be nice if these functions are available as now I need to fallback
> to Groovy or XSLT.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)