BusinessObjects Board

XML import error

OK, please be gentle. This is my first attempt at using XML in Data Services, I have not understood any of the previous posts about this, and I don’t see where I can make the changes suggested in previous posts…

Data Services 14.2.5

I have imported an XSD, named LiteratureSampleRequest with the following format:

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

<xs:schema targetNamespace=“http://tempuri.org/XMLSchema.xsd
elementFormDefault=“qualified”
xmlns=“http://tempuri.org/XMLSchema.xsd
xmlns:mstns=“http://tempuri.org/XMLSchema.xsd
xmlns:xs=“http://www.w3.org/2001/XMLSchema

<xs:element name=“LiteratureSampleRequest”>
<xs:complexType >
xs:sequence
<xs:element name=“Primary” maxOccurs=“1” minOccurs=“1”>
xs:complexType
xs:all
<xs:element name=“Address_1” type=“xs:string”/>
<xs:element name=“Address_2” type=“xs:string”/>
<xs:element name=“City” type=“xs:string”/>
<xs:element name=“Zip” type=“xs:string”/>
<xs:element name=“Country” type=“xs:string”/>
<xs:element name=“State” type=“xs:string”/>
<xs:element name=“Company_Name” type=“xs:string”/>
<xs:element name=“Contact_Name” type=“xs:string”/>
<xs:element name=“Status” type=“xs:string”/>
<xs:element name=“Request_Type” type=“xs:string”/>
<xs:element name=“Reqestor” type=“xs:string”/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name=“Line” minOccurs=“1” maxOccurs=“unbounded”>
xs:complexType
xs:all
<xs:element name=“Line_Number” type=“xs:integer”/>
<xs:element name=“Quantity” type=“xs:integer”/>
<xs:element name=“Product_Code” type=“xs:string”/>
<xs:element name=“CMAT_Number” type=“xs:string”/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

I imported it as a new XML Schema named LiteratureSampleRequest. Namespace is as expected (http://tempuri.org/XMLSchema.xsd) with a root element name of LiteratureSampleRequest. I then attempted to use this in a data flow using the following XML as input:

<?xml version="1.0"?> 1 Main Street .. 01010 United States PA Won and Done Season Debutante Requested Sample John Smith 1 0 0001707

Data Services is throwing an error of:

An element named present in the XML data input does not exist in the XML format used to set up this XML source in data flow <DF_Samp_Lit_RMA>. Validate your XML data.

What do I need to change to get this to work?


jamonwagner :us: (BOB member since 2007-03-14)

There are a few issues here. Until your XML matches your XSD it will not work in Data Services.

Testing what you posted:

xmllint --noout --schema test.xsd test.xml
test.xml:2: element LiteratureSampleRequest: Schemas validity error : Element 'LiteratureSampleRequest': No matching global declaration available for the validation root.
test.xml fails to validate

To get rid of that, change your schema to just this:

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

If you run xmllint again, you’ll see you have extra or missing tags:

test.xml:9: element State_: Schemas validity error : Element 'State_': This element is not expected. Expected is one of ( State, Company_Name, Contact_Name, Status, Request_Type, Reqestor ).
test.xml:17: element Line: Schemas validity error : Element 'Line': Missing child element(s). Expected is ( CMAT_Number ).
test.xml fails to validate

So you need to change “State_” to “State” in your XML file to match your XSD. Your XSD also specifies that the XML will contain CMAT_Number, which is missing in the XML. Fixing those, you’ll get:

test.xml:15: element Ship_Via: Schemas validity error : Element 'Ship_Via': This element is not expected. 
test.xml fails to validate

Because “Ship_Via” is in your XML but not in your XSD. So either add to your XSD or remove from your XML. Then you should get,

test.xml validates

thesnow :us: (BOB member since 2011-08-10)

Thank you very much!!! As I said, I’m very new to the whole XML import side of things; everything we’ve done has been database-driven.

Sorry I didn’t send thanks sooner; was dealing with some production issues Thursday and Friday…


jamonwagner :us: (BOB member since 2007-03-14)