To avoid errors when loading the informacion, it is important that the feeds fulfill the requirements that the system accepts. In feeds with XML format, you should check the validation of the file, as well as review several conditions.
What requirements must an XML feed meet?
In order to avoid any failure when loading an XML feed, we recommend to follow these tips:
- Choose the granularity of your XML documents carefully
- Encode your XML documents in UTF-8 without BOM
- Well-formed XML documents
The XML statements consist on a series of labels (called elements) with a series of modifiers (called attributes).
The labels can be nested inside each other, but any label that is opened must be closed, and always in the same order. In case an element does not have a partner (because it has no content inside), it is called an empty element and it is indicated with a “/” at the end.
The elements are grouped into documents, such as the following:
<? xml version = "1.0" encoding = 'iso-8859-1'?>
<room id = 'dining room'>
<furniture> dresser </ furniture>
<furniture> sofa </ furniture>
<door a = 'balcony' />
- If DTD is not used, the document should start with a Standalone Document Declaration, such as the one on the first line.
- All labels must be balanced, meaning that all elements that contain character data must have start and end labels.
- All attribute values must be enclosed in quotation marks. The single quote character (the apostrophe) can be used if the value contains double quote characters, and vice versa. If you need both, use ' and "
- Any empty element (eg those that do not have a final tag like <IMG>, <HR>, and <BR> and others of HTML) must end with '/>' or you must make them NOT EMPTY by adding an end tag, such as It looks in the door element.
- There should be no isolated labels (<or &) in the text (eg it should be given as < and &), and the sequence]]> should be given as]] & gt; if this does not occur as the end of a section marked as CDATA;
- The elements must nest their properties within themselves (labels should not be superimposed, as in the rest of SGML);
- Well-formed files without DTD can use attributes in their elements, but these must all be of the CDATA type, by default. The CDATA type (character DATA) are characters.
- The names of the labels can be alphanumeric, starting with a letter, and including the characters - and :, although the latter has a special meaning.
- It will not be able to contain the following characters unless they are escaped: " '<> &. They should be as follows: "= & quot; '= ' <= <> = > & = &
- In order to guarantee that the servers are not blocked, it is recommended that the size of the XML files does not exceed 20MB.
- The response time of XML documents should be as fast as possible (XML should be cached and not created in each request)
Any question, just contact us to email@example.com!