stax

StAX Writer Implementation for C/C++

余生颓废 提交于 2019-12-01 15:10:25
Are there any other STaX Writer implementation for C/C++ except libxml2? LLamaXML Its one of the few C++ pull parsers. The article about STaX in Wikipedia mentiones Expat in the list of implementations. You can look at the Genx library. Qt has QXmlStreamWriter and QXmlStreamReader Irrlicht Engine contain IXMLWriter that use StAX model 来源: https://stackoverflow.com/questions/1693523/stax-writer-implementation-for-c-c

Error while parsing XML file with StAx

和自甴很熟 提交于 2019-12-01 14:24:29
问题 I wrote a xml parser with StAx that I use to parse XML streams received from the server.Here is my code : private Map<String, IUnitaryAction> parse(InputStream is) throws XMLStreamException { XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader reader = factory.createXMLStreamReader(is); boolean action = false; Map<String, IUnitaryAction> actionsMap = new HashMap<String, IUnitaryAction>(); while(reader.hasNext()){ int type = reader.next(); switch(type){ case

Unable to check CDATA in XML using XMLEventReader in Stax

限于喜欢 提交于 2019-12-01 12:17:29
I am unable to check for CDATA in XML and read it using XMLEventReader. The following is the sample: <name>HEADERS</name> <data> <![CDATA[ Sat Nov 19 18:50:15 2016 (1672822) ]]> <![CDATA[Sat, 19 Nov 2016 18:50:14 -0800 (PST) ]]> </data> The XMLEventReader of Stax api which i am using is as follows: while (eventReader.hasNext()) { XMLEvent event = eventReader.nextEvent(); if (event.isCharacters()) { System.out.println(event.asCharacters().isCData()); System.out.println(event.asCharacters().getData()); } } So,when I read the data tag for characters, I get false for event.asCharacters().isCData()

Java: IndentingXMLStreamWriter alternative?

依然范特西╮ 提交于 2019-12-01 04:07:13
I am using StAX to create a quite large xml document. Until now I was using the IndentingXMLStreamwriter class to get a well formatted document (see also this answer ). A few days ago we setup a jenkins server with an older jdk version (6.26), on which i get build errors. package com.sun.xml.internal.txw2.output does not exist I assume the package cannot be found because of the installed jdk version. For different reasons this cannot be changed (by the way, does anyone know the jdk version, at which this package (com.sun.xml.internal.txw2.output) was added?). Therefore I am looking for an

stax - get xml node as string

萝らか妹 提交于 2019-11-30 20:52:02
xml looks like so: <statements> <statement account="123"> ...stuff... </statement> <statement account="456"> ...stuff... </statement> </statements> I'm using stax to process one " <statement> " at a time and I got that working. I need to get that entire statement node as a string so I can create "123.xml" and "456.xml" or maybe even load it into a database table indexed by account. using this approach: http://www.devx.com/Java/Article/30298/1954 I'm looking to do something like this: String statementXml = staxXmlReader.getNodeByName("statement"); //load statementXml into database Why not just

How to Merge two XMLs in Java

拟墨画扇 提交于 2019-11-30 14:11:50
I am trying to merge two xmls in Java. I am using STaX API to write these XMLs. I searched a lot on internet on how to merge xmls but none seems as straight forward as C# . Is there any straight-forward way of doing this in Java using StAX? Probably xslt would not be the right solution since the file size can be big. File1.xml <TestCaseBlock> <TestCase TestCaseID="1"> <Step ExecutionTime="2011-03-29 12:08:31 EST"> <Status>Passed</Status> <Description>foo</Description> <Expected>foo should pass</Expected> <Actual>foo passed</Actual> </Step> </TestCase> </TestCaseBlock> File2.xml <TestCaseBlock>

integrating org.apache.poi and the javax.xml.stream.* package (stax-api) in android - how to set the --core-library argument in Android Studio?

不打扰是莪最后的温柔 提交于 2019-11-30 11:20:51
I'm using Android studio 1.5.1 I'd like to include the org.apache.poi-ooxml library in my android project. To include that library I needed to include some other library dependencies, among which the stax-api library. The problem with stax api is that it has all the packages in javax.* which is a "core library". Java jdk has all these libraries included, so if I were to use it in Java SE, I wouldn't need that stax-api library. Android, on the other hand, has a "partial" stax-api library. For android I only need the javax.xml.stream.* package. That means that I need to extract the stax-api,

Reading Huge XML File using StAX and XPath

两盒软妹~` 提交于 2019-11-30 08:59:04
The input file contains thousands of transactions in XML format which is around 10GB of size. The requirement is to pick each transaction XML based on the user input and send it to processing system. The sample content of the file <transactions> <txn id="1"> <name> product 1</name> <price>29.99</price> </txn> <txn id="2"> <name> product 2</name> <price>59.59</price> </txn> </transactions> The (technical)user is expected to give the input tag name like <txn> . We would like to provide this solution to be more generic. The file content might be different and users can give a XPath expression

stax - get xml node as string

。_饼干妹妹 提交于 2019-11-30 04:48:28
问题 xml looks like so: <statements> <statement account="123"> ...stuff... </statement> <statement account="456"> ...stuff... </statement> </statements> I'm using stax to process one " <statement> " at a time and I got that working. I need to get that entire statement node as a string so I can create "123.xml" and "456.xml" or maybe even load it into a database table indexed by account. using this approach: http://www.devx.com/Java/Article/30298/1954 I'm looking to do something like this: String

How to modify a huge XML file by StAX?

倖福魔咒の 提交于 2019-11-30 04:15:37
I have a huge XML (~2GB) and I need to add new Elements and modify the old ones. For example, I have: <books> <book>....</book> ... <book>....</book> </books> And want to get: <books> <book> <index></index> .... </book> ... <book> <index></index> .... </book> </books> I used the following code: XMLInputFactory inFactory = XMLInputFactory.newInstance(); XMLEventReader eventReader = inFactory.createXMLEventReader(new FileInputStream(file)); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(new FileWriter(file, true)); while