Xmlvalidatingreader c example

6854933580_2c8b688306_z

The example justifies that attribute 'aa' can now embody a list of integer values.Thus, the list created in the xml file can contain integers such as 10, 23 and 45.An attempt to access it from within the element zzz generates an exception, as shown above.If the attribute is made global, as is seen in the earlier examples, then it can be accessed from zzz too.The 'optional' value leaves the discretion to the user to implement the attribute with the element.On numerous occasions, the attribute is not implemented.

Unlike an element, an attribute may or may not occur.By default, the 'use' attribute has the value of 'optional'.Thus, in the above xsd file, it is redundant to assign the value of 'optional' to the 'use' attribute.Besides, if the 'value' attribute is present together with it, then the attribute that is present must have the value contained in the 'value' attribute.The attribute can be assigned a value if the 'value' attribute is not used. The type definition for the type can either be a simple type or a built-in data type.The above example does not display any error because by default, the use of the attribute is optional.

You must have an account to comment. Please register or login here!