Search code examples
htmlxmlexcelwordpresscdata

Trying to include Text and HTML inside XML schema but receiving failure


For a personal project I need to get information from an excel-sheet into xml-data (xml-schema needed) but if I try to validate it this error shows: "Non-HTML Content-Type: text/xml ."

The excel sheet includes information such as basic text, which is quite simple to transport into xml, but also has long html inside its cells which later should be used as content of a wordpress site/post. So this hmtl begins with visualcomposer elemnts like "[vc_row][vc_column][vc_column_text]" and further more contains very standard html elements like paragraphs or tables. All html is wrapped inside .

So I wonder if this could be the source of my problem as, with my very slim coding and debugging knowledge, this came in my mind first.

Some extra information:

  • the xml-schema is edited with Dreamweaver CC 2015 which also does the validation
  • the xml-file is characterized, with: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <materialData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  • Data inside the xml is structured like: <matData><ID>3001</ID><author>1</author> ... </matData>

Solution

  • I suspect what you need is to correctly enclose the values that will include html in cdata tags so there not seen as xml.

    <exampleOfACDATA>
    <![CDATA[
        Since this is a CDATA section
        I can use all sorts of reserved characters
        like > < " and &
        or write things like
        <foo></bar>
        but my document is still well formed!
    ]]>
    </exampleOfACDATA>
    

    see further details here What does <![CDATA[]]> in XML mean?