[go: up one dir, main page]

CN103699376A - SAX (Simple Api For Xml) parse error solving method based on android platform - Google Patents

SAX (Simple Api For Xml) parse error solving method based on android platform Download PDF

Info

Publication number
CN103699376A
CN103699376A CN201310636230.2A CN201310636230A CN103699376A CN 103699376 A CN103699376 A CN 103699376A CN 201310636230 A CN201310636230 A CN 201310636230A CN 103699376 A CN103699376 A CN 103699376A
Authority
CN
China
Prior art keywords
xml
sax
android platform
parse error
values
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310636230.2A
Other languages
Chinese (zh)
Inventor
顾微微
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haiersoft Co Ltd
Original Assignee
Qingdao Haiersoft Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haiersoft Co Ltd filed Critical Qingdao Haiersoft Co Ltd
Priority to CN201310636230.2A priority Critical patent/CN103699376A/en
Publication of CN103699376A publication Critical patent/CN103699376A/en
Pending legal-status Critical Current

Links

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

The invention provides an SAX (Simple API for XML) parse error solving method based on an android platform. The method is characterized by comprising the following steps: (a) allocating a storage unit for the value of each element of XML data; (b) eliminating the values in the storage units of the step (a); (c) starting XML document resolving; (d) splicing the values of the elements which conform to labels and storing the values into the corresponding storage units in the step (a), wherein the splicing operation is not performed in the prior art; (e) when meeting a label which indicates that a section of attribute is over, emptying the storage units in the step (a) for the next treatment. The method provided by the invention has the following advantages that the problem that the XML data can not be completely resolved by use of the SAX in an application development process under the android platform, and a developer can obtain complete data from the XML data by utilizing the method provided by the invention.

Description

Based on android platform SAX parse error way to solve the problem
Technical field
The present invention relates to a kind of based on android platform SAX parse error way to solve the problem, be applicable to Android system application development field, if relate to the parsing of XML file in application development process, it is a kind of mode that SAX resolves, in resolving, may run into the situation of parse error, this technology is obtained the problem that label data is incomplete when resolving a kind of technical solution scheme is provided.
Background technology
XML is one group of standard that W3C formulates, and is used for defined label language, and its major advantage is extensibility, from it birth till now, obtained people and supported widely and apply.
The parsing of so-called XML file refers to: representing that a structureless character string of XML document is converted to the process of the structural components that meets XML grammer.
SAX(Simple API for XML) XML simple application routine interface is that a public XML document based on event is resolved standard.It usings event as the pattern of analyzing XML file, and it changes into a series of event by XML file, by different event handlers, is decided and how to be processed.
The principle of work of SAX is briefly carried out sequential scanning to document exactly, when scanning the local time notification events such as document (document) beginning and end, element (element) beginning and end, document (document) end, process function, by event handling function, do corresponding actions, then continue same scanning, until document finishes.
SAX is the resolver that a kind of committed memory is few and resolution speed is fast, what it adopted is that event starts, it does not need to resolve complete document, but see according to content order whether certain part of document meets xml grammer, if meet and just trigger corresponding event, so-called event is exactly a little callback methods (callback), and these methods are defined in ContentHandler.Its main method below:
StartDocument: just trigger this event and call this method and can do therein a little pre-service work when running into document.
StartElement:(String namespaceURI, String localName, String qName, Attributes atts) when meeting beginning label, will trigger this method.
EndElement(String uri, String localName, String name): when running into end-tag, trigger this event, call this method and can do a little aftermaths.
Charachers (char [] ch, int start, int length): trigger this method when running into xml content, can accept content with new String (ch, start, length).
……。
Generally, resolving is above no problem, resolves and can correctly carry out.But occasional makes a mistake, generally all think that SAX resolving is roughly as follows:
startDocument -> startElement ->?characters?->?endElement?->?endDocument;
Does startElement read start-tag, and endElement reads end-tag, characters? be to read its value, this is quite right, but generally all thinks characters Exactly-once, and has once just read full content.Wrong just wrong at this!
Characters probably can carry out repeatedly, resolving <url>http: during //img7.ph.126.net/xthf6CciOopDhbEj2nPB3A==/6598208860702643437.jpg</url>, just once found that characters had carried out twice, content " http://img7.ph.126.net/xthf6CciOopDhbEj2nPB3A==/6598208860702643437.jpg " is read at twice, with the net result of that mode above, be exactly url=http://img7.ph.126.net/xthf6CciOopDhbEj2nPB3A==/6598, while using this URL address to read picture in that application, will make mistakes.
Summary of the invention
The object of the invention is to provide a kind of based on android platform SAX parse error way to solve the problem, is to solve the infull problem of resolution data of using SAX analyzing XML to run in android platform application.
Technical scheme of the present invention is: take intelligent operating system android as basis, take SAX as analyzing XML technical approach.The whole thinking that solves is that the data after the parsing of XML are carried out to corresponding correct splicing, thereby makes the data integrity after parsing.
Advantage of the present invention is: under the android platform of having determined, in application development process, use the infull problem of SAX analyzing XML data, make developer can use the present invention from XML data, to obtain complete data.
Embodiment
Embodiment 1: one of implementation method of the present invention comprises the following steps:
(a) give the value memory allocated unit of each element of xml data;
(b) value of storage unit in emptying step (a);
(c) XML document is resolved and is started;
(d) value that meets the element of label spliced and store in the corresponding stored unit in step (a) (prior art is the operation to splicing not) into;
(e), while running into the label that one section of attribute of sign finishes, the storage unit in step (a) is emptied, in order to process next time.

