Conversion of xml file to xsd
Hi SapAll.
i have got a requirement in an IDOC To xml File Interface where i need to create a structure for the target xml file .
here i have sample xml file ,so i just want to know if there is any other way to generate xsd from the xml file instead of creating strucure in PI.i mean is there any website to do this ?.
if i can get the xsd from the sample xml file then i can just import that xsd directly into External Definition for the target xml file structure
Hi
but when i imported the the updated xsd into External definition it raises the error as below
Unable to convert imported document to WSDL
You might have done any syntax error,make sure you insert the required field properly in the exported XSD.
If you have visual studio 2005 , in your PC then you can open the XSD using that and edit in a proper format.
Its good if you have XML SPY , you can check the syntax correctness and validate the XSD before importing.
check the syntax required by referring tohttp://www.w3schools.com/Schema/schema_simple_attributes.asp
And also make sure while importing you choose "xsd" instead of wsdl which is the default option for importing
external definition.
Regards,
Srinivas
Similar Messages
-
Create an XML file from XSD file in JDeveloper
Hi,
I am working on XML DTD and XSD to validate xml file using JDeveloper.
1. How we can create xml file from XSD in JDeveloper.
2. How to design content model very easily..
3. where can I learn XSD easily.. any URL
can anyone help out..
with regards
Abu SufianThe XML node in the new gallery has an option to create XML document from schema
See this demo:
http://www.oracle.com/technology/products/jdev/viewlets/1013/xml_viewlet_swf.html
There are several places on the Web that teaches XSD
for example: http://www.w3schools.com/schema/ -
How to convert XMl file to XSD file
how to convert XMl file to XSD file ?
i have a xml file format it has to be converted to xsd file through ABAP .
Regards
Anbu Bi got the answer....
Regards
Anbu B -
How to validate xml file with XSD schema ?? in JDK1.4.2
How to validate xml file with XSD schema ?? in JDK1.4.2
i dont want to use new Xerec Jar ...
Suggest option ...Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
Then use Stax (Woodstock) or Saxon.
- Saish -
Hi,
How to convert (.xml) XML file into (.xsd.) XML Schema.
Please help me out.
Thanks,
SubbaRao.Hi,
Actually We have to generate reports using XML Publisher.For this we gone through the documents provided by XML Publisher.As per Pusher documents we followed the steps.
Taken the Oracle Apps Report.Converted into .xml file then converted into XML Schema (.xsd) by using Stylus studio.
Now we are not able to create .rtf file.
please help us.
Thanks,
Venkat. -
How to validate an XML file with XSD Schema on JDK 1.4
Hi
I'm looking for samples how to validate xml files with xsd schema using jsdk 1.4
Thank you.This is how.
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
dbfac.setNamespaceAware(true);
SchemaFactory factory1 = SchemaFactory
.newInstance("http://www.w3.org/2001/XMLSchema");
Schema schema = factory1.newSchema(new File("person.xsd"));
dbfac.setSchema(schema);
DocumentBuilder dbparser1 = dbfac.newDocumentBuilder();
Document doc1 = dbparser1.parse(new File("person.xml"));
Validator validator1 = schema.newValidator();
DOMSource dm1 = new DOMSource(doc1);
DOMResult domresult1 = new DOMResult();
validator1.validate(dm1, domresult1); -
Binding Xml file with Xsd Schema
Hello
everybody there.
I am trying to make an application where word files are converted into xml.
For that i have used org.exolab.castor and org.apache.poi.hwpf.
Now the problem is that i was able to generate the xml file from word, but when i am binding it with XMLSchema.xsd following error is coming.
java.lang.IllegalArgumentException: getSimpleType: the simple type 'formChoice' is not a built-in type as defined in XML Schema specification.
at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1289)
at org.exolab.castor.xml.schema.Schema.addSimpleType(Schema.java:583)
at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:643)
at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:198)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:430)
at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:485)
at TempHwpf.<init>(TempHwpf.java:35)
at TempHwpf.main(TempHwpf.java:44)the code for binding my xml file with xsd schema is as under:-
SourceGenerator sourcegen = new SourceGenerator();
sourcegen.getVersion();
System.out.println(sourcegen.getVersion());
sourcegen.generateSource("XMLSchema.xsd","packagename");I have checked XMLSchema.xsd file, in that formChoice is already defined, than also error is coming.
can anyone help me out. first i thought that XMLSchema.xsd which i have is not proper, but i downloaded it again from w3c.org,
than also same error is shown.
please help me out.
waiting for reply.
milindPlease do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
Then use Stax (Woodstock) or Saxon.
- Saish -
Hello,
can anybody help me with generating an empty tagged XML file from a XSD file. Any sample java code will be highly appreciated.
Thanx in advance.
A .Apache XML Beans presents a way to compile the XSD Schema and generate Java classes for each element defined in the schema. With these interface you can then create new XML instances from the schema. (http://xmlbeans.apache.org/)
-
Creating a XML file from XSD file
Is there a piece of Java code that will convert a file to XML using a XSD without the use of generated Java classes?
Thanks alot,
AmyI tried the link in asp.net but When I double click the exe it just pops off and goes.....How to use C# application......I am using Visual web developer 2005......please help in creating XML from XSD file
-
DBMS to XML file using XSD for validarion rules
Hi All,
I am working on a migration project and my goal is to generate XML file (should also validate using XML Schema) from MySql and SQLServer database.
Idea is to write a query and then visually map result fields to XSD file (for basic field validation) and produce XML file.
Is there any example doing same using ODI???
I really don't want to export tables (500+, 3M+ records) into Oracle database and then write java or pl/sql code to generate XML file.
Any inputs highly appreciated.
Thanx,
Chirag Jha | Principal Consultant
Phone: +1 561 244 5607 | Fax: +1 815 550 7245 | Mobile: +1 561 926 3308
Oracle Oracle Communications Global Business UnitHi,
Any help on this subject?
Thanx,
Chirag -
Convert the XML file into XSD format?
Hello All,
I got XML file and i need to convert into XSD format and import it into PI system, so no need to create the structure.
Please let me know how to convert XML format into XSD format.
Regards,
chinnaHi ,
You can use Altova XML Spy software. There just open the xml file and goto Menu bar DTD/Schema there you have an option like Genrate DTD/Schema click on it and press ok, Then it will ask you for location to store xsd select Desktop or some folder.
.xsd will be created. and you can import that.
Thanks. -
Check XML file against XSD? Via XSLT?
Hello,
we´re using a 6.20 system (XI not available) and want to check XML files against a XML-schema definition file (xsd).
Is there a function in 6.20 available for this? Is it possible to use "CALL TRANSFORMATION" for it? I´ve seen other XSLT parser in the internet which are able to check a source XML against an XSD before transforming it to the result XML.
But is this possible with an 6.20 system?
Thank you for your help,
best regards,
StefanHere is the sample XML and the schema.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<book isbn="0836217462">
<title>
Being a Dog Is a Full-Time Job
</title>
<author>Charles M. Schulz</author>
<character>
<name>Snoopy</name>
<friend-of>Peppermint Patty</friend-of>
<since>1950-10-04</since>
<qualification>
extroverted beagle
</qualification>
</character>
<character>
<name>Peppermint Patty</name>
<since>1966-08-22</since>
<qualification>bold, brash and tomboyish</qualification>
</character>
</book>
XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="character" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="friend-of" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="since" type="xs:date"/>
<xs:element name="qualification" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="isbn" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
- Suman -
I have following xml file:
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\schema.xsd">
<trans>
<element>aaa</element>
<element>bbb</element>
<element>ccc</element>
</trans>
</data>
and for this file I created schema (XSD) file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="trans">
<xs:complexType>
<xs:sequence>
<xs:element ref="element" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="element">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="aaa"/>
<xs:enumeration value="bbb"/>
<xs:enumeration value="ccc"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element ref="trans"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
My XML file is compatible with this schema file.
But when I remove element <data> from my XML file, like this:
<?xml version="1.0" encoding="UTF-8"?>
<trans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\schema.xsd">
<element>aaa</element>
<element>bbb</element>
<element>ccc</element>
</trans>
then, that file is compatible with schema file as well and it is problem for me.
Element data is required in my XML file as like other elements.
How should look schema file with restriction which informs that element <data> is always required?
Is it possible to do?
regards,
JarekThat is a good question and the answer can depend upon how complex your schema is. For the simple example you gave, it could be rewritten as
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="data" type="dataType"/>
<xs:complexType name="dataType">
<xs:sequence>
<xs:element name="trans">
<xs:complexType>
<xs:sequence>
<xs:element name="element" maxOccurs="unbounded">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="aaa"/>
<xs:enumeration value="bbb"/>
<xs:enumeration value="ccc"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>This has only one element in it that can be used as a root node in the corresponding XML. If the root node of the XML is anything but data, then validation will fail.
If your schema is too large or cumbersome to redo as that, then you could perform a simple check just to see what the root node is and create an error situation when it is not the data node. Another option could be to create a second schema that has all the nodes (or maybe just the root desired node of type xs:anyType) that is used for cardinality validation. I'm not a fan of using a second schema for validation purposes but it is an option. -
Conversion of XML file from ANSI to UTF-8 encoding in SAP 4.6C
Hi All,
Im working on SAP 4.6C version.I have generated a XML file from my custom report.It is downloading in ANSI format.But i need to download this into UTF-8 format.So can anyone please let me know how to do this?
Is this possible in 4.6C version?
Thanks in Advance,
Aruna A NHello
It is possible in 4.6.
Try this code:
REPORT Z_TEST_XML_DOWN .
data:
lp_ixml type ref to if_ixml,
lp_xdoc type ref to if_ixml_document,
lp_sfac type ref to if_ixml_stream_factory,
lp_ostr type ref to if_ixml_ostream,
lp_rend type ref to if_ixml_renderer,
lp_enco type ref to if_ixml_encoding.
data:
lp_root type ref to if_ixml_element,
lp_coll type ref to if_ixml_element,
lp_elem type ref to if_ixml_element.
class cl_ixml definition load.
data:
udat like lfa1,
s type string.
select single * from lfa1 into udat where lifnr = '0000000001'. " <- set here real number
*** create xml
lp_ixml = cl_ixml=>create( ).
lp_xdoc = lp_ixml->create_document( ).
lp_root = lp_xdoc->create_simple_element( name = 'Node'
parent = lp_xdoc ).
s = udat-land1.
call method lp_root->set_attribute( name = 'country_name'
value = s ).
s = udat-name1.
call method lp_root->set_attribute( name = 'vendor_name'
value = s ).
s = udat-ort01.
call method lp_root->set_attribute( name = 'city_name'
value = s ).
*** render xml
types: begin of xml_tab_line,
line(256) type x,
end of xml_tab_line.
types: xtab type table of xml_tab_line.
data: t_xml type xtab,
size type i,
rc type i.
lp_sfac = lp_ixml->create_stream_factory( ).
lp_ostr = lp_sfac->create_ostream_itable( table = t_xml ).
lp_enco = lp_ixml->create_encoding( character_set = 'utf-8'
byte_order = if_ixml_encoding=>co_none ).
call method lp_ostr->set_encoding( encoding = lp_enco ).
lp_rend = lp_ixml->create_renderer( ostream = lp_ostr
document = lp_xdoc ).
rc = lp_rend->render( ).
*** export to file
size = lp_ostr->get_num_written_raw( ).
call function 'WS_DOWNLOAD'
exporting
bin_filesize = size
filename = 'c:\sapxml_test.xml'
filetype = 'BIN'
tables
data_tab = t_xml
exceptions
others = 1.
It is just simple example. -
Conversion of XML file in Noepad
Hi Folks,
i have a requiremnt like sending .TXT file and output is .XML.
when i open the file in internet explorer i Got right output. when open the same file in notepad the file is look like below
<?xml version="1.0" encoding="UTF-8"?>
<EDS_PII_XML><Header><FILE_DATE></FILE_DATE></Header><Employee><EMPLID>010203</EMPLID><LAST_NAME>PUBLIC</LAST_NAME><FIRST_NAME>JOHN</FIRST_NAME><Deductions><DEDUCTION_CODE>HM</DEDUCTION_CODE><RECORD_TYPE>A</RECORD_TYPE><BEGIN_DT>2009-01-01</BEGIN_DT><END_DT></END_DT><PRE_TAX_COST>33.48</PRE_TAX_COST><AFTER_TAX_COST>0.00</AFTER_TAX_COST><OPTION>KAHI</OPTION><COVERAGE_LEVEL>EF</COVERAGE_LEVEL><IMPUTED_INCOME>0.00
but i need the file like below:
<?xml version="1.0" encoding="UTF-8"?>
<EDS_PII_XML>
<Header>
<FILE_DATE></FILE_DATE>
</Header>
<Employee>
<EMPLID>010203</EMPLID>
<LAST_NAME>PUBLIC</LAST_NAME>
<FIRST_NAME>JOHN</FIRST_NAME>
<Deductions>
<DEDUCTION_CODE>HM</DEDUCTION_CODE>
<RECORD_TYPE>A</RECORD_TYPE>
<BEGIN_DT>2009-01-01</BEGIN_DT>
<END_DT/>
<PRE_TAX_COST>33.48</PRE_TAX_COST>
<AFTER_TAX_COST>0.00</AFTER_TAX_COST>
<OPTION>KAHI</OPTION>
<COVERAGE_LEVEL>EF</COVERAGE_LEVEL>
<IMPUTED_INCOME>0.00</IMPUTED_INCOME>
<GOAL_AMOUNT>0.00</GOAL_AMOUNT>
</Deductions>
<Deductions>
<DEDUCTION_CODE>HS</DEDUCTION_CODE>
<RECORD_TYPE>A</RECORD_TYPE>
<BEGIN_DT>2009-01-01</BEGIN_DT>
<END_DT/>
<PRE_TAX_COST>15.25</PRE_TAX_COST>
<AFTER_TAX_COST>0.00</AFTER_TAX_COST>
<OPTION>01</OPTION>
<COVERAGE_LEVEL>EF</COVERAGE_LEVEL>
<IMPUTED_INCOME>0.00</IMPUTED_INCOME>
<GOAL_AMOUNT>150.00</GOAL_AMOUNT>
Any conversion is there in XI?
please let me know ASAP.
points also rewarded.
Thanks
Anil MHi Anil,
You can do the conversion with XSLT. Here's the code:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="utf-8" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:transform>
(This copies the complete XML, and created a formatted output - indent="yes". All other content remains untouched.)
How to integrate in SAP, read here: http://www.heidoc.net/joomla/en/technology-science/sap-and-xslt/5-tutorial-data-exchange-between-abap-and-xml
Best wishes,
Jan
Edited by: Jan Krohn on Jul 15, 2011 10:57 AM
Maybe you are looking for
-
New for old? (BT Yahoo! Anytime Plus Vs. BT Total ...
Hi and hello, I have just joined this forum as a) I would like to raise an issue and b) encourage some debate or at least seek some views on the following. I note that many of you are enjoying the benefits of infinity and much higher throughput than
-
Direct procurement always as extended classic -- why ?
Hi , As per SAP's specification , ' SRM Server is the leading server for direct procurement. This means the system behaves according to extended classic scenario' . Is there any specific reason on why the scenario would always be extended classic for
-
I plugged in my ipod after the battery died to recharge and it suddenly told me that I had to restore it, and I have no idea why. But doing that will erase all my music alot of which is on an old computer that I no longer have. Is there any way I can
-
27" I7 iMac will not recognize thumb drive
I have a PNY 8gb Attache thumb drive that is not recognized by my 2010 27" I7 iMac. It does not show on the desktop, disk utility, finder or system profile. However, this thumb drive works on my MacBook, 2006 24" iMac and a Dell laptop running XP.
-
Quick question to Certified XI consiltants
Hi guys, What is the passing percentage for XI Certification. Thanks for quick & concise answer. Regards. santosh.