80 questions
1
vote
1
answer
44
views
How to serialize a list of Java Object to XML using javax.xml library with proper parent/child node names
I have a list called Documents that is comprised of different Document objects I created. I am trying to serialize the list to look like this:
<Documents>
<Document>
.
.
.
&...
1
vote
0
answers
259
views
How to solve the import in jdk17 version javax.mail. XML. The transform. The Source module conflic
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
...
0
votes
1
answer
79
views
Whitelist Java-Functions in XSLT-Processing?
I use javax.xml.transform.Transformer to process some XML-data with a custom developed XSLT document. In this xslt-document, I call a function from my packages. To do this, I need to set the secure-...
2
votes
0
answers
25
views
JAXP validation returns non-mandatory fields
I have a project whose main goal is to validate xml against xsd.
I use Java 1.8 from Adoptium and I initiate the SchemaFactory this way:
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI, &...
0
votes
0
answers
422
views
Migration from Java 1.4 to Java 17, how to handle deprecated or removed packages
We are migrating from Java 1.4 to Java 17, in our codes we are using javax.xml, javax.jws packages which were removed in Java11. We need to find an alternative for this. We don't use maven.
We are not ...
0
votes
1
answer
80
views
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"network")
My pojo:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Network", namespace = "urn:com.myproject.server.ws.dto.cfg")
@XmlType(name = "Network", namespace = ...
0
votes
0
answers
156
views
Missing requirement: org.eclipse.mylyn.commons.notifications.feed requires 'osgi.bundle; javax.xml.bind 2.2.0' but it could not be found
[ERROR] Missing requirement: org.eclipse.mylyn.commons.notifications.feed 1.17.2.v20200813-0821 requires 'osgi.bundle; javax.xml.bind 2.2.0' but it could not be found
I can see this javax.xml.bind ...
0
votes
1
answer
528
views
Get XML child node from parent node using XPATH java
I'm trying to get specific child node from list of nodes using xpath.
Here is my xml input
<root>
<Transaction>
<code> 123 </code>
<Reason> test1 </...
0
votes
1
answer
314
views
java.lang.NoClassDefFoundError: javax/xml/transform/TransformerConfigurationException
I am using dummy html string and trying to create the pdf from that...
once it tries to create ITextRenderer object, I am getting the "java.lang.NoClassDefFoundError: javax/xml/transform/...
1
vote
1
answer
100
views
FileSystemException when I try to move erroneous file
I am developing a function that is dedicated to reading XML files. When the reading is correct, the function will move the file to a folder called success, otherwise it will move it to a so-called ...
0
votes
0
answers
377
views
Getting errors related to java security-manager + ExpiringCache.java
We are using wildfly-9.01. I am getting error/caused while executing action:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 200
at java.io.ExpiringCache.cleanup(ExpiringCache.java:120)
...
0
votes
1
answer
762
views
DomParser - The entity name must immediately follow the '&' in the entity reference
I am trying to read an XML file which has & character. Due to this character we are getting "The entity name must immediately follow the '&' in the entity reference xml" error. I am ...
0
votes
2
answers
212
views
Can I validate XML from List<String> without writing to temp file?
I have XML in a List object that I need to validate against an XSD. So far, I've only been able to validate XML files. As of now, I'm writing my List to a temp file and validating that temp file. I'...
0
votes
1
answer
217
views
XML NodeList Java object showing null in Nashorn Javascript
I'm trying to read multiple matching values of an xpath expression from an xml file in an array in Nashorn Javascript. I'm using javax.xml.xpath classes inside Nashorn to parse xml data. I'm able to ...
3
votes
0
answers
360
views
Is there built in support for appending Handlers to the set HandlerResolver in JaxWsPortProxyFactoryBean?
I'm creating a JaxWsPortProxyFactoryBean instance and want to set a HandlerResolver on it to log requests.
@Bean(name="serviceName")
public JaxWsPortProxyFactoryBean serviceNameFactory() throws ...
1
vote
1
answer
1k
views
javax.xml.soap.MessageFactory.createMessage call takes too long for large content
The http response content is a soap message with a 100mb content.
messageFactory.createMessage(null, responseinputstream)
is taking 3 to 4 minutes, and the
responseSoapMessage.getSOAPBody()
takes ...
0
votes
0
answers
245
views
how to solve javax.xml.namespace is accessible from more than one module with jdk11
I have updated my java project from jdk8 to jdk 11 and I face the following error:
javax.xml.namespace is accessible from more than one module
0
votes
1
answer
90
views
Migrating MimeUnmarshaller code to Spring 5
I have legacy code that implements org.springframework.oxm.mimeMimeUnmarshaller:
import javax.xml.bind.attachment.AttachmentUnmarshaller;
import javax.xml.transform.Source;
import org.springframework....
1
vote
1
answer
945
views
Spring Boot 2.2 ClassNotFoundException com.sun.xml.ws.spi.ProviderImpl upgrading from Java 8 to 11 using fat jar
I'm upgrading from Java 8 to Java 11.
I'm using javax.ws packages so I had to include dependencies removed in Java 11.
<dependency>
<groupId>jakarta.xml.ws</...
5
votes
1
answer
5k
views
Apache Axis 1.4 on Java 12
I am currently trying to migrate from a Java 8 project to Java 12. (Hopefully) the last hurdle is an old WebService we are forced to use. Using the WebService 'as is' in Java 8 per se is not a problem,...
0
votes
0
answers
1k
views
java.util.MissingResourceException: Can't find com.sun.xml.internal.messaging.saaj.soap.LocalStrings bundle
I'm trying to run my app via sbt run but I get the following error when creating new Service (javax.xml.ws.Service):
Uncaught error from thread [default-akka.actor.default-dispatcher-3]: null, ...
1
vote
1
answer
2k
views
is to possible to have generic method in java with multiple optional parameters
My understanding is this ask of mine is NOT possible in a straight forward way. but I want to find a solution that works.
Here is how I get an Iterable for NamedNodeMap(javax package);
private ...
1
vote
2
answers
2k
views
XML validation against schema fails in Java with namespace
I need to write Java code that validates XML against a schema. The validation fails for some reason I don't understand, giving the following exception:
org.xml.sax.SAXParseException; cvc-elt.1: ...
2
votes
1
answer
3k
views
Unable to instantiate SOAP Client - Failing with NullPointerException
While instantiating a SOAP client, I get NullPointerException
@WebServiceClient(name = "QWEServiceManager", targetNamespace = "http://external.ws.services.abc.com/", wsdlLocation = "file:/C:/Users/...
0
votes
1
answer
836
views
Adding logging to soap web service
I would like to log my request and response.
I found a very easy solution to do so by changing the properties recommended here:
Tracing XML request/responses with JAX-WS
My problem is, that I do not ...
0
votes
1
answer
1k
views
How to use javax.xml.bind to write XML to POJO with xmlns field?
This is an example xml object like what I get from my API call:
<?xml version="1.0" ?>
<sourceSets>
<sourceSet>
<sourceSetIdentifier>1055491</...
1
vote
1
answer
2k
views
Unable to display tree view in parameterized Java Mapping in SAP PI 7.5
I am working on parameterized java mapping. While testing in Operation Mapping it gives us error:
Unable to display tree view; Error when parsing an XML document (Premature end of file.)
And the ...
0
votes
0
answers
444
views
GWT 2.8.2 not compiling javax.xml.bind.annotation anymore [duplicate]
I am using javax.xml.bind in my entities for xml serialization and it compiled fine until gwt 2.8.1, but with 2.8.2 version, the compiler fails at annotations like javax.xml.bind.annotation....
15
votes
6
answers
49k
views
JDK 10 cannot import javax.xml.namespace in Eclipse
It's very strange. I am moving a dynamic web project from Java 8 to Java 10.
The last thing I cannot get the dependency resolved is the javax.xml.namespace.QName class.
You can see in the attached ...
0
votes
1
answer
2k
views
Java Transformer Empty Element
I wrote a program (I'm using JDK 11) to format an XML string; however, I want my program to contract empty elements. For example: <element></element> should become <element/>. I have ...
0
votes
0
answers
104
views
Cannot Deseralise to Concrete Java Type
I'm building a fitness tracker application which allows a user to track their workouts. A workout is comprised of a list of movements. The abstract Movement class is extended by several subtypes of ...
0
votes
1
answer
274
views
jaxb XML, not throwing exception when XML's integer value is > Java Long's Max Value
Say I'm trying to unmarshal an XML file with an integer field (xs:integer):
13131546456131653154156415616
This value is > Java Long's max value.
I was hoping to get and catch an exception when Jaxb ...
0
votes
1
answer
148
views
finding node number in NodeList while passing multiple xpaths in Java
I am using javax.xml.xpath.XPath package to find nodes present in XML.
Code finds values and return NodeList
NodeList nodes = (NodeList) xPath.compile("/books/book/category[1] | /books/book/...
0
votes
0
answers
2k
views
Eclipse giving java.lang.AbstractMethodError for DocumentBuilderFactory.setFeature [duplicate]
I am trying to run junit for a maven project but I am not able to proceed as I am getting the error
java.lang.AbstractMethodError:
javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/...
2
votes
1
answer
886
views
How to provide a utility on XSLT while maintaining security
I would like the ability to provide an escape utility that can be used in an XSL Stylesheet. For example:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
...
0
votes
0
answers
312
views
Is there a way to get the element name from the SAXParseException message while validation an XML file? [duplicate]
The SAXParseException message is:
org.xml.sax.SAXParseException; systemId: file:///home/IdeaProjects/RGAME/FullPHSHuman.xml; lineNumber: 8; columnNumber: 11; cvc-complex-type.2.4.a: Invalid content ...
0
votes
1
answer
2k
views
While validating against XSD, find the exact missing element in the XML using any of DOM, StAX, SAX parsers
I have a XML file and its corresponding XSD file. While validating using StAX parser, I've attached an error handler. Basically, I encounter two types of errors in a well-formed XML file.
1) ...
2
votes
1
answer
12k
views
Where did javax.xml.bind go in Java 9? [duplicate]
I tried migrating my project from JDK 1.8 to Java 9, but it wouldn't compile. My project uses a lot of javax.xml.bind.annotation classes and it seems they are missing. Were they moved somewhere or ...
0
votes
1
answer
244
views
Is it possible to get the XPATH query string from XPathExpression?
An XPath query is compiled into an XPathExpression, which can then be evaluted on document. Suppose if i have hold of only all the compiled expressions, is it possible to know what are the respective ...
1
vote
1
answer
72
views
XPath - Java XPath result unexpected
I have noticed something strange. This is my XML
<Items>
<Item>
<Name>A</Name>
<Amount>0.0012</Amount>
<Quantity>17</Quantity&...
0
votes
1
answer
4k
views
How to change XML SOAP envelop by using JAVA library?
I have used javax.xml.soap library to invoke soap request and response. I have wsdl endpoint url which works fine in SOAP-UI. I need to validate the same using java, and I created a soap request which ...
0
votes
2
answers
399
views
XSLT math:min() on list does not work while sorting does
I want to get the code for the medias node with the lowest index. The source XML looks similar to this:
<item>
<medias>
<index>999997</index>
<code>...
5
votes
1
answer
5k
views
Java XML - after removing a node - white space line remains - how to remove?
I'm working with javax.xml & After removing some node:
docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilder = docBuilderFactory.newDocumentBuilder();
document = docBuilder.parse(...
0
votes
2
answers
3k
views
ParserConfigurationException with javax.xml.parsers on Android
I'm trying to use javax.xml.parsers on Android but I always get a ParserConfigurationException when trying to set these two features :
factory.setFeature("http://apache.org/xml/features/nonvalidating/...
0
votes
1
answer
968
views
How to create child tag using JaxB annotations? [duplicate]
I need to create XML export from my java models using Jaxb annotations.
What I need is the following xml in which is parent entity which contains multiple entities which should be as a child tree of ...
0
votes
1
answer
1k
views
XPath expression for javax.xml.xpath not working
I want to extract the contents from this website: https://it.projektwerk.com/de/projects/
e.g. I have an XPath expression: .//*[@id='content_0']/H3/A
(Note that the uppercase letters are correct, as ...
0
votes
2
answers
3k
views
parse method in DocumentBuilder is returning an error
I am trying to use the parse method that takes an InputSource to parse a DocumentBuilder instance.
The error is:
The method parse(InputStream) in the type DocumentBuilder is not
applicable for ...
0
votes
1
answer
1k
views
Multiple elements with the same type but different name?
Is there any way to assign different names to the same type when using @XmlElements? I started off with just using @XmlElement. Did some reading and found @XmlElementWrapper and the @XmlElements but ...
0
votes
0
answers
944
views
How to read child nodes of a specific parent node when there are multiple parent nodes with same name
I have an XML of the following format:
<Root>
<Delivery deliveryID="01">
<Product productID="001">
<name>test</name>
</Product>
...
1
vote
1
answer
1k
views
How to use javax.xml.transform.stax in Android Studio?
I'm running into a strange problem in Android Studio. I'm also using latest JDK. I can't seem to import the following :
javax.xml.stream
javax.xml.transform.stax
They both are unavailable and I don'...