cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with xml namespace

Former Member
0 Kudos

Hi,

I want to convert a csv-file that has follow structure as textfile:

field1,field2,field3

in a xml-file.

I also have created a mapping, so I get a mapping error when i want to convert the txt-file to xml

In the message monitoring the generated xml-file has follow structure:

<ns:target>

<Recordset>

<source>

<source_value_1>Source_value_1</source_value_1>

<source_value_2>source_value_2</source_value_2>

<source_value_3>source_value_3</source_value_3>

</source>

</Recordset>

</ns:target>

and the xsd has follow structure:

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

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

<xs:element name="source">

<xs:annotation>

<xs:documentation>Comment describing your root element</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence>

<xs:element name="source_value_1" minOccurs="0"/>

<xs:element name="source_value_2" minOccurs="0"/>

<xs:element name="source_value_3" minOccurs="0"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

So I get an error that there is a conflict in the namespace.

Can ynybody help me please.

Thanks

Regards

Stefan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Stefan -

In your Sender File adapter configuration in the Int. Directory, within section Content Conversion parameters,

there's are parameters called Document Name and Document Namespace. You should put in the corresponding values for the Message Type and the Namespace the Message Type belongs to that you defined in the Int. Repository.

Incidentally, within your test environment of your Message Mapping, if you click on the button "Generate Instance", it will give you an empty instance with the correct namespace of the message the mapping is expecting.

Regards,

Jin

Former Member
0 Kudos

Hi,

my problem is that the xsd-file that I have created with xml spy has a namespace with "xs".

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

and the xml-file that is generated wiht XI has a namespace with "ns":

<ns:schema xmlns:ns="http://www.im-c.de/test_01">

So, how can I solve this problem?

Thanks for your help.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

I do not think that your problem is the difference between xs and ns.

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

and

<ns:schema xmlns:ns="http://www.w3.org/2001/XMLSchema" >

are logically equivalent.

Also

<ns:schema xmlns:ns="http://www.im-c.de/test_01">

and

<xs:schema xmlns:xs="http://www.im-c.de/test_01">

are logically equivalent.

The problem is rather that in the first case the schema element belongs to the namespace

http://www.w3.org/2001/XMLSchema

whereas in the second case it belongs to the namespace

http://www.im-c.de/test_01

It is not clear to me how the second element was exactly produced but to me this seems not to make sense.

Greetings

Stephan

Former Member
0 Kudos

Hi,

thanks for your hints, but I have left the namspace in the fileadapter empty, so I could solve my problem.

Regards

Stefan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Stefan,

Usually, the XSD needs a target namespace which you define in the XI Integration Repository for the File's Data Type.

For example, after the <?xml version="1.0" encoding="UTF-8" ?>, this line should exist:

<xsd:schema targetNamespace="urn://xitest:stefan" xmlns="urn://xitest:stefan" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Regards,

Bhanu