Solved

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

Posted on 2014-11-03
1
673 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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 will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

776 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