EDN Admin
Well-known member
<p style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri We have a requirement to transform the application specific XML data to a target XSD format specified by government agency. The government agency specifies the pattern
using regular expression. Please see below for the sample
<p style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri
<span style="font-size:small <span style="font-family:Calibri
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; <! -- Date Type in the format of YYYY-MM-DD -->
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; DateType<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; annotation<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; documentation<span style="color:Blue; >Base type for a date<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; documentation<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; annotation<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:date<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; pattern <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; [1-9][0-9]{3}-.*<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
[/code]
<span style="font-family:Calibri <font face="Calibri" style="font-family:Calibri
<p style="margin:0in 0in 10pt
</font>
<p style="margin:0in 0in 10pt
<p style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri We are building a custom .NET mapping and transformation solution to support application specific needs. The requirement is to use the regular expression specified
in the target XSD to transform the source XML data to meet the pattern required by the target. For example, if the source date is of format mm-dd-yyyy, the program should convert the same to YYYY-MM-DD using the regular expression (1-9][0-9]{3}-.*")
<p style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri Likewise there are several RegEx pattern we should leverage based on the data type. Here are our questions:
<ol type="1" style="
<li style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri Is it a general practice to use RegEx for data transformation rather data validation?
<li style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri If yes, how would be approach this. Is there an established pattern or technique on how to leverage RegEx for data transformation
</ol>
View the full article
using regular expression. Please see below for the sample
<p style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri
<span style="font-size:small <span style="font-family:Calibri
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; <! -- Date Type in the format of YYYY-MM-DD -->
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; DateType<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; annotation<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; documentation<span style="color:Blue; >Base type for a date<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; documentation<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; annotation<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:date<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; pattern <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; [1-9][0-9]{3}-.*<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
[/code]
<span style="font-family:Calibri <font face="Calibri" style="font-family:Calibri
<p style="margin:0in 0in 10pt
</font>
<p style="margin:0in 0in 10pt
<p style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri We are building a custom .NET mapping and transformation solution to support application specific needs. The requirement is to use the regular expression specified
in the target XSD to transform the source XML data to meet the pattern required by the target. For example, if the source date is of format mm-dd-yyyy, the program should convert the same to YYYY-MM-DD using the regular expression (1-9][0-9]{3}-.*")
<p style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri Likewise there are several RegEx pattern we should leverage based on the data type. Here are our questions:
<ol type="1" style="
<li style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri Is it a general practice to use RegEx for data transformation rather data validation?
<li style="margin:0in 0in 10pt <span style="font-size:small <span style="font-family:Calibri If yes, how would be approach this. Is there an established pattern or technique on how to leverage RegEx for data transformation
</ol>
View the full article