This extension helps create XSD for partial copy of one or several different XMLs. It is used for ISO 20022 financial messages. Suppose that a message payload consists of AppHdr and Document tags. For example, pacs.009.001.08 payload will look like the following:
<RequestPayload>
<AppHdr> ... </AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.08">
<FICdtTrf>
<GrpHdr>
<MsgId>some id</MsgId>
<CreDtTm>2025-01-01T01:30:00-05:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<SttlmInf>
<SttlmMtd>INGA</SttlmMtd>
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>00000000000001</InstrId>
<EndToEndId>pacs009-jan-01</EndToEndId>
<UETR>10f036e6-5665-4aba-8ca6-940d72b846d7</UETR>
</PmtId>
<IntrBkSttlmAmt Ccy="USD">1000000</IntrBkSttlmAmt>
<IntrBkSttlmDt>2025-01-02</IntrBkSttlmDt>
</CdtTrfTxInf>
</FICdtTrf>
</Document>
</RequestPayload>
Now let's assume that the partial copy should contain only the following fields, as defined by their pseudo-xpaths:
* AppHdr
* Document/FICdtTrf/CdtTrfTxInf/PmtId/UETR
Such setup would result in a typical Swift partial copy service generating message that looks like this:
```xml
<Document xmlns="urn:swift:xsd:xcop.001.001.02">
<PmtPrtlCpyNtfctn>
<AppHdr>...</AppHdr>
<FICdtTrf>
<CdtTrfTxInf>
<PmtId>
<UETR>10f036e6-5665-4aba-8ca6-940d72b846d7</UETR>
</PmtId>
</CdtTrfTxInf>
</FICdtTrf>
</PmtPrtlCpyNtfctn>
</Document>
The problem is to generate XSD for this partial copy, as this is not a part of ISO 20022 standard.
## How to use
Open a folder with the source XSD files. You will need XSDs for all message types that are used in the partial copy, as well as XSD for the AppHdr (for example, head.001.001.02). You will also need a file that lists xpaths for the partial copy. When the extension is activated, it will ask for the target namespace declaration. After that, the user will need to select all source XSD files, and one plain text file with xpaths. All lines that are not valid pseudo-xpaths will be ignored.
The extension will extract all parts of XSD (including types and constraints) that may appear in the partial copy, and will combine all of them into a single XSD. It will be saved into the current workspace folder.
## Extension Settings
This extension contributes the following settings:
* `iso-partial-copy.enable`: Enable/disable this extension.
* `iso-partial-copy.debug`: Set to save intermediate results and not delete unused nodes (useful for error debugging)
* `iso-partial-copy.partial-copy-tag`: The root tag (under the Document) that is added to the partial copy (default value: PmtPrtlCpyNtfctn)
## Known Issues
Some of the settings are not effective.
## Release Notes
### 0.1.0
* Support for <xs:entension>
### 0.0.3
* Fixed order of partial copy elements, and support for mutually exclusive elements
* Fixed error when using a file with no valid xpaths
* Fixed issue when some tools (for example, XMLSpy) were blaming the schema was invalid
### 0.0.2
Fixed bug when installing the extension on Windows
### 0.0.1
First fully functional release.
---