Hi
this is my sample schema.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="IDMIdentTran">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="BusNameGrp"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="BusNameGrp">
<xs:complexType>
<xs:sequence>
<xs:element ref="BusName"/>
<xs:element ref="BusNameState"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="BusName" type="xs:string"/>
<xs:element name="BusNameState" type="xs:NCName"/>
</xs:schema>
I want to populate 3 rows from a table to a xml file with 2 columns in each row.
the 2 columns are BusName and BusNameState.
I expect the output to be
<IDMIdentTran>
<BusNameGrp>
<BusName>
DUNKIN DONUTS
</BusName>
<BusNameState>
CT
</BusNameState>
</BusNameGrp>
<BusNameGrp>
<BusName>
DUNKIN DONUTS
</BusName>
<BusNameState>
NJ
</BusNameState>
</BusNameGrp>
<BusNameGrp>
<BusName>
DUNKIN DONUTS
</BusName>
<BusNameState>
CA
</BusNameState>
</BusNameGrp>
</IDMIdentTran>
But this is what i get from the XMLOutput
------------------------------------------
<IDMIdentTran>
<BusNameGrp>
<BusNameState>
CT
</BusNameState>
<BusNameState>
CT
</BusNameState>
<BusNameState>
CT
</BusNameState>
</BusNameGrp>
</IDMIdentTran>
Name>
DUNKIN DONUTS
</BusName>
<BusName>
BEE LINE AUTO & TIRE CENTER INC
</BusName>
</BusNameGrp>
</IDMIdentTran>
I dont know why the BusName element is getting screwed up. i see a "Name>" tag in the out put and dont understand the reason it is happening. i highlighted the wrong formatted area.
Any insights are appreciated.[/b]
\b{Irregular XML from XMLOutput stage}
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Just the obvious one: your schema has two element tags following the close of your complex type. What is intended by these?
Here are the last five lines of your schema:
</xs:complexType>
</xs:element>
<xs:element name="BusName" type="xs:string"/>
<xs:element name="BusNameState" type="xs:NCName"/>
</xs:schema>
In general, the opening and closing tags in your schema don't seem to match up very well.
Here are the last five lines of your schema:
</xs:complexType>
</xs:element>
<xs:element name="BusName" type="xs:string"/>
<xs:element name="BusNameState" type="xs:NCName"/>
</xs:schema>
In general, the opening and closing tags in your schema don't seem to match up very well.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Suggest you get yourself over to ADN (sign up if you haven't) and download the XML Pack Best Practices document from there. If is extremely helpful in general for dealing with XML in DataStage and includes a specific section on handling multiple repeating elements.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers