XSD syntax for declaring an element that cannot have a child elementor other content

Discussion in 'XML' started by Olumide, Apr 4, 2012.

  1. Olumide

    Olumide Guest

    Would this be the proper method of declaring an XML element Foo that
    cannot have a child element or other content?

    <xs:element name="Image" type="xs:string" fixed="" nillable="true" />

    The valid uses of this element in an XML document would be:

    <Foo />

    Anything else would be invalid, e.g.:



    - Olumide

    Its just occurred to me that


    might be invalid also because of the newline character and other
    whitespace characters that appear between the <Foo> and </Foo>
    Olumide, Apr 4, 2012
    1. Advertisements

  2. Well if you put 'nillable="true"' on the element then valid markup also is
    <Foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    Martin Honnen, Apr 5, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.