In your NoValidation Validation Context there are the following lines..
ca.uhn.hl7v2.validation.Rule trim = new TrimLeadingWhitespace();
getPrimitiveRuleBindings().add(new RuleBinding("*", "FT", trim));
getPrimitiveRuleBindings().add(new RuleBinding("*", "ST", trim));
getPrimitiveRuleBindings().add(new RuleBinding("*", "TX", trim));
you need to create a new ValidationContext that implements
ValidationContextImpl for your projects that doesn't trim the data types you
don't want trimmed..
public class MyValidation extends ValidationContextImpl
{
public MyValidation()
{
}
}
And change your code to ..
XMLParser parseXML = new DefaultXMLParser();
parseXML.setValidationContext(
>
> new MyValidation());
> PipeParser pipeParser = new PipeParser();
> pipeParser.setValidationContext(new NoValidation());
> Message ER7Msg = parseXML.parse(XMLString);
> ER7Msg.setValidationContext(new MyValidation());
> encodedMessage = pipeParser.encode(ER7Msg );
This should fix your problem..
On Wed, May 6, 2009 at 9:43 AM, mq_cgi <[email protected]> wrote:
>
> Hi There,
>
> I am trying to convert HL7 - XML message to HL7 - ER7 format. However after
> conversion all whitespace are getting trimed off, which is part of the
> original XML message. In source code below, PipeParser.encode(ER7Msg) is
> the
> one who is triming all whitespaces. Is there a way I can still retain all
> whitespace in encodedMessage?
>
> XMLParser parseXML = new DefaultXMLParser();
> parseXML.setValidationContext(new NoValidation());
> PipeParser pipeParser = new PipeParser();
> pipeParser.setValidationContext(new NoValidation());
> Message ER7Msg = parseXML.parse(XMLString);
> ER7Msg.setValidationContext(new NoValidation());
> encodedMessage = pipeParser.encode(ER7Msg );
>
> --
> View this message in context:
> http://www.nabble.com/XML-to-ER7-conversion-using-pipeParser.encode-tp23399607p23399607.html
> Sent from the hl7api-devel mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel