[xsd-users] Custom namespace_infomap binding

Boris Kolpackov boris at codesynthesis.com
Tue Oct 30 11:05:42 EDT 2007


Hi Michael,

Forstner Michael <Michael.Forstner at cpg.de> writes:

> Today I get this output:
>
> <SCLSCT:BBkICFBlkCdtTrf xmlns:SCLSCT="urn:BBkICF:xsd:$BBkICFBlkCdtTrf"
> xmlns:sw8="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:BBkICF:xsd:$BBkICFBlkCdtTrf BBkICFBlkCdtTrf.xsd">
>   <SCLSCT:SndgInst>SCRUDE51AXX</SCLSCT:SndgInst>
>   <SCLSCT:pacs.008.001.01>
>     <sw8:GrpHdr>
>       <sw8:MsgId>CPG-2007-09-20.22</sw8:MsgId>
>       <sw8:CreDtTm>2007-09-20T16:20:07</sw8:CreDtTm>
>       ...
>
> But I'd like to have following syntax:
>
> <SCLSCT:BBkICFBlkCdtTrf xmlns:SCLSCT="urn:BBkICF:xsd:$BBkICFBlkCdtTrf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:BBkICF:xsd:$BBkICFBlkCdtTrf BBkICFBlkCdtTrf.xsd">
>   <SCLSCT:SndgInst>SCRUDE51AXX</SCLSCT:SndgInst>
>   <SCLSCT:pacs.008.001.01 xmlns="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01">   <!-- NAMESPACE is declared here -->
>     <GrpHdr>                                                                            <!-- No Prefix needed for sub-tags -->
>       <MsgId>CPG-2007-09-20.22</MsgId>
>       <CreDtTm>2007-09-20T16:20:07</CreDtTm>
>       ...

There is no easy way to do exactly what you want short of serializing the
outer document and the GrpHdr fragment separately into two DOM documents
and then combining them into one.

But, noticing that all tags in the SCLSCT vocabulary seem to be qualified,
you can get the following:

<SCLSCT:BBkICFBlkCdtTrf
  xmlns:SCLSCT="urn:BBkICF:xsd:$BBkICFBlkCdtTrf"
  xmlns="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="urn:BBkICF:xsd:$BBkICFBlkCdtTrf BBkICFBlkCdtTrf.xsd">
  <SCLSCT:SndgInst>SCRUDE51AXX</SCLSCT:SndgInst>
  <SCLSCT:pacs.008.001.01>
    <GrpHdr>
      <MsgId>CPG-2007-09-20.22</MsgId>
      <CreDtTm>2007-09-20T16:20:07</CreDtTm>
      ...

By replacing:

map["sw8"]="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01";

with:

map[""]="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01";


Boris




More information about the xsd-users mailing list