What is best for defining extensions in the XML standard?

I am working on an XML schema that will be used to transfer data between multiple applications, not everything is under our control. The basic data will be the same for everyone, but we want to allow individual applications to store additional data in order to ensure “circular disconnection” of the files so that they can save and reload and not lose anything that is typical for this application. What is the best practice for this?

We still thought about defining a node for each main node, which will allow us to check the scheme (there are no unexpected nodes or nodes in the wrong place), which allows us to save the node under the extension.

We will probably also want to define one or more of these extended schemas as proprietary schemas.

How is this done in other standards, please? What should we accept?

+3
source share
1 answer

If the original schema was not written for extensibility, you're out of luck.

For an example of a schema written for extensibility, see the WSDL schema . Note that almost everything extends the type wsdl:documented. Note that many elements also allow extensibility:

<complexType name="serviceType">
    <complexContent>
        <extension base="wsdl:documented">
            <sequence>
                <element ref="wsdl:port" minOccurs="0" maxOccurs="unbounded"/>
                <any namespace="##other" minOccurs="0"/>
            </sequence>
            <attribute name="name" type="NCName" use="required"/>
        </extension>
    </complexContent>
</complexType>

The element anyallows you to include arbitrary XML.


By the way, everything that I know about XML Schema, I learned from XML Schema from Eric van der Vlist.

: O'Reilly Media, Inc.
: 25 2002 .
ISBN-13: 978-0-596-00252-7
: 400

. 13, .

+1

Source: https://habr.com/ru/post/1716792/


All Articles