dfdl:textPadKind determines how padding is added during unparsing.

dfdl:textTrimKind determines how padding is removed during parsing.

So you need textTrimKind. Adding dfdl:textTrimKind="padChar" to the name
element should get you the behavior you're looking for.

- Steve

On 5/15/20 7:32 AM, Costello, Roger L. wrote:
> Hi Folks,
> 
> My input contains a person's name. The name is padded on the left and right 
> with the forward slash ( / ) symbol, e.g.
> 
> ///John///
> 
> I used textPadKind="padChar" and textStringPadCharacter="/" to direct 
> Daffodil to remove the forward slashes:
> 
> <xs:element name="SimpleDataFormat">
>     <xs:complexType>
>         <xs:sequence>
>             <xs:element name="name" type="xs:string" 
>                 dfdl:textPadKind="padChar"
>                 dfdl:textStringPadCharacter="/"
>             />
>         </xs:sequence>
>     </xs:complexType>
> </xs:element>
> 
> Unfortunately, no slashes are removed:
> 
> <SimpleDataFormat>
>   <name>///John///</name>
> </SimpleDataFormat>
> 
> Below is my complete schema. What am I doing wrong, please?  /Roger
> 
> <?xml version="1.0" encoding="UTF-8"?> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
>     xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
>     xmlns:fn="http://www.w3.org/2005/xpath-functions";
>     elementFormDefault="qualified">
>     
>     <xs:annotation>
>         <xs:appinfo source="http://www.ogf.org/dfdl/";>
>             <dfdl:format
>                 textBidi="no"
>                 separatorSuppressionPolicy="never"
>                 floating="no"
>                 encodingErrorPolicy="replace"
>                 outputNewLine="%CR;%LF;"
>                 leadingSkip="0" 
>                 trailingSkip="0"
>                 alignment="1" 
>                 alignmentUnits="bytes"
>                 textPadKind="none"
>                 textTrimKind="none" 
>                 truncateSpecifiedLengthString="no"
>                 escapeSchemeRef=""
>                 
>                 representation="text"
>                 encoding="ASCII"
>                 lengthKind = "delimited"
>                 initiator = ""
>                 terminator = ""
>                 separator = ""
>                 ignoreCase = "yes"
>                 sequenceKind="ordered"
>                 initiatedContent="no"
>                 lengthUnits="characters"
>                 textStringJustification="center"
>                 
>             />
>         </xs:appinfo>
>     </xs:annotation>
>     
>     <xs:element name="SimpleDataFormat">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="name" type="xs:string" 
>                     dfdl:textPadKind="padChar"
>                     dfdl:textStringPadCharacter="/"
>                 />
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
>     
> </xs:schema>
> 

Reply via email to