Claims (1)

1. based on an android platform SAX parse error way to solve the problem, it is characterized in that, comprise the following steps:
(a) give the value memory allocated unit of each element of xml data;
(b) value of storage unit in emptying step (a);
(c) XML document is resolved and is started;
(d) value that meets the element of label spliced and store in the corresponding stored unit in step (a);
(e), while running into the label that one section of attribute of sign finishes, the storage unit in step (a) is emptied, in order to process next time.
CN201310636230.2A 2013-12-03 2013-12-03 SAX (Simple Api For Xml) parse error solving method based on android platform Pending CN103699376A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310636230.2A CN103699376A (en) 2013-12-03 2013-12-03 SAX (Simple Api For Xml) parse error solving method based on android platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310636230.2A CN103699376A (en) 2013-12-03 2013-12-03 SAX (Simple Api For Xml) parse error solving method based on android platform

Publications (1)

Publication Number Publication Date
CN103699376A true CN103699376A (en) 2014-04-02

Family

ID=50360915

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310636230.2A Pending CN103699376A (en) 2013-12-03 2013-12-03 SAX (Simple Api For Xml) parse error solving method based on android platform

Country Status (1)

Country Link
CN (1) CN103699376A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115878851A (en) * 2022-11-30 2023-03-31 优视科技(中国)有限公司 A method, device, electronic equipment and storage medium for editing XML files

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2419311A1 (en) * 2003-02-20 2004-08-20 Ibm Canada Limited - Ibm Canada Limitee Mapping between native data type instances
CN103902272A (en) * 2012-12-30 2014-07-02 青岛海尔软件有限公司 Method for parsing XML (extensive markup language) error problems based on android platform SAX (simple API for XML)

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2419311A1 (en) * 2003-02-20 2004-08-20 Ibm Canada Limited - Ibm Canada Limitee Mapping between native data type instances
CN103902272A (en) * 2012-12-30 2014-07-02 青岛海尔软件有限公司 Method for parsing XML (extensive markup language) error problems based on android platform SAX (simple API for XML)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115878851A (en) * 2022-11-30 2023-03-31 优视科技(中国)有限公司 A method, device, electronic equipment and storage medium for editing XML files

Similar Documents

Publication Publication Date Title
WO2015096267A1 (en) Method and apparatus for code conversion
US10678994B2 (en) Method and system for reusing HTML content
CA2690081A1 (en) Migration of legacy applications
CN112579466B (en) Method and device for generating test cases and computer readable storage medium
US20120296646A1 (en) Multi-mode text input
CN104699714A (en) Method and device for transferring files of book edition format into files of EPUB format
CN110347390B (en) Method, storage medium, equipment and system for rapidly generating WEB page
CN113467781B (en) Method, device and equipment for determining redundant file
CN102214244A (en) Analytic method and system for docx file information
US11281854B2 (en) Limiting a dictionary used by a natural language model to summarize a document
WO2012041672A1 (en) Finding partition boundaries for parallel processing of markup language documents
CN109933385B (en) A page loading method, device, system and medium
CN115563146A (en) Data blood margin analysis method and device
CN110688823A (en) XML file verification method and device
CN108446115A (en) A kind of method and device of code reuse
US9529781B2 (en) Apparatus and method for document format conversion
CN103902272A (en) Method for parsing XML (extensive markup language) error problems based on android platform SAX (simple API for XML)
CN111611788B (en) Data processing method and device, electronic equipment and storage medium
CN113435217A (en) Language test processing method, device and electronic equipment
US8250115B2 (en) Method, apparatus and software for processing data encoded as one or more data elements in a data format
CN103699376A (en) SAX (Simple Api For Xml) parse error solving method based on android platform
IL192265A (en) Automatic package conformance validation
CN106293862B (en) A kind of analysis method and device of expandable mark language XML data
US20100011283A1 (en) Minimizing the copying of an extensible markup language (xml) tree when referencing tree nodes during extensible stylesheet language transformations (xslt) processing
CN107203405A (en) A kind of method and apparatus for checking multilingual definition

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20140402