My parser parses special characters okay, but adds extra line breaks.
It makes no sense to me at all! If anyone knows what I am doing wrong,
please help.
text file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Feed SYSTEM "SDF_NA4.dt d">
<Feed>
.....
<OfficialName>G reat Big & Little Co.</OfficialName>
........
I use java SAXParserFactor y (variable name = factory):
factory.setVali dating(true);
and when I call convertElement( String) on this line, it reads it 3
times!
1st the code:
public void convertElement( String elementValue) throws SAXException
{
if (eName.equals(" OfficialName")) {
company.setOffi calName(element Value);
tempCounter++;
System.out.prin tln("counter=" + tempCounter + " -->" +
elementValue);
char offName[] = elementValue.to CharArray();
for (int i = 0; i < offName.length; i++) {
System.out.prin tln(offName[i]);
}
2nd the output:
<?xml version='1.0' encoding='UTF-8'?>counter=1 -->Great Big
G
r
e
a
t
B
i
g
counter=2 -->&
&
counter=3 --Little Co.
L
i
t
t
l
e
C
o
..
Can anyone help!?
Thank you
Lonni 2 2015
Remember, SAX does not promise that all contiguous text will be
delivered as a single call to characters() -- and entity references are
one of many things which will cause it to be divided up.
If you want a single contiguous string, your app is responsible for
buffering the characters() events until it sees something else, and then
processing the result.
On Jan 24, 10:26 am, Joseph Kesselman <keshlam-nos...@comcast. net>
wrote:
Remember, SAX does not promise that all contiguous text will be
delivered as a single call to characters()
Thank you, I didn't realize that!
I will change my code appropriately.
Lonni This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sidharta |
last post by:
Hi all,
how come this doesn't work?????
# convert to unix new lines
$text = preg_replace("/\r\n/", "\n", $text);
# remove extra new lines
$text = preg_replace("/\n+/", "\n", $text);
is there better ways to remove extra new lines???
|
by: Krishna A.M |
last post by:
Hi,
How do i add a hyperlink to a email id having special characters?
I tried the same , say mailto: test_&_send@hoohoo.com
IN the to box i can see only till test_ and the rest is omitted.
Any ideas how the tags could be bypassed?
Though i am not a web page designer, I tried & but with no luck.
Any help would be highly appreciated.
|
by: Jamie Jackson |
last post by:
Two fairly basic questions:
I need to supply a method with an array of strings, which will
eventually be used to pattern match against another array of strings.
1. Is there a good way to span multiple lines when creating an array
from a list of strings? (I want the most readable list I can get.)
// The following doesn't seem to work
urlExclusions = newArray(
|
by: Thierry Lam |
last post by:
Let's say I have the following xml tag:
<para role="source">a & b</para>
Currently, an xml parser will treat & as a special character. Does
anyone know the special characters to use around the ampersand so that
the xml parser can treat "a & b" as a whole value?
Thanks
Thierry
|
by: GSK |
last post by:
I'm using System.Web.Mail to send HTML formatted e-mails, and something very
bizarre is happening.
When I send a message to myself, it looks fine, but when my client sends one
to herself, she gets a single exclamation point inserted, usually in the
same spot but sometimes it shifts a place or two, within the text.
The message is about 13 lines, and it is only one character that gets
inserted, so I find this very strange. There is no...
| |
by: Robert Dodier |
last post by:
Hello,
Sorry for asking what must be a FAQ, but I wasn't able to find the
answer.
I have an XML document fragment which I want to store as a text string.
I want a function to convert any XML special characters such as < >
into
the corresponding character entities. I'm working with Java.
|
by: ricky |
last post by:
Can anybody help with the function to get rid of extra characters in
the file.
I want to remove the string from the file.So i read from input file and
pass the string say "john" if found dnt write it to the ouput file but
if not found write all the line to the output file
so i read line by line
cin.get(input,line)
if(line != s)
output<<line
|
by: Wim Cossement |
last post by:
Hello,
I was wondering if there are a few good pages and/or examples on how to
process form data correctly for putting it in a MySQL DB.
Since I'm not used to using PHP a lot, I already found out that
addslashes() can be used escape some characters, but I'm having some
more problems with for instance ä, å and µ (since the text is scientifical)
Now some people also throw in htmlspecialchars() to convert those to
HTML entities, but some...
|
by: webqueen79 |
last post by:
When I open up my asp code in an editor, I see TONS of extra whitespace between code lines which is making the editor bomb out because it takes so long to load all the lines. When I open up the asp code in notepad I see weird square like characters where the extra whitespace is. I have tried doing a find/replace on the characters, but that hasn't worked. Does anybody know anyway of getting rid of these characters??? Please help, I am desperate.
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |