cancel
Showing results for 
Search instead for 
Did you mean: 

XML to XSD

Former Member
0 Kudos

I am trying to create an XSD for the following XML. I am using Altova XML Spy ( DTD Schema ---> Generate DTD Scehma --> W3Schema clicking the OK button) , but the XSD is not Created.

Could someone tell me whats wrong with this XML and if possible could you please create the XSD. Appreicated.

XML

-


<?xml version="1.0" encoding="UTF8"?>

<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">

<cXML timestamp="20060923T08:29:0507:00" payloadID="11590253453005461869432431655503@216.109.111.146" version="1.2.014">

<Response>

<Status code="200" text="OK" />

<GetPendingResponse>

<cXML timestamp="20060923T08:29:0507:00" payloadID="11590253452928821033595155818046@216.109.111.146" version="1.2.014">

<Header>

<From>

<Credential domain="NetworkID">

<Identity>AN01000000001</Identity>

</Credential>

</From>

<To>

<Credential domain="NetworkID">

<Identity>AN01000682640T</Identity>

</Credential>

</To>

<Sender>

<Credential domain="NetworkID">

<Identity>AN01000000001</Identity>

<SharedSecret>testing123</SharedSecret>

</Credential>

<UserAgent>ANCXMLDispatcher</UserAgent>

</Sender>

</Header>

<Message deploymentMode="production">

<DataAvailableMessage>

<InternalID domain="PendingMessages">808801</InternalID>

</DataAvailableMessage>

</Message>

</cXML>

</GetPendingResponse>

</Response>

</cXML>

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member206604
Active Contributor
0 Kudos

Hi,

Try removing this from your XML

<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">

Thanks,

Prakash

Former Member
0 Kudos

Thanks Prakash, I tried that earlier and now also no Use

former_member206604
Active Contributor
0 Kudos

Hi Mohini,

I don't have a Altova so I cannot try generating.

But a last try check this I beleiver this hould be the problem

<?xml version="1.0" encoding="UTF8"?>

it should be

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

Thanks,

Prakash

Former Member
0 Kudos

Thanks Prakash. It doesn't work, but its a Great Catch. Appreciate that.

former_member206604
Active Contributor
0 Kudos

Hi Mohini,

Why don't you download the DTD from this URL which is in the second line of the XML and use it.

http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd

May be you will more extra Tags but thats the real DTD and will be full proof.

If you are confortable with XSD you can also convert that DTD into XSD and use it.

I think there is a option in Altova in the same menu called Convert DTD/Schema.

Try that and let me know..

Thanks,

Prakash

Former Member
0 Kudos

Thanks Prakash. The link you have provided Doesn't work. Thanks for all your effort on my behalf and your support. Sorry but I am facing strange problems still. Let me try to explain that in the next thread.

In the mean time I downloaded another tool from the following Link

http://www.freexmleditor.com/fxeeditor/downloads.html?x=94&y=15

Using the above tool I found out that my first and second lines were having problems. First line was having spaces on its left and the second line was not having the Proper schema. Now look the correct version

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

<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">

<cXML timestamp="20060923T09:47:3607:00" payloadID="11590300564895053121846796114411@216.109.111.25" version="1.2.014">

<Response>

<Status code="200" text="OK" />

<GetPendingResponse>

<cXML timestamp="20060923T09:47:3607:00" payloadID="11590300564789200862359817354338@216.109.111.25" version="1.2.014">

<Header>

<From>

<Credential domain="NetworkID">

<Identity>AN01000000001</Identity>

</Credential>

</From>

<To>

<Credential domain="NetworkID">

<Identity>AN01000682640T</Identity>

</Credential>

</To>

<Sender>

<Credential domain="NetworkID">

<Identity>AN01000000001</Identity>

<SharedSecret>athletics123</SharedSecret>

</Credential>

<UserAgent>ANCXMLDispatcher</UserAgent>

</Sender>

</Header>

<Message deploymentMode="production">

<DataAvailableMessage>

<InternalID domain="PendingMessages">808872</InternalID>

</DataAvailableMessage>

</Message>

</cXML>

</GetPendingResponse>

</Response>

</cXML>

former_member206604
Active Contributor
0 Kudos

Hi Mohini,

Just right click and save target as and save as cXML.dtd.

http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd

I am able to download and this is actual Schema for the cXML and can be used for ay cXML structure. It has the whole structure with Request, Response, etc... While mapping you can use Respose alone here.

If some scenarios if your using Request you can also you the same DTD. There is no need to generate a Schema everytime.

Thanks,

Prakash

former_member206604
Active Contributor
0 Kudos

Hi Mohini,

You can find the whole set of cXML 1.2.014 in this link

http://xml.cxml.org/current/cXML.zip

You can find the cXML.dtd and also you can see a sample GetPendingResponse.xml in that .zip

Also if you try to generate a XSD from the XML that you posted Altova will not able able to generate a proper XSD. Because there are 2 cXML tags and it will add as reference so with out a proper XSD or DTD its not advisable to generate a XSD from this kinf of XML.

Thanks,

Prakash

Former Member
0 Kudos

Prakash Please advise me on the following. I need to get XSD for the following? (cXML)

GetPendingRequest

GetPendingResponse

DataRequest

DataResponse

From where I can get them? Which one will be appropriate? I believe this is what caused the problem altogether last few days.

I appreciate your patience.

former_member206604
Active Contributor
0 Kudos

Hi Mohini,

Its always good to go with the provided cXML.dtd. You can also import .dtd as External Definition. If you are comfortable with XSD then convert it into XSD either using Altova or with the editor for which you posted the link. (Thanks for that link)

Here is the XSD for GetPendingResponse

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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

<xs:element name="Changetime">

<xs:simpleType>

<xs:restriction base="xs:dateTime">

<xs:enumeration value="1999-03-12T18:39:09-08:00"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="Credential">

<xs:complexType>

<xs:sequence>

<xs:element ref="Identity"/>

<xs:element ref="SharedSecret" minOccurs="0"/>

</xs:sequence>

<xs:attribute name="domain" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="AribaNetworkUserId"/>

<xs:enumeration value="DUNS"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="Format">

<xs:complexType mixed="true">

<xs:attribute name="version" use="required">

<xs:simpleType>

<xs:restriction base="xs:decimal">

<xs:enumeration value="2.1"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="From">

<xs:complexType>

<xs:sequence>

<xs:element ref="Credential"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="GetPendingResponse">

<xs:complexType>

<xs:sequence>

<xs:element name="cXML">

<xs:complexType>

<xs:sequence>

<xs:element ref="Header"/>

<xs:element ref="Message"/>

</xs:sequence>

<xs:attribute name="payloadID" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="456778-200@cxml.workchairs.com"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="lang" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="en-US"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="timestamp" use="required">

<xs:simpleType>

<xs:restriction base="xs:dateTime">

<xs:enumeration value="1999-03-12T18:39:09-08:00"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Header">

<xs:complexType>

<xs:sequence>

<xs:element ref="From"/>

<xs:element ref="To"/>

<xs:element ref="Sender"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Identity">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="942888711"/>

<xs:enumeration value="admin@acme.com"/>

<xs:enumeration value="admin@ariba.com"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="InternalID">

<xs:simpleType>

<xs:restriction base="xs:short">

<xs:enumeration value="1234"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="Message">

<xs:complexType>

<xs:sequence>

<xs:element ref="SubscriptionChangeMessage"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Name">

<xs:complexType mixed="true">

<xs:attribute name="lang" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="en-US"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="Response">

<xs:complexType>

<xs:sequence>

<xs:element ref="Status"/>

<xs:element ref="GetPendingResponse"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Sender">

<xs:complexType>

<xs:sequence>

<xs:element ref="Credential"/>

<xs:element ref="UserAgent"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="SharedSecret">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="coyote"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="Status">

<xs:complexType>

<xs:attribute name="code" use="required">

<xs:simpleType>

<xs:restriction base="xs:short">

<xs:enumeration value="200"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="text" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="OK"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="Subscription">

<xs:complexType>

<xs:sequence>

<xs:element ref="InternalID"/>

<xs:element ref="Name"/>

<xs:element ref="Changetime"/>

<xs:element ref="SupplierID"/>

<xs:element ref="Format"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="SubscriptionChangeMessage">

<xs:complexType>

<xs:sequence>

<xs:element ref="Subscription"/>

</xs:sequence>

<xs:attribute name="type" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="new"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="SupplierID">

<xs:complexType mixed="true">

<xs:attribute name="domain" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="DUNS"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="To">

<xs:complexType>

<xs:sequence>

<xs:element ref="Credential"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="UserAgent">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="Ariba.com Network V1.0"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="cXML">

<xs:complexType>

<xs:sequence>

<xs:element ref="Response"/>

</xs:sequence>

<xs:attribute name="payloadID" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="123498-200@ariba.com"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="lang" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="en-US"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="timestamp" use="required">

<xs:simpleType>

<xs:restriction base="xs:dateTime">

<xs:enumeration value="1999-03-12T18:39:09-08:00"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

</xs:schema>

Thanks,

Prakash

Former Member
0 Kudos

Thanks Prakash.

Whats the difference between an XSD and DTD?

The Main Issue what I am facing is when I get the Response(First) back from the Vendor the following line gets modifed

FROM

-


<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">

TO

---

<!Doctype .......refer the...)

So when I try to map the Response back to my Second HTTP Request, it is messing up so badly.

Have you used the following XML to get the above XSD

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

<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">

<cXML timestamp="2005-01-12T16:00:18-08:00" payloadID="1105574420906--451266344000288275@10.10.13.125">

<Response>

<Status code="200" text="OK"/>

<GetPendingResponse>

<cXML timestamp="2005-01-12T16:00:18-08:00"

