If you want pqr and lmn to be treated as two different names and abc+xyz as a single name, then, where is the problem!!.
You can parse your xml file using SAX/DOM. Anything that you encounter b/w elements <name> and </name> events in SAX can be marked as a single name. Alternatively, if you are using DOM, all the childs of Node "Name" represent a single name. These childs may have both LastName, Firstname or just one or none. Cheers, Rahul. > From: "abhishekhp" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > > Hi, > Suppose i have the following in an XSD > <xsd:complexType name="Name" minOccurs="0" maxOccurs = "3"> > <xsd:sequence> > <xsd:element name="FirstName" type="xsd:string" > minOccurs="0" maxOccurs="1"> > <xsd:element name="LastName" type="xsd:string" > minOccurs="0" maxOccurs="1"> > </xsd:sequence> > </xsd:complexType> > > i.e Name itself is optional, so are the subelements within it. > > I need to have name-value pairs for FirstName and LastName within the > same Name tag. > i.e. if > <Name> > <FirstName>abc</FirstName> > <LastName>xyz</LastName> > </Name> > <Name> > <FirstName>pqr</FirstName> > </Name> > <Name> > <LastName>lmn</LastName> > </Name> > > I have the Document type object with me. I want 'abc and 'xyz' to be > together (say, stored in one java object) because they occur in the same > <Name> tag, but 'pqr' and 'lmn' should be separate from each other (in > different objects) because they occur in different <Name> tags. > > Any pointers, how this can be done? > > TIA, > abhishek. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
