What is it ? The xPath allows us to select only a part of our document using a very similar … More
Tag: java
[JAVA] – How to use a StAX to parse a XML file ? You can get a list with all data.
What is it ? The StAX, which has a very similar operation with SAX. It is also based on events, … More
[JAVA] – How to use SAX to parse a XML file?
First you need implement the class where you will specify the attributes of your file. Look the code below. public … More
[JAVA] – How to validate a XML ?
For do this is easy : DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); factory.setAttribute(“http://java.sun.com/xml/jaxp/properties/schemaLanguage”, “http://www.w3.org/2001/XMLSchema”);
[JAVA] – How to read a XML file ?
Below is an example for do it. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(“src/products.xml”); NodeList … More
[JAVA] – CDI with beans and interceptors by examples
What is it ? The “Context and Dependency Injection for the Java EE platform” (CDI) is a specification that says … More
[Java] – Design Pattern : How to use ? With code examples and project for you understand
What is it ? Design pattern is an elegant solution to a problem that recurs. STRATEGY When ? The Strategy … More
[Java 8] – Good Card : Default methods, Lambdas, Optional
[Intellij IDEA] – Why don’t appear the option to create new java files ?
This happen because you need define the root directories of your application. Use to define the main directory : Use to define … More
[Java] – Treating Reflection Exceptions
We need take more care when we work with reflections because we can find the exceptions which we normally find … More