XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Chris SmithSubject: XML: Editing with embedded space \u00a0
Author: Chris Smith
Date: 11 Jul 2005 06:20 PM
I'm being presented with some XML that ultimately is being used to rendor some HTML. The XML has some embedded spaces (nbsp) within some of its element values(\u00a0). This was done to force HTML spacing.

Whenever I open the XML file for editing, Stylus Studio 6.1 287e attempts to interpret/display the embedded values in the form of a box.

What I want: <PART>PART NUMBER</PART>
What I'm getting: <PART>PART&#65533;NUMBER</PART>

I have other editors that do NOT attempt to display its value but DO contain the proper hex A0/DEC 160 value.

Is there a way to tell Stylus Studio to recognize this and NOT attempt to display its textual value. Could the answer lie in the encoding assignment within the Stylus Studio "Edit" drop down menu? If so, I cannot seem to track down which one to use.


Thanks in Advance -
Chris

Postnext
Tony LavinioSubject: XML: Editing with embedded space \u00a0
Author: Tony Lavinio
Date: 13 Jul 2005 09:32 AM
Yes, it does seem like an encoding error.
If the XML has no encoding= in the <?xml?> declaration at the start,
the file by XML definition must be in UTF-8.
BUT... it is fairly common to see files generated in some local
character set, like ISO-8859-1, but missing this header.
We could try to analyze the file for you, but we'd need a sample.
If you could please send a copy (using the Attach File checkbox in
the reply to this thread), or email a copy to
stylus-field-report (at) stylusstudio.com we'd be happy to give it
a look.

Postnext
Chris SmithSubject: XML: Editing with embedded space \u00a0
Author: Chris Smith
Date: 13 Jul 2005 11:08 AM
Thanks for taking the time to respond Tony.

I have emailed the file via stylus-field-report@stylusstudio.com

Chris

Postnext
Tony LavinioSubject: XML: Editing with embedded space \u00a0
Author: Tony Lavinio
Date: 13 Jul 2005 12:08 PM
Okay, the problem is what I suspected.

In order to XML parsers to properly read a file with &nbsp; characters
encoded as 0xA0 bytes, the encoding MUST be specified in the <?xml?>
heading. In this case, the file SHOULD have
<?xml version="1.0" encoding="iso-8859-1"?> at the top.

Otherwise, it is being processed as UTF-8, which is the XML default,
according to http://www.w3.org/TR/REC-xml/#NT-EncodingDecl

In UTF-8 a 0xA0 byte in the file is actually invalid for UTF-8, but
for some reason the Xerces-C++ parser that we use instead turns it
into 0xFFFD. 0xA0 encoding for UTF-8 should be in the file as two
bytes, 0xC3 and 0xA0.

For more information on how UTF-8 works, see
http://en.wikipedia.org/wiki/UTF-8

So, either have the person supplying the XML document change the
header to include the encoding="ISO-8859-1", or have them change
the emitter so that non-breaking spaces are written as 0xC3 0xA0
(but not both together!)

Posttop
Chris SmithSubject: XML: Editing with embedded space \u00a0
Author: Chris Smith
Date: 13 Jul 2005 06:48 PM
Great Tony ... I have tested the encoding and all is well. Thanks for the help !!

Chris

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.