Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

XML export fails Excel 2007 Error: A mapped elements relationship cannot be preserved

Posted on 2014-11-03
1
702 Views
Last Modified: 2014-11-05
A bit new to XML, but I get the gist. Problem is the state of NM has an XSD schema file for a bulk filing some permits, however I cannot seem to use it as a source map to create an export spreadsheet. First I got an error regarding lists of lists, but found that in the XSD there was a command call maxoccure = "unbound" that excel 2007 couldn't handle. It was on elements that we only need 1 anyway so I just hard coded a number instead of unbound.  That part of the verify for export went away, but now i still get the "a mapped element's relationship with other elements cannot be preserved" error.

Getting them to change it is probably not gonna work, so I thought someone here could ID the problem. I've attached the XSD and a sample spreadsheet. The error doesn't happen until I try to add something in the FilerInformation element.
WDTPermit-XML-2.0.xsd
Book1.xlsx
0
Comment
Question by:bhieb
1 Comment
 

Accepted Solution

by:
bhieb earned 0 total points
ID: 40424390
I figured it out sort of.  Excel didn't like the choice element on the PreparerID, either that or it was to many elements deep. I'll just massage the xml export to fit, since I have to anyway to get rid of the ns1: namespace excel is putting in. I know it is doing so because of the schema that the xsd file says too, but the receiver doesn't want it (and they are the ones that miscoded the xsd, gotta love state employees).
<xs:element name="PreparerId">
                                <xs:annotation>
                                    <xs:documentation>Submitted document must contain either PreparerFEIN, PreparerSSN, or PreparerITIN element.</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:choice>
                                        <xs:element name="PreparerFEIN">
                                            <xs:annotation>
                                                <xs:documentation>Enter the preparer FEIN. Must be 9 digits.</xs:documentation>
                                            </xs:annotation>
                                            <xs:simpleType>
                                                <xs:restriction base="xs:string">
                                                    <xs:pattern value="\d{9}" />
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
                                        <xs:element name="PreparerSSN">
                                            <xs:annotation>
                                                <xs:documentation>Enter the preparer SSN. Must be 9 digits.</xs:documentation>
                                            </xs:annotation>
                                            <xs:simpleType>
                                                <xs:restriction base="xs:string">
                                                    <xs:pattern value="\d{9}" />
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
										<xs:element name="PreparerITIN">
                                            <xs:annotation>
                                                <xs:documentation>Enter the preparer ITIN. Must be 9 digits.</xs:documentation>
                                            </xs:annotation>
                                            <xs:simpleType>
                                                <xs:restriction base="xs:string">
                                                    <xs:pattern value="9(\d{8})"  />
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
                                    </xs:choice>
                                </xs:complexType>
                            </xs:element>

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question