1

我正在尝试从包含中文本 XML 格式的数据的表中获取以下结果。

我希望在开始分隔符 L7p:AuditDetailAssertion 和下一次出现的结束分隔符 /L7p:AuditDetailAssertion 之间出现所有文本。

然而,困难的部分是这些字符串可能出现一次或多次。

这是选择它时 XML 在列中的显示方式:

<wsp:All wsp:Usage="Required">
    <L7p:AuditAssertion>
        <L7p:SaveRequest booleanValue="true"/>
        <L7p:SaveResponse booleanValue="true"/>
    </L7p:AuditAssertion>
    <L7p:SetVariable>
        <L7p:Base64Expression stringValue=""/>
        <L7p:VariableToSet stringValue="doStatAudit"/>
    </L7p:SetVariable>
    <L7p:SetVariable>
        <L7p:Base64Expression stringValue=""/>
        <L7p:VariableToSet stringValue="doAudit"/>
    </L7p:SetVariable>
    <L7p:SetVariable>
        <L7p:Base64Expression stringValue=""/>
        <L7p:VariableToSet stringValue="auditOnFailure"/>
    </L7p:SetVariable>
    <L7p:SetVariable>
        <L7p:Base64Expression stringValue=""/>
        <L7p:VariableToSet stringValue="preRouteLatency"/>
    </L7p:SetVariable>
    <L7p:SslAssertion/>
    <L7p:AuditDetailAssertion>
        **<L7p:Detail stringValue="${request.http.allheadervalues}"/>
        <L7p:Enabled booleanValue="false"/>**
    </L7p:AuditDetailAssertion>
    <wsp:OneOrMore wsp:Usage="Required">
        <wsp:All wsp:Usage="Required">
            <wsse:SecurityToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                <wsse:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#UsernameToken</wsse:TokenType>
                <L7p:Properties/>
            </wsse:SecurityToken>
            <L7p:XpathCredentialSource>
                <L7p:Enabled booleanValue="false"/>
                <L7p:PasswordExpression xpathExpressionValue="included">
                    <L7p:Expression stringValue="/s:Envelope/s:Header/wsse:Security/wsse:UsernameToken/wsse:Password"/>
                    <L7p:Namespaces mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="s"/>
                            <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
                        </L7p:entry>
                        <L7p:entry>
                            <L7p:key stringValue="wsse"/>
                            <L7p:value stringValue="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
                        </L7p:entry>
                    </L7p:Namespaces>
                </L7p:PasswordExpression>
                <L7p:XpathExpression xpathExpressionValue="included">
                    <L7p:Expression stringValue="/S:Envelope/S:Header/wsse:Security/wsse:UsernameToken/wsse:Username"/>
                    <L7p:Namespaces mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="ns2"/>
                            <L7p:value stringValue="/"/>
                        </L7p:entry>
                        <L7p:entry>
                            <L7p:key stringValue="s"/>
                            <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
                        </L7p:entry>
                        <L7p:entry>
                            <L7p:key stringValue="S"/>
                            <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
                        </L7p:entry>
                        <L7p:entry>
                            <L7p:key stringValue="wsse"/>
                            <L7p:value stringValue="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
                        </L7p:entry>
                    </L7p:Namespaces>
                </L7p:XpathExpression>
            </L7p:XpathCredentialSource>
            <L7p:AuditDetailAssertion>
                **<L7p:Detail stringValue="${secpass.blah.plaintext}"/>**
            </L7p:AuditDetailAssertion>
            <L7p:ComparisonAssertion>
                <L7p:CaseSensitive booleanValue="false"/>
                <L7p:Expression1 stringValue="${request.username}"/>
                <L7p:Operator operatorNull="null"/>
                <L7p:Predicates predicates="included">
                    <L7p:item dataType="included">
                        <L7p:Type variableDataType="string"/>
                    </L7p:item>
                    <L7p:item binary="included">
                        <L7p:RightValue stringValue=""/>
                    </L7p:item>
                </L7p:Predicates>
            </L7p:ComparisonAssertion>
            <L7p:ComparisonAssertion>
                <L7p:CaseSensitive booleanValue="false"/>
                <L7p:Expression1 stringValue="${request.password}"/>
                <L7p:Operator operatorNull="null"/>
                <L7p:Predicates predicates="included">
                    <L7p:item dataType="included">
                        <L7p:Type variableDataType="string"/>
                    </L7p:item>
                    <L7p:item binary="included">
                        <L7p:RightValue stringValue="${secpass.AccountSearch.plaintext}"/>
                    </L7p:item>
                </L7p:Predicates>
            </L7p:ComparisonAssertion>
        </wsp:All>
        <wsp:All wsp:Usage="Required">
            <L7p:CustomizeErrorResponse>
                <L7p:Content stringValue="Forbidden!"/>
                <L7p:Enabled booleanValue="false"/>
                <L7p:ExtraHeaders nameValuePairArray="included"/>
                <L7p:HttpStatus stringValue="403"/>
            </L7p:CustomizeErrorResponse>
            <L7p:HardcodedResponse>
                <L7p:Base64ResponseBody stringValue=""/>
                <L7p:EarlyResponse booleanValue="true"/>
                <L7p:ResponseStatus stringValue="403"/>
            </L7p:HardcodedResponse>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue=""/>
                <L7p:VariableToSet stringValue="postRouteLatency"/>
            </L7p:SetVariable>
            <L7p:FalseAssertion/>
        </wsp:All>
    </wsp:OneOrMore>
    <L7p:HttpRoutingAssertion>
        <L7p:ConnectionTimeout stringValue="10000"/>
        <L7p:CurrentSecurityHeaderHandling intValue="3"/>
        <L7p:Login stringValue=""/>
        <L7p:PassThroughSoapFaults booleanValue="false"/>
        <L7p:Password stringValue=""/>
        <L7p:ProtectedServiceUrl stringValue=""/>
        <L7p:ProxyPassword stringValueNull="null"/>
        <L7p:ProxyUsername stringValueNull="null"/>
        <L7p:RequestHeaderRules httpPassthroughRuleSet="included">
            <L7p:Rules httpPassthroughRules="included">
                <L7p:item httpPassthroughRule="included">
                    <L7p:Name stringValue="Cookie"/>
                </L7p:item>
                <L7p:item httpPassthroughRule="included">
                    <L7p:Name stringValue="SOAPAction"/>
                </L7p:item>
            </L7p:Rules>
        </L7p:RequestHeaderRules>
        <L7p:RequestParamRules httpPassthroughRuleSet="included">
            <L7p:ForwardAll booleanValue="true"/>
            <L7p:Rules httpPassthroughRules="included"/>
        </L7p:RequestParamRules>
        <L7p:ResponseHeaderRules httpPassthroughRuleSet="included">
            <L7p:Rules httpPassthroughRules="included">
                <L7p:item httpPassthroughRule="included">
                    <L7p:Name stringValue="Set-Cookie"/>
                </L7p:item>
            </L7p:Rules>
        </L7p:ResponseHeaderRules>
    </L7p:HttpRoutingAssertion>
    <wsp:OneOrMore wsp:Usage="Required">
        <wsp:All wsp:Usage="Required">
            <L7p:ComparisonAssertion>
                <L7p:CaseSensitive booleanValue="false"/>
                <L7p:Expression1 stringValue="${auditOnFailure}"/>
                <L7p:Operator operatorNull="null"/>
                <L7p:Predicates predicates="included">
                    <L7p:item dataType="included">
                        <L7p:Type variableDataType="string"/>
                    </L7p:item>
                    <L7p:item binary="included">
                        <L7p:RightValue stringValue="true"/>
                    </L7p:item>
                </L7p:Predicates>
            </L7p:ComparisonAssertion>
            <L7p:ComparisonAssertion>
                <L7p:CaseSensitive booleanValue="false"/>
                <L7p:Expression1 stringValue="${response.http.status}"/>
                <L7p:Operator operatorNull="null"/>
                <L7p:Predicates predicates="included">
                    <L7p:item dataType="included">
                        <L7p:Type variableDataType="int"/>
                    </L7p:item>
                    <L7p:item binary="included">
                        <L7p:Operator operator="GE"/>
                        <L7p:RightValue stringValue="400"/>
                    </L7p:item>
                </L7p:Predicates>
            </L7p:ComparisonAssertion>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue=""/>
                <L7p:VariableToSet stringValue="doAudit"/>
            </L7p:SetVariable>
        </wsp:All>
        <L7p:TrueAssertion/>
    </wsp:OneOrMore>
         <L7p:AuditDetailAssertion>
 <L7p:Detail stringValue="auditOnFailure: routingStatus: ${response.http.status}"/>
         </L7p:AuditDetailAssertion>
    <L7p:SetVariable>
        <L7p:Base64Expression stringValue=""/>
        <L7p:VariableToSet stringValue="postRouteLatency"/>
    </L7p:SetVariable>
</wsp:All>

需要的输出:

L7p:Detail stringValue="${request.http.allheadervalues}"/
L7p:Detail stringValue="${secpass.blah.plaintext}"/
L7p:Enabled booleanValue="false"/
L7p:Detail stringValue="auditOnFailure: routingStatus: ${response.http.status}"/
4

0 回答 0