XML Schema any wildcard from Class Diagram

Hi all,

I’m trying to generate an xml complex type that should include an any wildcard.

<complexType name="BodyType">
    <sequence>
        <any minOccurs="0" namespace="##any" processContents="lax"/>
    </sequence>
</complexType>

Body

I have looked at attributes, attribute stereotypes, class stereotypes, relationship stereotypes, but so far I have not been able to get this working.

Does anyone know how this can be done in VP?

Thanks in advance.

You can use <<XSDelement>> and tagged values to generate it

Screenshot1

Hi Roykeung,

Thanks for your help.

I have created the body as you suggested, but when I generate the xml schema, it creates an element, which makes sence since this is the stereotype I gave it.
When I include the body into another complexType, it is trying to use refType, which throws an error in the xml schema.

What I am looking for is a Body complexType which can be used in other complexTypes .

This is the class diagram I created:

Screenshot%20from%202018-04-26%2011-13-40

And this is the xml schema that is generated:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema
        targetNamespace="http://brabantia.com/XMLSchemas/CDM/Body"
        xmlns="http://brabantia.com/XMLSchemas/CDM/Body"
        xmlns:body="http://brabantia.com/XMLSchemas/CDM/Body"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="BodyContainer">
        <xs:all>
            <xs:element reftype="body:Body" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <xs:element name="Body">
        <xs:sequence>
            <xs:any processContents="lax" namespace="##any" minOccurs="0"/>
        </xs:sequence>
    </xs:element>
</xs:schema>

While this is the xml schema I would like to have:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema
        targetNamespace="http://brabantia.com/XMLSchemas/CDM/Body"
        xmlns="http://brabantia.com/XMLSchemas/CDM/Body"
        xmlns:body="http://brabantia.com/XMLSchemas/CDM/Body"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="BodyContainer">
        <xs:sequence>
            <xs:element name="body" type="Body" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Body">
        <xs:sequence>
            <xs:any processContents="lax" namespace="##any" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

Our engineers will enhance to support it and I’ll keep you post once there are any feedback.
Feel free to contact me for any help and wish you have a good day!

I would like to let you know Instant Generator XML Schema is supported wildcard generation.
Please update the software to latest build to get the enhancement.

Your expected result can be generated from below class diagram.
Screenshot

Thank you very much for using Visual Paradigm.