Salesforce

XML Troubleshooting (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

XML Troubleshooting (Magic xpa 4.x)

Q1

How come when I have a restriction element Magic xpa can’t always use the schema with XML views?

A1

Delete the part with the restriction (the <xs:restriction> tag).

For example, if you have:

<xs:element name="description">

<xs:simpleType>

<xs:restriction>

<xs:maxLength value="256">

</xs:restriction>

</xs:simpleType>

</xs:element>

Change it to:

<xs:element type="xs:string" name="description">

</xs:element>

In addition, in Magic xpa's table definition, go to the Magic xpa fields and add the limitation described in the restriction tag. In the example, update the picture to 256.

Q2

Why am I getting the "Row length too big" error for an XML view (default database=Memory) with a record size of over 32K (32768 bytes)?

A2

The length and the limitation depends on the XML database defined. If you require more than 32767 bytes, work with MSSQL or another database.

Q3

Why am I getting the "Fatal: invalid document structure" error?

A3

This may happen when the encoding of the XML does not match the content of the BLOB variable, usually when the BLOB variable is created by the File2Blb function. There are several solutions to this problem, depending on the data:

  • If the data is Ansi or UTF8, you can use an Ansi or Binary BLOB.

  • If the data is Unicode and the data contains the following encoding header as the first line: <?xml version="1.0" encoding="UTF-16" standalone="no" ?>, you can use a Unicode BLOB.

  • If the data is Unicode and you cannot add the encoding declaration, convert it to UTF8 using UnicodeToANSI(File2Blb('test.xml'),65001) and store it in a Binary BLOB. By default, when working with an XML data source that does not have an encoding declaration, the parser assumes that the data is UTF8.

Q4

Why am I getting the "XSD has a different target namespace from the one specified in the instance doc" error?

A4

This may happen when the XMLValidate function is not used correctly. To solve this, check to see that the parameters of the function are set correctly. For example, if the schema has a targetNamespace, the 2nd parameter (if specified) must have the target namespace prefixed before the schema location, separated by a space.

Q5

When I try to parse XML files using XML functions, why is the parsing failing?

A5

This might happen with XML functions, such as XMLGet and XMLExist, when you use single quotation marks in the XML function's XML declaration, such as <?xml version='1.0' encoding='UTF-8'?>.

There are a number of solutions:

  1. Change the single quotation marks to double quotation marks, such as <?xml version="1.0" encoding="UTF-8"?>.

  2. This occurs sometimes when a BLOB is defined as Unicode, but works okay with ANSI. Therefore, you can try defining the BLOB as ANSI.

  3. Use the File2Blb function to convert the XML file into a Binary BLOB and then use the UnicodeToANSI function with a utf-8 codepage as the second argument.

Reference
Attachment 
Attachment