cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert XML file into DTD or XSD

former_member191435
Contributor
0 Kudos

Hi Folks,

This is the output structure I need to get. My interface is file to file. Can u please let me know How do I create a data type or any XSD to get below Structure.

<?xml version="1.0" encoding="UTF-8" ?>

- <Command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Command.xsd">

- <WriteTagData readerID="EasyDP">

- <Item>

- <FieldList format="C:\Documents and Settings\wlee\Desktop\Format_4A.btw" jobName="Test1" quantity="1">

<Field name="PlantNo">4012</Field>

<Field name="PlantName">ANE</Field>

<Field name="SKU">12000001</Field>

< </FieldList>

</Item>

</WriteTagData>

</Command>

Please help me How would I create Data type for this. Your help is highly apreciated

Thanks,

Enivass

Accepted Solutions (0)

Answers (4)

Answers (4)

aashish_sinha
Active Contributor
0 Kudos

Hi,

You can use stylus studio for this purpose. Open stulys studio, go to -> XML -> Create Schema from XML Content.

It will geenerate an XSD/DTD.

Aashish Sinha

former_member463616
Contributor
0 Kudos

Hi Enivas,

Save this below code as XSLT, zip and then import as external archive. And then add this as last step in Operation mapping. Hopefully, I think it is help for you out of your issue.

<?xml version="1.0"; encoding="UTF-8"?>

<ns0:stylesheet version="1.0"; xmlns:ns0="http://www.w3.org/1999/XSL/Transform">

<ns0:output method="xml" encoding="UTF-8"/>

<ns0:template match="/">

<ns0:copy>

<ns0:apply-templates/>

</ns0:copy>

</ns0:template>

<ns0:template match="*">

<ns0:element name="{local-name()}">

<ns0:apply-templates select="@* | node()"/>

</ns0:element>

</ns0:template>

<ns0:template match="@*">

<ns0:attribute name="{local-name()}">

<ns0:value-of select="."/>

</ns0:attribute>

</ns0:template>

<ns0:template match="text() | processing-instruction() | comment()">

<ns0:copy/>

</ns0:template>

</ns0:stylesheet>

Regards,

Rajesh

former_member191435
Contributor
0 Kudos

Hi Rajesh,

I dont want ns0 in front. Please tell me how would i remove that one.

Thanks,

Enivass

former_member463616
Contributor
0 Kudos

Hi Enivas,

>>>>>>>>>Please help me how would I delete ns0.

For remove ns0, you have to do use XMLAnonymizerBean module in adpater module (In Communication channel).

Insert the XMLAnonymizerBean before the CallSapAdapter .

The module name u2018CallSapAdapteru2019 is default one that can be left as it is.

Module Name : AF_Modules/XMLAnonymizerBean

Type: Local Enterprise Bean

Module Key: 0

Add Parameters in the Module Configuration

2. Module Key: 0

Parameter Name: anonymizer.acceptNamespaces

Parameter Value: <namespace> u2018u2019

Enter a list of namespaces and their prefixes that are to be kept in the target XML document and to result a namespace without a prefix, enter u2018 u2018 (two single quotation marks). In your case like namespace http://www.w3.org/2001/XMLSchema-instance follow with two single quotation marks.

3. Module Key: 0

Parameter Name: anonymizer.quote

Parameter Value: u2018

Here specify the character to be used to enclose the attribute values. The default value is u2018.

When scenario is executed, the target message contains the namespace with no prefix.

Then, you are not facing any issue in target messages.

Regards,

Rajesh

former_member191435
Contributor
0 Kudos

Hi Rajesh,

If I am using HTTP adapter as a receiver so it is not possible right. Can u please let me know how would I handle for HTTP adapter as a target.

Actually My scenario is IDOC to HTTP. In the target Http structure I am getting this ns0. For that reason it is throwing below error

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <!-- Call Adapter

-->

- <SAP:Error SOAP:mustUnderstand="" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_CLIENT</SAP:Code>

<SAP:P1>400</SAP:P1>

<SAP:P2>ICM_HTTP_CONNECTION_FAILED</SAP:P2>

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText />

<SAP:Stack>HTTP client code 400 reason ICM_HTTP_CONNECTION_FAILED</SAP:Stack>

<SAP:Retry>A</SAP:Retry>

</SAP:Error>

Please help me on this.

Thanks,

Enivass

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi ,

this error comes when URL mentioned in HTTP adapter was not correct,

so please check URL and correct it, you dont required anythink like http: in URL.

Regards,

Raj

rajasekhar_reddy14
Active Contributor
0 Kudos

If you have any tool like XML Spy or Srylus studio , you can conver XML to XSD or DTD.

your XML looks simple only, you have to define attriubutes for field name.

Regards,

Raj

former_member191435
Contributor
0 Kudos

Hi Raj,

Can u please tell me How would I create below command in DT.

<Command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Command.xsd">

I tried with message type XML NAMESPACE SHEMA but it is getting output as

<ns0:Command xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance">

Please help me how would I delete ns0.

If possible please paste the XSD Strucutre for the above xml Structure.

Thanks,

Enivass

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Enivas,

do avoid ns0 , convert your XML in to wsdl or XSD, then use it, i dont have any xml tool.

Regards,

Raj