payloadID="1105574420141-977399960268715709@10.10.13.125">

<Header>

<From>

<Credential domain="NetworkId">

<Identity>AN01000000001</Identity>

</Credential>

</From>

<To>

<Credential domain="NetworkId">

<Identity>AN13000000259</Identity>

</Credential>

</To>

<Sender>

<Credential domain="NetworkId">

<Identity>AN01000000001</Identity>

</Credential> <UserAgent>ANCXMLDispatcher</UserAgent>

</Sender>

</Header>

<Message>

<DataAvailableMessage>

<InternalID domain="PendingMessages">3738</InternalID>

</DataAvailableMessage>

</Message>

</cXML>

</GetPendingResponse>

</Response>

</cXML>

former_member206604
Active Contributor
0 Kudos

Hi Mohini,

I generated that XSD from the standard GetPendingResponse.xml which was available in www.cXML.org

XSD and DTD are two different ways of representing a XML Schema.

The following is the XSD from the XML that you posted above. I think the standard one should be fine.

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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

<xs:element name="Credential">

<xs:complexType>

<xs:sequence>

<xs:element ref="Identity"/>

</xs:sequence>

<xs:attribute name="domain" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="NetworkId"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="DataAvailableMessage">

<xs:complexType>

<xs:sequence>

<xs:element ref="InternalID"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="From">

<xs:complexType>

<xs:sequence>

<xs:element ref="Credential"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="GetPendingResponse">

<xs:complexType>

<xs:sequence>

<xs:element name="cXML">

<xs:complexType>

<xs:sequence>

<xs:element ref="Header"/>

<xs:element ref="Message"/>

</xs:sequence>

<xs:attribute name="timestamp" use="required">

<xs:simpleType>

<xs:restriction base="xs:dateTime">

<xs:enumeration value="2005-01-12T16:00:18-08:00"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="payloadID" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="1105574420141-977399960268715709@10.10.13.125"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Header">

<xs:complexType>

<xs:sequence>

<xs:element ref="From"/>

<xs:element ref="To"/>

<xs:element ref="Sender"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Identity">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="AN01000000001"/>

<xs:enumeration value="AN13000000259"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="InternalID">

<xs:complexType mixed="true">

<xs:attribute name="domain" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="PendingMessages"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="Message">

<xs:complexType>

<xs:sequence>

<xs:element ref="DataAvailableMessage"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Response">

<xs:complexType>

<xs:sequence>

<xs:element ref="Status"/>

<xs:element ref="GetPendingResponse"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Sender">

<xs:complexType>

<xs:sequence>

<xs:element ref="Credential"/>

<xs:element ref="UserAgent"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Status">

<xs:complexType>

<xs:attribute name="code" use="required">

<xs:simpleType>

<xs:restriction base="xs:short">

<xs:enumeration value="200"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="text" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="OK"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

<xs:element name="To">

<xs:complexType>

<xs:sequence>

<xs:element ref="Credential"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="UserAgent">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="ANCXMLDispatcher"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="cXML">

<xs:complexType>

<xs:sequence>

<xs:element ref="Response"/>

</xs:sequence>

<xs:attribute name="timestamp" use="required">

<xs:simpleType>

<xs:restriction base="xs:dateTime">

<xs:enumeration value="2005-01-12T16:00:18-08:00"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="payloadID" use="required">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="1105574420906--451266344000288275@10.10.13.125"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

</xs:schema>

Thanks,

Prakash

former_member206604
Active Contributor
0 Kudos

Hi,

If the follwing line creating a problem while mapping

<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">

Then use this XSL in the inteface mapping before you are doing the Message Mapping. In the Interface mapping add this XSL first and then the Message Mapping.

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

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text/xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<xsl:copy-of select="child::node()"/>

</xsl:template>

</xsl:stylesheet>

If you still face the problem again in the graphical mapping do XSL mapping.

Thanks,

Prakash

Former Member
0 Kudos

I am not clear what you are saying, I am sorry.

I need to Map the HTTPResponse(GetPendingResponse) to HTTPRequest2(DataRequest).

So how and where should I add the below code you have mentioned? Where in Interface mapping I should add the XSL.

Thansk for your help Prakash.

Former Member
0 Kudos

I looked into the following blog looks interesting probably I need to try that

/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping

former_member206604
Active Contributor
0 Kudos

Hi,

Copy the above code I have given and say it as Copy.xsl.

Import the same under Imported Archive. While doing your Interface mapping between GetPendingResponse to DataRequest you can add this XSL mapping.

Normally you will give your Message mapping program there, instead you cilck on the "+" button so that you can add one more mapping program. From the drop down you select XSL mapping type and make sure you give this XSL mapping as the first mapping program and then the graphical mapping.

If you are confortable with XSL mapping you can directly do the XSLT mapping from the source to target. In that case you will need only one mapping program that is XSL mapping. Please let me know if you need some help in doing XSL mapping. but please post both the Source and the Target XSL.

Thanks,

Prakash