L
lonni4000
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.dtd">
<Feed>
.....
<OfficialName>Great Big & Little Co.</OfficialName>
........
I use java SAXParserFactory (variable name = factory):
factory.setValidating(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.setOfficalName(elementValue);
tempCounter++;
System.out.println("counter=" + tempCounter + " -->" +
elementValue);
char offName[] = elementValue.toCharArray();
for (int i = 0; i < offName.length; i++) {
System.out.println(offName);
}
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
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.dtd">
<Feed>
.....
<OfficialName>Great Big & Little Co.</OfficialName>
........
I use java SAXParserFactory (variable name = factory):
factory.setValidating(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.setOfficalName(elementValue);
tempCounter++;
System.out.println("counter=" + tempCounter + " -->" +
elementValue);
char offName[] = elementValue.toCharArray();
for (int i = 0; i < offName.length; i++) {
System.out.println(offName);
}
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