[jdom-interest] UTF-8 characters as text inside a node

Alex Rosen arosen at novell.com
Thu Mar 20 07:45:17 PST 2003


You need to make sure that the encoding listed at the top of the XML file is the same as the encoding that the file is actually encoded in. (Whether it's in a CDATA section or not is irrelevant.)

In this case, the file's actual encoding is obviously not UTF-8, that's why it's complaining. It's probably in the default encoding for your machine. (This part is where I start guessing:) On a Windows machine in English or a Western European language, that's probably CP1252. Which is what you should really put as the encoding at the top of the file, but then some XML parsers (on other platforms) might not be able to understand it. But CP1252 is close enough to ISO-8859-1 (Latin 1) that you can probably use that instead, and then it should work OK. (Somebody correct me here.)

Alex


>>> David Parker <dlparker at facstaff.wisc.edu> 3/19/2003 4:07:26 PM >>>
JDOMException: in.xml is not well-formed.
Error in building: The data "Valpara?" is not legal for a JDOM character 
content: 0xdcef is not a legal XML character.


How would one use "UTF-8 characters" as text?
I have tried it both waays and I get the same error message:
     <mattext><![CDATA["Valparaíso"]]></mattext>
     <mattext>Valparaíso</mattext>



<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv1p2.dtd">
<questestinterop>
   <item title="Información sobre Chile" ident="Type_MC_001">

     <presentation label="Text_MC_001">
       <flow>

         <response_lid ident="MC_001_a" rcardinality="Single" rtiming="No">
           <material>
             <mattext>La capital de Chile es ...</mattext>
           </material>

           <render_choice shuffle="No">

             <flow_label>
               <response_label ident="A">
                 <flow_mat class="list">
                   <material>
                     <mattext><![CDATA["Valparaíso"]]></mattext>
                   </material>
                 </flow_mat>
               </response_label>
             </flow_label>

             <flow_label>
               <response_label ident="B">
                 <flow_mat class="list">
                   <material>
                     <mattext>Valparaíso</mattext>
                   </material>
                 </flow_mat>
               </response_label>
             </flow_label>

Sincerely,
David Parker

mailto:david.parker at doit.wisc.edu 

Library, Instructional & Retrieval Applications,
DoIT - University of Wisconsin-Madison



_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com




More information about the jdom-interest mailing list