M
Mausam
Hello,
I have a Map (it can be nested map, containing of maps) and a schema. Keys in Map represent element/attribute name of the schema and an entry in Map will be at same depth as an element defined in schema
I need help in generating xml from the map as per the schema provided, without generating new files (as e.g Jaxb would require) Sample schema/map provided below
e.g Map = [dept=[deptno="10",dname="ABC",loc="XYZ",emps=[[empno=1000,ename="Albert"],[empno=2000,ename="John"]]]] and schema will be
e.g Schema
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:element name="depts">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="dept" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="deptno" type="xsd:string"/><!-- This simple element e.g can be attribute in some schema-->
<xsd:element name="dname" type="xsd:string"/>
<xsd:element name="emps" maxOccurs="unbounded" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="empno" type="xsd:string"/>
<xsd:element name="ename" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
-Many thanks
I have a Map (it can be nested map, containing of maps) and a schema. Keys in Map represent element/attribute name of the schema and an entry in Map will be at same depth as an element defined in schema
I need help in generating xml from the map as per the schema provided, without generating new files (as e.g Jaxb would require) Sample schema/map provided below
e.g Map = [dept=[deptno="10",dname="ABC",loc="XYZ",emps=[[empno=1000,ename="Albert"],[empno=2000,ename="John"]]]] and schema will be
e.g Schema
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:element name="depts">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="dept" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="deptno" type="xsd:string"/><!-- This simple element e.g can be attribute in some schema-->
<xsd:element name="dname" type="xsd:string"/>
<xsd:element name="emps" maxOccurs="unbounded" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="empno" type="xsd:string"/>
<xsd:element name="ename" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
-Many thanks