#android
#Android
Вопрос:
public void characters(char[] ch, int start, int length) throws SAXException
{
if (currentElement)
{
currentValue = new String(ch, start, length);
Log.d("char-->",currentValue);
currentElement = false;
}
}
когда я вижу текущие значения из символьной функции при синтаксическом анализе xml в andorid
затем отображаются только некоторые символы полного текста, оставшийся текст пропускается анализатором
итак, мне нужен полный текст, независимо от того, сколько символов в этом.
пример—> исходный текст -> «привет, привет, все в порядке или нет, что ты делаешь ….. и продолжай многие строки»
но я получил только 10 или 20 символов или что-то в этом роде, но не полный текст, пожалуйста, ответьте
xml-файл является
<item>
<title>Ideologue : Pandit Deendayal Upadhyaya (1916-1968) </title>
<description>
<text><![CDATA[<p style="font-size: 1.1em;"><span style="color: #ff6600;">
<em>Pandit Deendayal Upadhyaya was the leader of
the Bharatiya Jana Sangh from 1953 to
1968. A profound philosopher, organiser par excellence and a leader
who maintained the highest standards
of personal integrity, he has been the
source of ideological guidance and
moral inspiration for the BJP since
its inception. His treatise Integral
Humanism, which is a critique of both
communism and capitalism, provides a
holistic alternative perspective for
political action and statecraft
consistent with the laws of Creation
and the universal needs of the human
race.</em></span><br /><br
/><strong><span style="color: #990000; font-size: 1.2em;"><span
style="text-decoration: underline;">A
Short
Biography</span></span></strong><br/><br />Pandit Deendayal Upadhyaya was
born on Monday September 25, 1916, in
the sacred region of Brij in the
village of Nagla Chandraban in Mathura
District . His father was a well known
astrologer. An astrologer who studied
his horoscope predicted that the boy
would become a great scholar and
thinker, a selfless worker, and a
leading politician - but that he would
not marry. While at Bhatpur tragedy
struck the family, he lost his brother
to illness in 1934. He later went to
high school in Sikar. Maharaja of
Sikar gave Pandit Upadhyaya a gold
medal, Rs. 250 for books and a monthly
scholarship of Rs.10.<br /><br/>Pandit Upadhyaya passed his
Intermediate exams with distinction in
Pilani and left to Kanpur to pursue
his B.A. and joined the Sanatan Dharma
college. At the instance of his friend
Shri. Balwant Mahashabde, he joined
the RSS in 1937. In 1937 he received
his B.A. in the first division. Pandit
Upadhyaya moved to Agra to pursue
M.A.<br /><br />Here he joined forces
with Shri. Nanaji Deshmukh and Shri.
Bhau Jugade for RSS activities. Around
this time Rama Devi, a cousin of
Deendayalji fell ill and she moved to
Agra for treatment. She passed away.
Deendayalji was very depressed and
could not take the M.A. exams. His
scholarships, received earlier from
Maharajaj of Sikar and Shri. Birla
were discontinued.<br /><br />At the
instance of his aunt he took a
Government conducted competitive
examination in dhoti and kurta with a
cap on his head, while other
candidates wore western suits. The
candidates in fun called him
"Panditji" - an appellation millions
were to use with respect and love in
later years. Again at this exam he
topped the list of selectees. Armed
with his Uncle's permission he moved
to Prayag to pursue B.T. and at Prayag
he continued his RSS activites. After
completion of his B.T., he worked
full-time for the RSS and moved to
Lakhimpur District in UP as an
organizer and in 1955 became the
Provincial Organizer of the RSS in
UP.<br /><br />He established the
publishing house 'Rashtra Dharma
Prakashan' in Lucknow and launched the
monthly magazine 'Rashtra Dharma' to
propound the principles he held
sacred. Later he launched the weekly
'Panchjanya' and still later the daily
'Swadesh'. In 1950, Dr. Syama Prasad
Mookerjee, then Minister at the
Center, opposed the Nehru-Liaquat pact
and resigned his Cabinet post and
joined the opposition to build a
common front of democratic forces.
Dr.Mookerjee sought Shri. Guruji's
help in organizing dedicated young men
to pursue the work at the political
level.<br /><br />Pandit Deendayalji
convened on September 21, 1951 a
political convention of UP and founded
the state unit of the new party,
Bharatiya Jana Sangh. Pandit.
Deendayalji was the moving spirit and
Dr. Mookerjee presided over the first
all-India convention held on October
21, 1951.<br /><br />Pandit
Deendayalji's organizing skills were
unmatched. Finally came the red letter
day in the annals of the Jana Sangh
when this utterly unassuming leader of
the party was raised to the high
position of President in the year
1968. On assuming this tremendous responsibility Deendayalji went to the
South with the message of Jana Sangh.
On the dark night of February 11,
1968, Deendayal Upadhyaya was
fiendishly pushed into the jaws of
sudden death.</p>]]></text>
</description>
<author> deepa@tetrain.com (Administrator)</author>
<pubDate>Wed, 25 Aug 2010 07:08:26 GMT</pubDate>
</item>
Комментарии:
1. Как вы анализируете свой XML? Также покажите пример XML, который вы пытаетесь проанализировать.
2. прощай, синтаксический анализатор sax, в методе endElement
3. Покажите нам ваш код, пожалуйста. И XML также.
Ответ №1:
Для одного элемента может быть несколько вызовов characters()
. Вам нужно будет объединить результаты, если вы хотите, чтобы данные представляли собой единую непрерывную строку.