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 2487
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*****@python ware.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*****@python ware.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">
<a:Name>Matt</a:Name>
<a:TN>555-5555</a:TN>
|
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 attribute and remove
the containing node (and child nodes) if it has a certain value.
I'm able to find the attributes using an XmlTextReader. Once found,
can someone help me get the XPath at that point? I would then use
this to remove the node from...
|
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 removing the runat=server
from the <title> tag. Unfortunately it does not do it all the time...maybe
50%.
Brad
|
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 newlines.
If I do nothing to my program text, upon output I get XML which looks like
this:
<SomeTag text="def _f():
return 3
"/>
|
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 xmlns present is because the Xml I am passing to CRM is
a node from a bigger file that does require a xmlns and using the DOM
..OuterXml seems to set the xmlns for you automatically - which I don't want.
Any help would be great.
| |
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"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xmlns="http://www.w3.org/2000/xmlns/"
xmlns:mathematica="http://www.wolfram.com/XML/"
version="1.0">
|
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 'A\nB\r\nC' contains both forms of newlines.
|
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 the string. I am using
something like the following:
var txt = textarea_element.value.replace(/\n*$/, '');
But this replaced only the last newline(by changing '' to 'K', and
|
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 missed:
My template is:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-
prefixes="msxsl">
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |