XML parsing error remedy

Discussion in 'XML Forums' started by farobi, Apr 10, 2013.

  1. farobi

    farobi New Member

    during parsing an XML file, i am facing parsing error like \[code\][Fatal Error] :293:24: Invalid byte 2 of 2-byte UTF-8 sequence.\[/code\] My XML sample contains some characters like xc3, which is a single character (I mean by pressing delete button once xc3 character deletes at a time. (I tried to paste this character here but this editor is showing other character).\[code\]<?xml version="1.0" encoding="utf-8"?><issue-info><issue-meta><date>January 24, 2013</date><from>Chris Burton, John Wiley & Sons, Ltd.</from><journal>Greenhouse Gases: Science and Technology</journal><typesetter>Anju Upadhaya</typesetter><volume>3</volume><issue>1</issue><printer>Markono,</printer><cover-date>February 2013</cover-date><online-issn>2152-3878</online-issn><print-issn>2152-3878</print-issn><total-pages>FM &ndash; 4; TEXT &ndash; 95; EM &ndash; 1: TOTAL = 100</total-pages><spl-instruction></spl-instruction></issue-meta><issue-item><seq>1</seq><ed-ref>OFC</ed-ref><aid></aid><author></author><description>Update from GHG 2_1 cover</description><start-page>1</start-page><end-page>1</end-page><artty></artty><category>OFC (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>2</seq><ed-ref>IFC</ed-ref><aid></aid><author>49379?pdf</author><description>New GHG colour ADVERT</description><start-page>2</start-page><end-page>2</end-page><artty></artty><category>IFC (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>3</seq><ed-ref>FM1</ed-ref><aid></aid><author></author><description>Table of Contents</description><start-page>1</start-page><end-page>1</end-page><artty></artty><category>TOC (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>4</seq><ed-ref>FM2</ed-ref><aid></aid><author></author><description>Editorial Board</description><start-page>2</start-page><end-page>2</end-page><artty></artty><category>Editorial Board (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>5</seq><ed-ref>FM3</ed-ref><aid></aid><author></author><description>Aims and Scope</description><start-page>3</start-page><end-page>3</end-page><artty></artty><category>Aims and Scope (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>6</seq><ed-ref>FM4</ed-ref><aid></aid><author></author><description>Information Page</description><start-page>4</start-page><end-page>4</end-page><artty></artty><category>Information Page (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>7</seq><ed-ref></ed-ref><aid>GHG1333</aid><author>PROD ED</author><description></description><start-page>1</start-page><end-page>2</end-page><artty>ED</artty><category>Editorial (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>8</seq><ed-ref></ed-ref><aid>GHG1334</aid><author>PROD ED</author><description></description><start-page>3</start-page><end-page>4</end-page><artty>XX</artty><category>60 Second Interview (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>9</seq><ed-ref></ed-ref><aid>GHG1335</aid><author></author><description></description><start-page>5</start-page><end-page>7</end-page><artty>XX</artty><category>Feature (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>10</seq><ed-ref>GHG-12-0029.R2</ed-ref><aid>GHG1313</aid><author>PAN, CLODIC, TOUBASSY</author><description></description><start-page>8</start-page><end-page>20</end-page><artty>XX</artty><category>In the Field (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online>03 Jan 2013</pub-online></issue-item><issue-item><seq>11</seq><ed-ref>GHG-12-0023.R1</ed-ref><aid>GHG1298</aid><author>Peterson, O'Byrne, Endres, Peterson</author><description></description><start-page>21</start-page><end-page>29</end-page><artty>XX</artty><category>Spotlight (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online>14 Sep 2012</pub-online></issue-item><issue-item><seq>12</seq><ed-ref>GHG-12-0033.R2</ed-ref><aid>GHG1321</aid><author>Begag, Krutka, Dong, Mihalcik, Rhine, Gould, Baldic, Nahass</author><description></description><start-page>30</start-page><end-page>39</end-page><artty>XX</artty><category>Spotlight (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>13</seq><ed-ref>GHG-12-0036.R1</ed-ref><aid>GHG1331</aid><author>Cunningham, Lauchnor, Eldring, Esposito, Mitchell, Gerlach, Phillips, Ebigbo, Spangler</author><description></description><start-page>40</start-page><end-page>49</end-page><artty>XX</artty><category>Spotlight (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>14</seq><ed-ref>GHG-12-0034.R1</ed-ref><aid>GHG1328</aid><author>Elliot, Buscheck, Celia</author><description></description><start-page>50</start-page><end-page>65</end-page><artty>XX</artty><category>Modeling and Analysis (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>15</seq><ed-ref>GHG-12-0021.R1</ed-ref><aid>GHG1318</aid><author>Mazzoldi, Picard, Sriram, Oldenburg</author><description></description><start-page>66</start-page><end-page>83</end-page><artty>XX</artty><category>Modeling and Analysis (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online>03 Jan 2013</pub-online></issue-item><issue-item><seq>16</seq><ed-ref>GHG-12-0031.R1</ed-ref><aid>GHG1308</aid><author>Eccles, Pratson</author><description></description><start-page>84</start-page><end-page>95</end-page><artty>XX</artty><category>Modeling and Analysis (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online>26 Oct 2012</pub-online></issue-item><issue-item><seq>17</seq><ed-ref>EM1</ed-ref><aid></aid><author>Join the SCI</author><description>NEW COLOUR ADVERT</description><start-page></start-page><end-page></end-page><artty></artty><category>Society Ad (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>18</seq><ed-ref>IBC</ed-ref><aid></aid><author>ONLINE OPEN</author><description>COLOUR ADVERT</description><start-page>1</start-page><end-page>1</end-page><artty></artty><category>IBC (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item><issue-item><seq>19</seq><ed-ref>OBC</ed-ref><aid></aid><author>CCUS</author><description>NEW COLOUR ADVERT</description><start-page>2</start-page><end-page>2</end-page><artty></artty><category>OBC (GHG)</category><toc-category></toc-category><reprint></reprint><color>N</color><color-charge>0</color-charge><pub-online></pub-online></issue-item></issue-info>\[/code\]My Java code for parsing is here below.\[code\] DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setValidating(false); docBuilderFactory.setCoalescing(false); docBuilderFactory.setXIncludeAware(false); docBuilderFactory.setNamespaceAware(false); docBuilderFactory.setIgnoringComments(true); docBuilderFactory.setExpandEntityReferences(false); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(rtfXmlIS); doc.getDocumentElement().normalize();\[/code\]How to get rid of such kind of error (\[code\][Fatal Error] :16:45: Invalid byte 1 of 1-byte UTF-8 sequence.\[/code\], \[code\][Fatal Error] :14:24: The entity "ndash" was referenced, but not declared.\[/code\])?
     

Share This Page