I'm using xml.sax to parse the "datebook" xml file generated by
QTopiaDesktop. When I look at the xml file, some of the
attribute strings have newlines in them (as they are supposed
to).
However, when xml.sax passes the attributes to my
startElement() method the newlines seem to have been deleted.
How do I get the un-munged element attribute values?
--
Grant Edwards grante Yow! Someone is DROOLING
at on my collar!!
visi.com 4 2468
Grant Edwards wrote: I'm using xml.sax to parse the "datebook" xml file generated by QTopiaDesktop. When I look at the xml file, some of the attribute strings have newlines in them (as they are supposed to).
However, when xml.sax passes the attributes to my startElement() method the newlines seem to have been deleted.
How do I get the un-munged element attribute values?
newlines as in chr(10) rather than 
 ?
if so, the only way is to avoid XML: http://www.w3.org/TR/REC-xml/#AVNormalize
if the "yes, I know, but I have good reasons" approach is okay with you,
and you're big enough to defend yourself against the XML-Is-The-Law
crowd, you can use a "sloppy" XML parsers such as sgmlop to deal with
your files: http://effbot.org/zone/sgmlop-index.htm
</F>
On 2005-09-29, Fredrik Lundh <fr*****@pythonware.com> wrote: I'm using xml.sax to parse the "datebook" xml file generated by QTopiaDesktop. When I look at the xml file, some of the attribute strings have newlines in them (as they are supposed to).
However, when xml.sax passes the attributes to my startElement() method the newlines seem to have been deleted.
How do I get the un-munged element attribute values? newlines as in chr(10) rather than 
 ?
Yup, Looks that way.
if so, the only way is to avoid XML:
http://www.w3.org/TR/REC-xml/#AVNormalize
I can't quite find it in the BNF, but I take it that chr(10)
isn't really allowed in XML attribute strings. IOW, the file
generate by Trolltech's app is broken.
if the "yes, I know, but I have good reasons" approach is okay with you,
I didn't define the file or write the program that generated
it. It's claimed to be "xml", and I'm just trying to parse it.
and you're big enough to defend yourself against the XML-Is-The-Law crowd, you can use a "sloppy" XML parsers such as sgmlop to deal with your files:
http://effbot.org/zone/sgmlop-index.htm
Good to know for future reference. For now, I think I'll just
live with the way it works. Everything basically works, except
some strings don't display quite "right". My current app
treats the file as read-only. If I ever get around to
modifying data and writing it back, I'll probably have to deal
with the newline issue at that point.
--
Grant Edwards grante Yow! When this load is
at DONE I think I'll wash
visi.com it AGAIN...
Grant Edwards wrote: http://www.w3.org/TR/REC-xml/#AVNormalize
I can't quite find it in the BNF, but I take it that chr(10) isn't really allowed in XML attribute strings. IOW, the file generate by Trolltech's app is broken.
it's allowed, but the parser must not pass it on to the application.
(in other words, whitespace in attributes doesn't, in general, survive
roundtripping)
</F>
On 2005-09-29, Fredrik Lundh <fr*****@pythonware.com> wrote: http://www.w3.org/TR/REC-xml/#AVNormalize
I can't quite find it in the BNF, but I take it that chr(10) isn't really allowed in XML attribute strings. IOW, the file generate by Trolltech's app is broken.
it's allowed, but the parser must not pass it on to the application.
(in other words, whitespace in attributes doesn't, in general, survive roundtripping)
Ah, I see. That's good to know.
[This is my first attempt at anything XMLish.]
--
Grant Edwards grante Yow! I know how to do
at SPECIAL EFFECTS!!
visi.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt |
last post by:
Hello,
I have an XML document similar to the following:
<DataItems>
<Data xmlns="http://www.me.com">
<DataInformation xmlns:a="http://www.me.com/ASettings"
xsi:type="a:Stuff1">...
|
by: Greg |
last post by:
Hi. I have a rather large xml document (object) that can have one or
more nodes with a certain attribute throughout (at ANY depth, not at
the same level necessarily). I need to find this...
|
by: Brad |
last post by:
I'm placing a runat=server attribute on the <title> tag in my pages, so I
can read/set the title text in code. The problem is that when I
subsequently change the page in design view VS is...
|
by: skip |
last post by:
*argh!* I hate XML! There, now that that's off my chest...
I am trying to save Python code as attributes of an XML tag with
xml.dom.minidom machinery. The code, predicatbly enough, contains...
|
by: Simon Hart |
last post by:
Hi,
I have a requirement to remove the xmlns from the DOM in order to pass over
to MS CRM 3.0 Fetch method.It seems the fetch method blows up if there is a
xmlns present!?!
The reason I have a...
|
by: Chris Chiasson |
last post by:
Hi,
After reading and experimenting for a several hours, I have this
stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
|
by: HopfZ |
last post by:
Not a question.
I tested how two kinds of newlines (\n and \r\n) interact with three
browsers: Fx (Firefox 2), Op (Opera 9), Ie (IE 7) (all three on Windows
XP).
Result:
The string...
|
by: lihao0129 |
last post by:
Hi, folks:
I recently went through a strange problem with my Javascript code,
say: I have a string variable which are from a 'textarea' element and
I want to remove the trailing newlines inside...
|
by: joelkeepup |
last post by:
Hi, im trying to create a text email message using xslt template , the
transforms work great, but the newlines and whitespace in the xslt doc
are removed. Is there a setting somewhere I have...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |