936 questions
0
votes
2
answers
126
views
Parsing UTF-8 XML using DefaultHandler: when / how does it become UTF-16 in Java?
I have a Java program that was working perfectly in Corretto 17, but is now having character set encoding issues in Corretto 25.
I am reading a UTF-8 encoded XML from an external API. The code is ...
1
vote
2
answers
104
views
SAX XML API program on IBM i ends prematurely after ~889570 records with no error — how to debug and trap errors?
I'm working with an RPGLE program on IBM i (AS/400) that uses the QxmlSAXParser_parse_systemid() API to parse large XML files stored in the IFS.
🔧 Environment:
IBM i v7.3
RPGLE (ILE), compiled with ...
0
votes
1
answer
22
views
Android SAXParserFacotry.newInstance() Throws Exception when Minify Enabled
I enabled Minify in my release for SDK 15 as a target and now some installs get a failure:
Exception q1.b:
at javax.xml.parsers.FactoryFinder.newInstance (FactoryFinder.java:200)
at javax.xml....
0
votes
0
answers
32
views
Spring integration - custom ISOEntities inject
I'm using spring integration for execute xml element extraction:
<bean id="myDmTypeXPathExpression" class="org.springframework.xml.xpath.XPathExpressionFactoryBean">
<...
0
votes
0
answers
75
views
Distinguishing whole closing tag ("</tag>") and self-closing tag ("<tag ... />") in SAX endElement [duplicate]
I extended org.xml.sax.helpers.DefaultHandler. When during the parsing an element closes and my endElement callback executes, I would like to be able to tell whether in the XML the element is closed ...
0
votes
1
answer
41
views
How to get node outside loop while using sax parser
I need to parse document using SAX parser in java. I was able to print all the node values if I use DefaultHandler class traditionally implementing the startElement, endElement and characters method. ...
1
vote
0
answers
470
views
javax SchemaFactory disable access to external entities not recognized
I am using javax SchemaFactory to parse an XML file. I get a SonarLint warning "Disable access to external entities in XML parsing.". The warning goes away when adding two properties "...
0
votes
0
answers
65
views
Saxon 10 by default considering given input parameter as a string
I have updated Saxon from version9 to version10. But for the same Xsl code getting different result.
In Saxon10 by default its considering input parameter as string, But in Saxon9 its considering ...
2
votes
1
answer
2k
views
Java 17 migration, JEP-403 and Xerces - properties ACCESS_EXTERNAL_DTD and ACCESS_EXTERNAL_SCHEMA not supported
Whilst migrating to Java 17, I tried to include an external Xerces dependency, following the JEP-403 recommendation. JEP-403 explicitly states the following under "Risks and Assumptions":
&...
0
votes
1
answer
129
views
JAXB + SAX + Open JDK 8 Getting Connection Reset by Client Exception
My code downloads XML report from net and assigns the raw XML to a String variable. It then creates a SAXPaser like so:
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
...
2
votes
1
answer
133
views
Xml Reader parsing character outside BMP to surrogate pairs which results in invalid xml
I am trying to parse an xml which contains hex value of 𝓅. This represents the mathematical symbol 𝓅. The output that I am getting is ��.
What am I doing wrong?
...
3
votes
1
answer
328
views
SAXParser returns wrong characters
I currently analyze an issue where an additionally character appears in the data provided by the characters() method called from SAXParser. This happens on a huge file (> 800MB) and the data in the ...
0
votes
1
answer
62
views
unescape userdefined entities from xml
There have some userdefined entities in the input xml like &key; and ‐.
We have defined these entites as DOCTYPE in the below xsl:-
<!DOCTYPE xsl:stylesheet [
<!ENTITY key "&...
0
votes
1
answer
43
views
converting entities only at some specific places in xml
Following code unescapes the entities from xml:-
<xsl:stylesheet version='3.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="xml" omit-xml-declaration=&...
0
votes
2
answers
61
views
entity translation to customized entity
There are some user defined entites in the xml data. In order to unescape those entities, we are using below code:-
<xsl:stylesheet version='3.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' &...
0
votes
1
answer
77
views
character attribute must be a single XML character error while unescaping some entities
There are some user defined entites in the xml data. In order to unescape those entities, we are using entity reference in the DOCTYPE mentioned in the below code:-
<!DOCTYPE xsl:stylesheet [
<!...
0
votes
1
answer
52
views
Unescape some entities during xsl transformation
We have done an xsl transformation to convert hexcode values into entities.
Now after transformation, there are some entites which are converting into their corresponding values like & gets ...
1
vote
2
answers
132
views
XML tags missing or skipped during xsl transformation
We are performing an xsl transformation to convert hexcode entity to mdash. We also have converted all & in xml to output as &.
This transformation happens as expected, but along with that ...
0
votes
1
answer
136
views
converting `&` to `&` using xsl transformation but an error is thrown as "et.sf.saxon.event.NoOpenStartTagException: "
We are using an XSL transformer to convert hexcode entity to mdash. This transformation happens as expected.
But we also have to convert all & in xml to output as &.
Right now, the output ...
0
votes
2
answers
402
views
Parsing xsl error- javax.xml.transform.TransformerException: use-character-maps attribute is not allowed on the xsl:output element
While parsing one of the XML files using XML Serializer in Java, the HTML entities are converted into their corresponding hex code values(like for mdash output is "hexcode value-#x2014;") ...
1
vote
0
answers
175
views
How can one parse whole XML documents using the LXML Sax module?
I have a script that goes through a directory with many XML files and extracts or adds information to these files. I use XPath to identify the elements of interest.
The relevant piece of code is this:
...
1
vote
0
answers
482
views
Java XML validation against XSD fails at first error does not validate complete XML even with custom error handler
Is there a way I can validate my XML against my XSD COMPLETELY, meaning that I want the file to continue validating even after it has found an error so I can get the complete error messages rather ...
0
votes
1
answer
398
views
How to escape XML special characters in python SAX parser?
I'm trying to parse a large XML document and extract the <Text> tag content only.
XML document:
<?xml version="1.0" encoding="UTF-8"?>
<EchoroukonlineData>
<...
0
votes
1
answer
306
views
Java SaxParser Schema Validation: results in SAXParseException; lineNumber: 46; Cannot resolve the name
I have an XSD that internally calls many other XSD files. I have added all the relevant files to my src/main/java/resources folder. Now I am trying to read these schema files by calling the rootSchema ...
0
votes
1
answer
385
views
SAXParser gives FileNotFoundException for XML file
My Java application gives a FileNotFoundException when trying to parse
an XML file with the SAXParser class. The stack trace is:
java.base/java.io.FileInputStream.open0(Native Method),
java....
0
votes
1
answer
243
views
How to get the values of child nodes in JDOM
I am trying to get a value by parsing an XML document using the JDOM library.
I want to get the values of the driverJar tags, which are child nodes based on the driverJars tag, but I can't get the ...
0
votes
2
answers
292
views
Sax Parser preserve space in content
I have a file xml like this
<?xml version="1.0" encoding="UTF-8"?>
<main>
<tagA>190</tagA>
<tagB> : </tagB>
<tagc>2019-07-02&...
0
votes
1
answer
83
views
Java SaxParser XML
this is my first question here. do not judge strictly:) I'm parsing a file with the dim extension of the xml format, in fact, so I chose SAXparser. the problem is probably architectural or I don’t ...
0
votes
1
answer
183
views
saxparser java xml file with null element
I am trying to parse an xml files using SAxparser. Everything works fine except the cases when an element tag in xml file contains null value. For example below xml element
<QuotaCode>
<null/&...
0
votes
1
answer
210
views
Validating XML with RelaxNG and SAX
I am trying to parse and validate an XML file against an RelaxNG schema using SAX. I have the following code:
System.setProperty(SchemaFactory.class.getName() + ":" + XMLConstants....
0
votes
1
answer
485
views
Is there a generic way of reading complex XML using SaxParser?
I am using SaxParser to read the large complex XML file. I do not wish to create the model class as I do not know the exact data which will be coming in the XML so I am trying to find if there is a ...
2
votes
1
answer
2k
views
How to parse whole XML document using SAX parser in Java
So Im pretty new to Java coming from C#! They are pretty similar programming languages, so im getting a hang of it quickly, but there is a problem I have been battling with for a while, that I hope ...
0
votes
1
answer
311
views
Smooks : return an OutputStream
I am currently writing a JAVA application that will input an EDI file and return an OutputStream using Smooks library for this purpose. I am struggling to return the output stream and use it without ...
0
votes
1
answer
151
views
How can I skip element with error in SAXParser
I want to skip the node which contains an error. I use SAXParser
Example XML:
<file>
<person>
<id>1
<name>Jhon</name>
</person>
<person>
<id>2</id>...
0
votes
1
answer
514
views
How to resolve unmarshalling error after JBOSS EAP server migration from 6.4 to 7.4.3?
I am trying to migrate my application server (JBOSS EAP) from 6.4 to 7.4.3. But, after migration I am getting the below error while hitting my webservices.
Unwinding now: org.apache.cxf.interceptor....
0
votes
0
answers
127
views
No alloc c xml parser
Is there a c xml parser that does not allocate any memory and just returns ptr and size in original buffer (aka token parser)?
I'm trying out libxml2 and I was trying but it does allocate every string....
2
votes
1
answer
4k
views
JOLT transformation modify overwrite - replace element value in array
I am working on JOLT library to perform a change to the json values.
For key-value items I found a solution using
"operation": "modify-overwrite-beta"
But when it comes to edit ...
0
votes
1
answer
79
views
Cannot find the declaration of element -SOAP
Document document = null;
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
document = parser.paser(xmlFilePath);
ParseException
SaxException
IOException
returned ...
1
vote
2
answers
89
views
XPath - XML document nodes selection problem
Need help with XPATH.
I use this library jcabi (see samples) to process XML document. I'm facing a problem (all nodes named "member" are retrived, I just want the first level of "member&...
0
votes
2
answers
1k
views
What do Public Identifier, System Identifier, and Base system identifier refer to in XML?
The Xerces2-j XMLInputSource, and also SAX InputSource, refer to public and system identifiers. Xerces2-J XMLInputSource also refers to a base system identifier.
What do these identifiers represent?
...
0
votes
1
answer
194
views
<mergeCell> dont exist after parsing, even though there are merge cells in xlsx file
I'm using apache.poi to read .xlsx and .xlsm files in java.
I started stucking with the familiar problem XSSFWorkbook wb = XSSFWorkbookFactory.createWorkbook(pkg) which takes several minutes to load ...
0
votes
0
answers
62
views
to parse small document which xml parser is recomended in java
to parse small xml document or small xml string which xml parser is recomended in java.
I have to get attribute from a xml tag. For that I need to parse a xml string. The string is small it has 4 tags ...
0
votes
1
answer
542
views
How to read nested xml element with saxparser in Java
Please could You help me to resole problem I meet during exploring saxparser.
my xml file
<row>
<PSC>10000</PSC>
<NAZEV>Praha 10</NAZEV>
<ADRESA>...
1
vote
0
answers
133
views
How to add a namespace to the root element with SAX parsing in Java
when using SAX validated parsing, checking an XML document against an XML schema, the errororg.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 95; The prefix "SOMEPREFIX" for ...
1
vote
1
answer
911
views
Retrieving child Node value based on Parent Node attribute using DOM parser
I have XML content as below
<PARENT1 ATTR="FILE1">
<TITLE>test1.pdf</TITLE>
</PARENT1>
<PARENT2 ATTR="FILE2">
<TITLE>test2.pdf</TITLE>
...
-2
votes
1
answer
191
views
SaxParser issue with < character
I'm parsing an xml file with saxParser on java.
My problem is that I have some rows like this:
<name xml:lang="en">Particulates, < 2.5 um</name>
I don't report all the code ...
0
votes
2
answers
2k
views
InputSource to String Conversion in JAVA
I have created InputSource object using my entire string xml request in my application and I am trying to fetch entire xml request from the created InputSource reference. Please find below code ...
0
votes
1
answer
62
views
SAX Parser does not display multiple identical tags
Previously, I was able to display the data of one tag, but this time not several values are displayed, but only one.
This my parser code:
public class Runner {
public static void main(String[] args) ...
0
votes
1
answer
882
views
Jackson Streaming API throws "Can not write a field name, expecting a value" error even though everything is correct
I am trying to convert the XML to JSON using Jackson Streaming API. The input XML file can be very large so I am using SAX PARSER to parse the XML and JACKSON STREAMING API to convert it to JSON on ...
1
vote
0
answers
128
views
How to provide internationalization to SAXParseException since JPMS in java 9
I'm trying to provide internationalization to SAXParseException messages in Java 11.
I found few solutions e.g. link that worked before introduction of JPMS in Java 9. Now (j11) those new bundles e.g....