Hi Paulo,
I'm not an expert in HL7 XML encoding syntax, but I just checked and the
latest version of the spec that I have a copy of shows HAPI's current
behaviour as being correct. It says "The message structure ID is used as a
root element for the XML instance documents."
This may have changed though, as the document I have (HL7 Version 2: XML
Encoding Syntax Release 1) is dated from June 2003. Do you (or anyone on
the list) know differently?
All of that said, it would probably be possible to implement that behaviour
you describe by subclassing DefaultXMLParser and then overriding
encodeDocument(String)<http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/parser/DefaultXMLParser.html#97>so
that it calls the super implementation and then modifies the name of
the
root element that is returned.
If by chance you do this and want to contribute it as an example for the
HAPI documentation, that would be awesome!
Cheers,
James
On Mon, Mar 19, 2012 at 11:21 AM, Paulo Ferreira
<ferreira.rob...@gmail.com>wrote:
> Hello,
>
>
>
> Hi need to convert an ASCII message to HL7 XML, i already do this with
> HAPI, but the XML proceduced is not the HL7 XML standard schema. The XML
> root starts with <ORU_R01> (for example) and not with <HL7Message>. My
> method use the HAPI library and it is written like this. Can you help me
> please?
>
>
> public InputStream transformMessageToInputStream(InputStream message)
> throws Exception {
> try {
> return new ByteArrayInputStream(new DefaultXMLParser().encode(
> new PipeParser().parse(StreamToStringUtility.getInstance()
> .convert(message, false))).getBytes("UTF-8"));
> } catch (Exception e) {
> throw MessageTransformationException.getInstance()
> .definesException(
> this.getClass().getName()
> .concat(".transformDocument()"), "", false,
> LoggingSeverity.ERROR);
> }
> }
>
> Cheers,
> Paulo Ferreira.
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel