sax

how to display image in grid view reading imageUrl from xml using sax parser in android

◇◆丶佛笑我妖孽 提交于 2019-12-01 10:40:50
问题 I am new in android. I want to create a application to read the XML file from an URL and show the image in a grid view using ImageUrl of image. Thanks for the answer but I am able to read xml file from url but I need if in xml imageUrl is there so show in grid view. This is my xml file <?xml version="1.0" encoding="UTF-8"?> <channels> <channel> <name>ndtv</name> <logo>http://a3.twimg.com/profile_images/670625317/aam-logo-v3-twitter.png</logo> <description>this is a news Channel</description>

JAVA使用easyexcel操作Excel

牧云@^-^@ 提交于 2019-12-01 10:15:55
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/jianggujin/article/details/80200400 之前写过一篇《JAVA操作Excel》,介绍了jxl和poi读写Excel的实现,今天为大家介绍一下使用easyexcel对Excel进行读写,项目主页地址:https://github.com/alibaba/easyexcel 作者对easyexcel的介绍是: Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都存在一个严重的问题就是非常的耗内存,poi有一套SAX模式的API可以一定程度的解决一些内存溢出的问题,但POI还是有一些缺陷,比如07版Excel解压缩以及解压后存储都是在内存中完成的,内存消耗依然很大。easyexcel重写了poi对07版Excel的解析,能够原本一个3M的excel用POI sax依然需要100M左右内存降低到KB级别,并且再大的excel不会出现内存溢出,03版依赖POI的sax模式。在上层做了模型转换的封装,让使用者更加简单方便 使用easyexcel,首先我们需要添加maven依赖: <dependency> <groupId>com.alibaba</groupId>

How to use JAXB with HTML?

帅比萌擦擦* 提交于 2019-12-01 09:08:18
I would like to unmarshall some nasty HTML to a Java object using JAXB. (I'm on Java 7). Tagsoup is a SAX-compliant XML parser that can handle nasty HTML. How can I setup JAXB to use Tagsoup for unmarshalling HTML? I tried setting System.setProperty("org.xml.sax.driver", "org.ccil.cowan.tagsoup.Parser"); If I create an XMLReader, it uses Tagsoup, but not when I use JAXB. Does com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl use DOM or SAX for parsing XML? How can I tell JAXB to use SAX? How can I tell JAXB to use TagSoup as it's SAX implementation? As per Blaise's suggesting, tried below,

Efficient Parser for large XMLs

安稳与你 提交于 2019-12-01 08:15:20
问题 I have very large XML files to process. I want to convert them to readable PDFs with colors, borders, images, tables and fonts. I don't have a lot of resources in my machine, thus, I need my application to be very optimal addressing memory and processor. I did a humble research to make my mind about the technology to use but I could not decide what is the best programming language and API for my requirements. I believe DOM is not an option because it consumes a lot of memory, but, would Java

How to use JAXB with HTML?

血红的双手。 提交于 2019-12-01 06:54:54
问题 I would like to unmarshall some nasty HTML to a Java object using JAXB. (I'm on Java 7). Tagsoup is a SAX-compliant XML parser that can handle nasty HTML. How can I setup JAXB to use Tagsoup for unmarshalling HTML? I tried setting System.setProperty("org.xml.sax.driver", "org.ccil.cowan.tagsoup.Parser"); If I create an XMLReader, it uses Tagsoup, but not when I use JAXB. Does com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl use DOM or SAX for parsing XML? How can I tell JAXB to use SAX?

How to output a CDATA section from a Sax XmlHandler

会有一股神秘感。 提交于 2019-12-01 06:31:44
This is a followup question of How to encode characters from Oracle to Xml? In my environment here I use Java to serialize the result set to xml. I have no access to the output stream itself, only to a org.xml.sax.ContentHandler. When I try to output characters in a CDATA Section: It happens basically like this: xmlHandler.startElement(uri, lname, "column", attributes); String chars = "<![CDATA["+rs.getString(i)+"]]>"; xmlHandler.characters(chars.toCharArray(), 0, chars.length()); xmlHandler.endElement(uri, lname, "column"); I get this: <column><![CDATA[33665]]></column> But I want this:

Sax - ExpatParser$ParseException

匆匆过客 提交于 2019-12-01 05:57:25
I'm making an Android application that reads an XML Internet. This application uses SAX to parse XML. This is my code for the part of parsing: public LectorSAX(String url){ try{ SAXParserFactory spf=SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); DefaultHandler lxmlr=new LibraryXMLReader() ; sp.parse(url, lxmlr); nodo=((LibraryXMLReader)lxmlr).getNodoActual(); }catch(ParserConfigurationException e){ System.err.println("Error de parseo en LectorSAX.java: "+e); }catch(SAXException e){ System.err.println("Error de sax LectorSAX.java: " + e); } catch (IOException e){ System.err

SAXParser '&' concatenation problem

折月煮酒 提交于 2019-12-01 05:54:13
I am presently using SAXParser with SAXParserFactory, and I have run into a problem with strings being cuttoff at '&' symbols. For example: "Nation Created Our World & everything in it" becomes "everything in it". Obviously, I dont want this to happen. In the xml input, the character is properly escaped as & . How can I resolve this? try{ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); /* Get the XMLReader of the SAXParser we created. */ XMLReader r = sp.getXMLReader(); //This handles the xml and populates the entries array XMLHandler handler = new

porting to Android: why am I getting “Can't create default XMLReader; is system property org.xml.sax.driver set?”?

痞子三分冷 提交于 2019-12-01 05:31:27
I am porting some Java code that worked fine on my desktop to Android. I have the following code segment: import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; // ... XMLReader p = XMLReaderFactory.createXMLReader(); At the last line I get the following exception: Can't create default XMLReader; is system property org.xml.sax.driver set? When I was testing the code on desktop, it was working fine. Why am I getting this exception on Android and how can I fix it? Thx! I just ran into the same issue while porting some code to Android. I found

How to output a CDATA section from a Sax XmlHandler

依然范特西╮ 提交于 2019-12-01 05:02:49
问题 This is a followup question of How to encode characters from Oracle to Xml? In my environment here I use Java to serialize the result set to xml. I have no access to the output stream itself, only to a org.xml.sax.ContentHandler. When I try to output characters in a CDATA Section: It happens basically like this: xmlHandler.startElement(uri, lname, "column", attributes); String chars = "<![CDATA["+rs.getString(i)+"]]>"; xmlHandler.characters(chars.toCharArray(), 0, chars.length()); xmlHandler