这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions jaxb/src/main/resources/global.xjb

This file was deleted.

16 changes: 4 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@
<module>javax-sound</module>
<module>javaxval</module>
<module>javaxval-2</module>
<module>jaxb</module>
<module>jetbrains</module>
<module>jgit</module>
<module>jmh</module>
Expand Down Expand Up @@ -762,7 +761,7 @@
<module>spring-actuator</module>
<module>spring-ai</module>
<module>spring-ai-2</module>
<module>spring-ai-3</module>
<module>spring-ai-3</module>
<module>spring-aop</module>
<module>spring-aop-2</module>
<module>spring-batch</module>
Expand Down Expand Up @@ -826,10 +825,7 @@
<module>vertx-modules</module>
<module>web-modules</module>
<module>webrtc</module>
<module>xml</module>
<module>xml-2</module>
<module>xml-3</module>
<module>xstream</module>
<module>xml-modules</module>
</modules>

<properties>
Expand Down Expand Up @@ -1104,7 +1100,6 @@
<module>javax-sound</module>
<module>javaxval</module>
<module>javaxval-2</module>
<module>jaxb</module>
<module>jetbrains</module>
<module>jgit</module>
<module>jmh</module>
Expand Down Expand Up @@ -1193,7 +1188,7 @@
<module>spring-actuator</module>
<module>spring-ai</module>
<module>spring-ai-2</module>
<module>spring-ai-3</module>
<module>spring-ai-3</module>
<module>spring-aop</module>
<module>spring-aop-2</module>
<module>spring-batch</module>
Expand Down Expand Up @@ -1257,10 +1252,7 @@
<module>vertx-modules</module>
<module>web-modules</module>
<module>webrtc</module>
<module>xml</module>
<module>xml-2</module>
<module>xml-3</module>
<module>xstream</module>
<module>xml-modules</module>
</modules>

<properties>
Expand Down
6 changes: 3 additions & 3 deletions jaxb/pom.xml → xml-modules/jaxb/pom.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>jaxb</artifactId>
<name>jaxb</name>

<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<artifactId>xml-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

Expand Down
24 changes: 24 additions & 0 deletions xml-modules/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>xml-modules</artifactId>
<packaging>pom</packaging>
<name>xml-modules</name>

<parent>
<artifactId>parent-modules</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<modules>
<module>jaxb</module>
<module>xml</module>
<module>xml-2</module>
<module>xml-3</module>
<module>xstream</module>
</modules>

</project>
File renamed without changes.
2 changes: 1 addition & 1 deletion xml-2/pom.xml → xml-modules/xml-2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<artifactId>xml-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
package com.baeldung.xml.xml2document;
import org.junit.Test;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.StringReader;
import static org.junit.Assert.assertEquals;
public class XMLStringToDocumentObjectUnitTest {
@Test
public void givenValidXMLString_whenParsing_thenDocumentIsCorrect() throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
String xmlString = "<root><element>XML Parsing Example</element></root>";
InputSource is = new InputSource(new StringReader(xmlString));
Document xmlDoc = null;
try {
xmlDoc = builder.parse(is);
} catch (SAXException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
assertEquals("root", xmlDoc.getDocumentElement().getNodeName());
assertEquals("element", xmlDoc.getDocumentElement().getElementsByTagName("element").item(0).getNodeName());
assertEquals("XML Parsing Example", xmlDoc.getDocumentElement().getElementsByTagName("element").item(0).getTextContent());
}
}
package com.baeldung.xml.xml2document;

import org.junit.Test;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import java.io.IOException;
import java.io.StringReader;

import static org.junit.Assert.assertEquals;

public class XMLStringToDocumentObjectUnitTest {
@Test
public void givenValidXMLString_whenParsing_thenDocumentIsCorrect() throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
String xmlString = "<root><element>XML Parsing Example</element></root>";
InputSource is = new InputSource(new StringReader(xmlString));
Document xmlDoc = null;
try {
xmlDoc = builder.parse(is);
} catch (SAXException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}

assertEquals("root", xmlDoc.getDocumentElement().getNodeName());
assertEquals("element", xmlDoc.getDocumentElement().getElementsByTagName("element").item(0).getNodeName());
assertEquals("XML Parsing Example", xmlDoc.getDocumentElement().getElementsByTagName("element").item(0).getTextContent());
}
}
70 changes: 35 additions & 35 deletions xml-3/pom.xml → xml-modules/xml-3/pom.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>xml-3</artifactId>
<version>0.1-SNAPSHOT</version>
<name>xml-3</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<build>
<finalName>xml-3</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>xml-3</artifactId>
<version>0.1-SNAPSHOT</version>
<name>xml-3</name>

<parent>
<groupId>com.baeldung</groupId>
<artifactId>xml-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<build>
<finalName>xml-3</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Loading