Hi all,

I have an XML schema which I use to validate inbound and outbound edi files. One of the top level elements is ID. This is the primary-key or the table and is only required on outbound messages. How would I correctly annontate this with my schema? Do i specify it's a readonly or just mark it as minoccurs=0?

many thanks

Well there's no concept of read only in XML Schema. It's either a required element/attribute or an optional element/attribute.

If it's required in one message, but optional in another, sounds like you need to make it optional. (minoccurs = 0). However if this is something that you MUST check in your outbound messages, you might consider having a schema for each message type. This way you can have different requirements for each.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.