示例 xml ,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Issue>
<Snippet>
sri;;
hiil
bye;
tc;
</Snippet>
</Issue>
是否可以在片段标签中获取整个字符?
如果这是实现,
public void startElement(String uri, String localName,
String qName, Attributes attributes) throws SAXException {
temp = "";
if (qName.equalsIgnoreCase("Issue")) {
acct = new Account();
public void endElement(String uri, String localName, String qName)
throws SAXException {
if (qName.equalsIgnoreCase("Issue")) {
// add it to the list
accList.add(acct);
else if(qName.equalsIgnoreCase("Snippet"))
{
acct.setPrimarySnippet(temp);
}
O/p 为 tc;但我需要片段标签内的整个值才能打印出来。