Help required converting XSD to XML file in PERL


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help required converting XSD to XML file in PERL
# 1  
Old 03-02-2011
Help required converting XSD to XML file in PERL

Hi,

Please find below the xsd.

Code:
 
       <?xml version="1.0" encoding="ISO-8859-1" ?>
   
       <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
       
	<xs:element name="fruitorder">
   
       <xs:complexType>
   
       <xs:sequence>

      <xs:element name="orderperson" type="xs:string" />
 
      <xs:element name="shipto">
 
       <xs:complexType>
 
       <xs:sequence>
 
      <xs:element name="name" type="xs:string" />

      <xs:element name="address" type="xs:string" />

      <xs:element name="city" type="xs:string" />

      <xs:element name="country" type="xs:string" />

      </xs:sequence>
  
      </xs:complexType>
  
      </xs:element>

       <xs:element name="item" maxOccurs="unbounded">
  
       <xs:complexType>

       <xs:sequence>
 
      <xs:element name="title" type="xs:string" />
  
      <xs:element name="note" type="xs:string" minOccurs="0" />
  
      <xs:element name="quantity" type="xs:positiveInteger" />

      <xs:element name="price" type="xs:decimal" />

      </xs:sequence>
  
      </xs:complexType>
  
      </xs:element>
  
      </xs:sequence>
 
      <xs:attribute name="orderid" type="xs:string" use="required" />
  
      </xs:complexType>
  
      </xs:element>
  
      </xs:schema>

I want to convert the given XSD to XML file using perl?

How can i create an XML tree in perl?

Any idea?

Regards
Vanitha
# 2  
Old 03-02-2011
This file is metadata - it tells you how to take separate data and build a separate XML file from the data. It is called an XML schema. So it is alread "in XML" in that sense.

Otherwise I do not get what you are asking.
# 3  
Old 03-02-2011
A number of tools such as XMLspy, Oxygen XML editor, etc. can generate a sample XML file from an XML Schema definition. Generally such tools only generate the XML file if it is possible to generate it without ambiguity. Often used to create skeleton XML documents where the user has to fill in the values. For more information see http://xml-xig.sourceforge.net/

I do not think there are any Perl modules that will do the transformation for you.

Last edited by fpmurphy; 03-02-2011 at 03:18 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help required in converting a file format

My file format: -------------------------------------------------- Complete Consistency Check Valid Area : VALID:VALID Started by : esanwad Started at : Thu Dec 11 16:04:46 2014 CNA version : R21H04_EC08 Check range : AREA VALID/VALID ... (4 Replies)
Discussion started by: Gautam Banerjee
4 Replies

2. Shell Programming and Scripting

Validating XML file using XSD in UNIX

Hi, I have a xml file and a xsd file(xml schema file). Here using unix script i wanted to validate the xml file by referring to xsd file. The validation is in terms of Datatype,Field length and null values. If the data present in the xml file is not matching in terms of datatype,field length... (3 Replies)
Discussion started by: shree11
3 Replies

3. Shell Programming and Scripting

Help required in Splitting a xml file into multiple and appending it in another .xml file

HI All, I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz. eg: <?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies

4. Shell Programming and Scripting

Validate xml agaist xsd is ksh

how do i validate xml agaist xsd is ksh? (1 Reply)
Discussion started by: LiorAmitai
1 Replies

5. Shell Programming and Scripting

Help required in Building an XML using SAX Parser in perl

I want to use sax parser for my application as i have 5 Lakhs of data. I have the xml file like this <Nodes> <Node> <NodeName>Company</NodeName> <File>employee_details.csv</File> <data>employee_data.txt</data> <Node> <NodeName>dummy</NodeName> ... (8 Replies)
Discussion started by: vanitham
8 Replies

6. Shell Programming and Scripting

Validating XML against XSD

Hi Frnds I want to validate an xml file against its xsd using KSH. But dont have any idea on how to proceed:confused:.. Please help me with your ideas.. Thanks in advance.... (3 Replies)
Discussion started by: balesh
3 Replies

7. UNIX for Dummies Questions & Answers

XML / XSD: what is a good format for amounts?

Suppose I have a XSD definition of amount: <xs:element name="Amount" type="amount> And the amounts themselves are given in the following format in the XML: <amount>1.000.00</amount> In other words, the thousand separator and the decimal point are the same. Does this require that the parser... (3 Replies)
Discussion started by: figaro
3 Replies

8. Shell Programming and Scripting

XMLLINT COMMAND IN UNIX TO VALIDATE XML AGAINST XSD

Hi i am baby to unix shell script. how do i validate xml agaist xsd and transforms xml using xslt. Thanks Mohan (2 Replies)
Discussion started by: mohan.cheepu
2 Replies

9. Shell Programming and Scripting

Converting a flat file in XML

Hello Friends, I am new to UNIX shell scripting. Using bash....Could you please help me in converting a flat file into an XML style output file. Flat file: (Input File entries looks like this) John Miller: 617-569-7996:15 Bunting lane, staten Island, NY: 10/21/79: 60600 The... (4 Replies)
Discussion started by: humkhn
4 Replies

10. UNIX for Advanced & Expert Users

Generating XML from XSD

Hi all, Am looking for a way to generate XML based on XSDs so that the final XML need not be validated against the XSDs again. Here is the part of the XSD <xsd:element name="first_element"> <xsd:complexType> <xsd:sequence> <xsd:element name="val"/> </xsd:sequence> ... (0 Replies)
Discussion started by: matrixmadhan
0 Replies
Login or Register to Ask a Question