Monday, April 25, 2011

Those any and anyAttibute elements?

When are the any and anyAttribute tags used in a schema?

Well let's start with the any. Ok, let's say you want to write a schema for sending messages but you want to make it flexible. You want to define the message envelope but the structure of the message payload is unknown to the system. Here's how you'd do it.



This means the message must have a Date, a Sender and any content.

Here's an example message:



The any tag can be further customised with attributes such as minOccurs and maxOccurs.


Now for that fella?


anyAttribute is very similar except it works on attributes.

For example:


Allows the following XML



References:

1. The XSD schema standard

No comments:

Post a Comment