Created
December 17, 2020 02:46
-
-
Save trycf/00be732d93ef49b2427768e18e371527 to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Using <cfsavecontent> For demo purposes only to save a multiline string in a variable ---> | |
<cfsavecontent variable="xmlToParse"> | |
<cfoutput> | |
<?xml version="1.0" encoding="UTF-8"?><alert xmlns="urn:oasis:names:tc::cap:1.2"><identifier>_2020-12-16T17:32:5620201116173256</identifier><sender>683</sender><sent>2020-12-16T17:32:56-05:00</sent><status>Test</status><msgType>Alert</msgType><source>test of data need to parse</source><scope>Public</scope><addresses/><code>Test1.0</code><note>WENS IPAWS</note><info><language>en-US</language></info> | |
<capsig:Signature xmlns:capsig="http://www.w3.org/2000/09/xmldsig"> | |
<capsig:Info> | |
<capsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n"/> | |
<capsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-morersa-sha256"/> | |
<capsig:Referrer URI=""> | |
<capsig:Trans> | |
<capsig:Trans Algorithm="http://www.w3.org/2000/09/xmldsigenveloped-signature"/> | |
</capsig:Trans> | |
<capsig:DMethod Algorithm="http://www.w3.org/2001/04/xmlencsha256"/> | |
<capsig:DigestValue>wjL4tqltJY7m/4=</capsig:DigestValue> | |
</capsig:Referrer> | |
</capsig:Info> | |
</cfoutput> | |
</cfsavecontent> | |
<!--- Use reMatch to extract all matched patterns into an array of strings ---> | |
<cfset parsedXml = reMatch("<capsig:Info>(.*?)</capsig:Info>", xmlToParse)> | |
<!--- Dump of the original string ---> | |
<cfdump var="#xmlToParse#" label="xmlToParse"> | |
<!--- Dump of the the first array element ---> | |
<cfdump var="#parsedXml[1]#" label="parsedXml"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment