gswafford1
Programmer
The error i'm getting when building the output XML is this:
"Parent tag ID 2 is not among the open tags. FOR XML EXPLICIT requires parent tags to be opened first. Check the ordering of the result set."
I'm looking to generated this type of output
<RootNode>
<Header>
<Footer>
</RootNode>
My Annotated XSD looks like this. Notice the header and the footer are child nodes under the RootNode.
<sql:relationship
name="HeaderReport"
parent="Table1"
parent-key="Id"
child="vwHeaderReport"
child-key="Id"
/>
<sql:relationship
name="FooterReport"
parent="Table1"
parent-key="Id"
child="vwFooterReport"
child-key="Id"
/>
<xs:element name="RootNode" sql:relationship="Table1">
<xs:complexType>
<xs:sequence>
<xs:element name="Field1" type="xs:integer" sql:field="Field1" sql:hide="true"/>
<xs:element ref="Header" minOccurs="1" maxOccurs="1" />
<xs:element ref="Footer" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Header" sql:relation="vwHeaderReport" sql:relationship="HeaderReport">
<xs:complexType>
<xs:sequence>
<xs:element ref="RunDate" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Footer" sql:relation="vwFooterReport" sql:relationship="FooterReport">
<xs:complexType>
<xs:sequence>
<xs:element ref="RunDate" />
</xs:sequence>
</xs:complexType>
</xs:element>
Could it be my views?
"Parent tag ID 2 is not among the open tags. FOR XML EXPLICIT requires parent tags to be opened first. Check the ordering of the result set."
I'm looking to generated this type of output
<RootNode>
<Header>
<Footer>
</RootNode>
My Annotated XSD looks like this. Notice the header and the footer are child nodes under the RootNode.
<sql:relationship
name="HeaderReport"
parent="Table1"
parent-key="Id"
child="vwHeaderReport"
child-key="Id"
/>
<sql:relationship
name="FooterReport"
parent="Table1"
parent-key="Id"
child="vwFooterReport"
child-key="Id"
/>
<xs:element name="RootNode" sql:relationship="Table1">
<xs:complexType>
<xs:sequence>
<xs:element name="Field1" type="xs:integer" sql:field="Field1" sql:hide="true"/>
<xs:element ref="Header" minOccurs="1" maxOccurs="1" />
<xs:element ref="Footer" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Header" sql:relation="vwHeaderReport" sql:relationship="HeaderReport">
<xs:complexType>
<xs:sequence>
<xs:element ref="RunDate" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Footer" sql:relation="vwFooterReport" sql:relationship="FooterReport">
<xs:complexType>
<xs:sequence>
<xs:element ref="RunDate" />
</xs:sequence>
</xs:complexType>
</xs:element>
Could it be my views?