Results 1 to 6 of 6

Thread: XML schemas for Excel

  1. #1
    Registered User
    Join Date
    Jan 2007
    Location
    Bristol / London
    Posts
    14
    Thanks
    0
    Thanked
    0 times in 0 posts

    XML schemas for Excel

    Hi everyone,

    I was wondering if anyone knew about creating schemas for exporting excel data to XML, as I'm a bit stumped. I've created my schema, data imports great, but data won't export. I've pinned down the bug: it's all because maxoccurs != 1. However, I need to have unbounded occurences, as I could have any number of shots and scenes that I need to express in XML. Does anyone know a workaround, so that I can keep the "unbounded" aspect of my schema, but manage to export?

    Any help would be greatly appreciated! I've posted my schema below.

    Thanks,
    Gamms.

    Code:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    
    <xs:element name="PROJECT">
    	<xs:complexType>
    		<xs:sequence>
    			<xs:element name="PROJECT_SETTINGS">
    				<xs:complexType>
    					<xs:sequence>
    						<xs:element name="DEFAULT_RES" type="xs:string"/>
    						<xs:element name="FRAMERATE" type="xs:string"/>
    					</xs:sequence>
    				</xs:complexType>
    			</xs:element>
    			<xs:element name="SCENE" maxOccurs="unbounded">
    				<xs:complexType>
    					<xs:sequence>
    						<xs:element name="SHOT" maxOccurs="unbounded">
    							<xs:complexType>
    								<xs:sequence>
    									<xs:element name="ACCESSORY" type="xs:string"/>
    									<xs:element name="BACKGROUND" type="xs:string"/>
    									<xs:element name="CHARACTER" type="xs:string"/>
    									<xs:element name="DESCRIPTION" type="xs:string"/>
    									<xs:element name="DURATION" type="xs:string"/>
    								</xs:sequence>
    								<xs:attribute name="shotNo" type="xs:string" use="required"/>						
    							</xs:complexType>
    						</xs:element>
    					</xs:sequence>
    				<xs:attribute name="sceneNo" type="xs:string" use="required"/>
    				</xs:complexType>
    			</xs:element>
    		</xs:sequence>
    	</xs:complexType>
    </xs:element>
    
    </xs:schema>

  2. #2
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: XML schemas for Excel

    If the bug is due to, as you say, 'maxoccurs != 1', and you wish to have any number of occurrences (i.e. an optional element), doesn't a minoccurs=0 attribute value fix the problem? Can you give an example of data which is failing?
    To err is human. To really foul things up ... you need a computer.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Location
    Bristol / London
    Posts
    14
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: XML schemas for Excel

    Sample XML code which is failing:

    Code:
    <PROJECT>
        - <PROJECT_SETTINGS>
              <DEFAULT_RES>HD 720</DEFAULT_RES> 
              <FRAMERATE>25</FRAMERATE> 
          </PROJECT_SETTINGS>
    - <SCENE sceneNo="001">
        - <SHOT shotNo="001">
              <ACCESSORY>Accessory1</ACCESSORY> 
              <BACKGROUND>Globe1</BACKGROUND> 
              <CHARACTER /> 
              <DESCRIPTION>There is a description here.</DESCRIPTION> 
              <DURATION>60</DURATION> 
          </SHOT>
        - <SHOT shotNo="002">
              <ACCESSORY /> 
              <BACKGROUND>Globe2</BACKGROUND> 
              <CHARACTER /> 
              <DESCRIPTION /> 
              <DURATION>55</DURATION> 
          </SHOT>
        - <SHOT shotNo="003">
              <ACCESSORY /> 
              <BACKGROUND>Globe3</BACKGROUND> 
              <CHARACTER /> 
              <DESCRIPTION>Another description test</DESCRIPTION> 
              <DURATION>80</DURATION> 
          </SHOT>
        - <SHOT shotNo="004">
              <ACCESSORY /> 
              <BACKGROUND>Globe</BACKGROUND> 
              <CHARACTER>Bob</CHARACTER> 
              <DESCRIPTION /> 
              <DURATION>67</DURATION> 
          </SHOT>
       </SCENE>
    </PROJECT>
    There is only ever one occurence of the <PROJECT_SETTINGS> tag, whereas there can be as many <SCENE> and <SHOT> tabs as you want.

    I've just tried your suggestion of using minOccurs = "0" instead of setting maxOccurs, but sadly it just has the same effect as removing the maxOccurs tag

  4. #4
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: XML schemas for Excel

    Can't see anything wrong with that at all then, insofar as the XML you provided there does validate against the schema. Could be an excel problem.
    To err is human. To really foul things up ... you need a computer.

  5. #5
    Registered User
    Join Date
    Jan 2007
    Location
    Bristol / London
    Posts
    14
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: XML schemas for Excel

    Thanks for taking a look yamangman! Nice to know I'm not doing anything too crazy!

  6. #6
    Registered User
    Join Date
    Jan 2007
    Location
    Bristol / London
    Posts
    14
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: XML schemas for Excel

    Anyone else got any insight on this? Any help would be much appreciated

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. "Invalid at the top level of the document" xml and vb6
    By icanhazburger in forum Software
    Replies: 0
    Last Post: 02-05-2008, 03:56 PM
  2. How to connect an XML document with XML Schemas??
    By hegaroo in forum Help! Quick Relief From Tech Headaches
    Replies: 1
    Last Post: 10-01-2007, 06:41 PM
  3. Replies: 1
    Last Post: 21-12-2006, 03:06 AM
  4. Microsoft creates Open XML translation project
    By Steve in forum HEXUS News
    Replies: 1
    Last Post: 06-07-2006, 10:39 AM
  5. Replies: 3
    Last Post: 05-05-2005, 07:54 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •