Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

Convert XML schema file to XML file

Hello there,

I have this XML Schema file and I need help to visualize how its XML file will look like.I have attached the xsd file. Specially the element called "SP", it seems to be a loop kind. Please somebody please give me how the XML file will look like. I have come up with this but I am not sure if it is correct because of that SP element which calls itself.

<?xml version="1.0" encoding="UTF-8"?>
<OD NO="" , MD="" , ED="" , SC="" , BN="" , DC="" , OC="" , LC="" , PX="">
	<TC HC="",BC=""/>

	<SP PBC=""/>

</OD>

Open in new window

Order.xsd
Avatar of ste5an
ste5an
Flag of Germany image

Looks like home work.

Some hints:
There are no commas between attributes. That is invalid XML.
All attributes are required.
At the first glance, all text attributes define a minimum length.

And for testing XML: Use XML Validator.
Hi,

The approach I use for such a request is automatic sample XML generation from schema in Oxygen XML editor

<?xml version="1.0" encoding="UTF-8"?>
<OD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="Order.xsd" NO="214748364" MD="2006-05-04" ED="2006-05-04" SC="SC11111111111111" BN="BN0" DC="DC111111111" OC="OC111111111"
     LC="214748364" PX="PX11">
    <TC HC="HC11111111111111111111111111111111111111" BC="BC1111111111111111111111111111111111111111111111"/>
    <TC HC="HC33333333333333333333333333333333333333" BC="BC3333333333333333333333333333333333333333333333"/>
    <TC HC="HC55555555555555555555555555555555555555" BC="BC5555555555555555555555555555555555555555555555"/>
    <SP PBC="PBC111111111111111111111111111111111111111111111">
        <TC HC="HC77777777777777777777777777777777777777" BC="BC7777777777777777777777777777777777777777777777"/>
        <TC HC="HC99999999999999999999999999999999999999" BC="BC9999999999999999999999999999999999999999999999"/>
        <TC HC="HC11111111111111111111111111111111111111" BC="BC1111111111111111111111111111111111111111111111"/>
    </SP>
    <SP PBC="PBC333333333333333333333333333333333333333333333">
        <TC HC="HC13333333333333333333333333333333333333" BC="BC1333333333333333333333333333333333333333333333"/>
        <TC HC="HC15555555555555555555555555555555555555" BC="BC1555555555555555555555555555555555555555555555"/>
        <TC HC="HC17777777777777777777777777777777777777" BC="BC1777777777777777777777777777777777777777777777"/>
    </SP>
    <SP PBC="PBC555555555555555555555555555555555555555555555">
        <TC HC="HC19999999999999999999999999999999999999" BC="BC1999999999999999999999999999999999999999999999"/>
        <TC HC="HC21111111111111111111111111111111111111" BC="BC2111111111111111111111111111111111111111111111"/>
        <TC HC="HC23333333333333333333333333333333333333" BC="BC2333333333333333333333333333333333333333333333"/>
    </SP>
</OD>

Open in new window

The above is just a sample with dummy values filled in

a reference for Oxygen: www.oxygenxml.com

there are quiet a few tools that give similar options
Avatar of Zolf

ASKER

Geert Bormans,

Thanks for your comments. I tried using the OxygenXml and I passed the XSD file and the xml it generated looks like this

<?xml version="1.0" encoding="UTF-8"?>
<OD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="file:/C:/Users/ZAJ/Desktop/Order.xsd" NO="214748364" MD="2006-05-04" ED="2006-05-04" SC="SC11111111111111" BN="BN0" DC="DC111111111" OC="OC111111111"
     LC="214748364" PX="PX11">
</OD>

Open in new window


But the 2 element TC and SP were not included in it. Why?? any reason!!.

By the way this SP element is confusing to me. For e.g. here i have copied that element. in there it is refereing to itself and the TC element again. I dont understand why??

<xs:element name="SP">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="TC" />
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="SP" />
			</xs:sequence>
			<xs:attribute name="PBC" type="BCString" use="required" />
		</xs:complexType>
	</xs:element>

Open in new window



Please help me to clear my confusion!!

cheers
Zulf
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zolf

ASKER

Thanks