Compare commits

...

24 Commits
log ... main

Author SHA1 Message Date
50f52d5128 Merge pull request 'update config for IJ' (#48) from xml-2 into main
Reviewed-on: #48

Code merged
2025-04-30 18:19:25 +00:00
c6a8551a8c
Update pom.xml file for part of main project 2025-04-30 14:18:30 -04:00
e9811c372a
update config for IJ 2025-04-30 14:12:00 -04:00
2787b93bbf Merge pull request 'xml-2 版本初始化提交' (#47) from xml-2 into main
Reviewed-on: #47
2025-04-30 15:53:52 +00:00
4930100f9a change package name 2025-04-29 18:20:58 -04:00
e7c98a9429 Merge from remote 2025-04-29 18:13:27 -04:00
7e8ba52517 Merge from remote 2025-04-29 18:13:05 -04:00
b5e8a5ec3a Merge pull request 'Update versions for slf4j' (#46) from xml into main
Reviewed-on: #46
2025-04-29 16:40:30 +00:00
7678784eda
Update versions 2025-04-29 10:59:28 -04:00
07e6111a73 Merge pull request 'xml 项目添加' (#45) from xml into main
Reviewed-on: #45
2025-04-29 14:52:50 +00:00
df92665db0
Add xml-2 package to project 2025-04-29 10:51:40 -04:00
bcbd0bbd49
Update code for xml-2 2025-04-29 08:22:24 -04:00
b13d0c4d9c
Change LIC version to 2015 2025-04-29 08:18:01 -04:00
e928c2afbc Merge pull request '添加 lucene 项目' (#44) from ethereum into main
Reviewed-on: #44

升级版本的讨论:https://www.isharkfly.com/t/lucene-8-0-0/15924
2025-04-25 19:45:23 +00:00
8cba34008b
解决包升级的冲突,升级到 8.0.0 版本 2025-04-25 15:42:30 -04:00
f50bccce9d
解决包升级的冲突,升级到 7.73 版本 2025-04-25 14:37:26 -04:00
5c19ae10a9
添加 lucene 项目 2025-04-25 14:35:33 -04:00
b25c99d801 Merge pull request 'ethereum 项目' (#43) from ethereum into main
Reviewed-on: #43

有关缺包的问题,请参考:https://www.isharkfly.com/t/ethereumj-solcj-all-0-4-25/17240
2025-04-25 17:58:10 +00:00
41a5778dec
Merge remote-tracking branch 'origin/main' into ethereum
# Conflicts:
#	.idea/jarRepositories.xml
2025-04-25 13:55:30 -04:00
131e0c61c0
以太坊 IJ 配置文件 2025-04-25 13:53:28 -04:00
f7b098dc02
更新有关以太坊的项目 2025-04-25 13:52:58 -04:00
16a1be7d43 Merge pull request 'xml' (#42) from xml into main
Reviewed-on: #42
2025-04-25 14:14:55 +00:00
e7ff029598
import as IJ project 2025-04-25 10:12:52 -04:00
5d5e435932
submit XML project 2025-04-25 10:12:19 -04:00
207 changed files with 1370 additions and 2766 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA" serialisationVersion="2">
<checkstyleVersion>10.14.2</checkstyleVersion>
<checkstyleVersion>10.23.0</checkstyleVersion>
<scanScope>JavaOnly</scanScope>
<copyLibs>true</copyLibs>
<option name="thirdPartyClasspath" />

24
.idea/compiler.xml generated
View File

@ -9,59 +9,49 @@
<outputRelativeToContentRoot value="true" />
<module name="assertion-libraries" />
<module name="core-java-serialization" />
<module name="lucene" />
<module name="core-java-annotations" />
<module name="core-java-uuid" />
<module name="core-java-numbers" />
<module name="jackson-polymorphic-deserialization" />
<module name="ethereum" />
<module name="core-java-strings" />
<module name="jackson" />
<module name="core-java-11" />
<module name="core-java-collections-conversions" />
<module name="xml" />
<module name="core-java-collections" />
<module name="core-java-datetime-conversion" />
<module name="core-java-lambdas" />
<module name="junit-5-basics" />
<module name="activejdbc" />
<module name="spring-data-jpa-repo" />
<module name="apache-velocity" />
<module name="jackson-conversions-2" />
<module name="codebank" />
<module name="activejdbc" />
<module name="core-java-collections-list" />
<module name="image-compressing" />
<module name="spring-data-jpa-repo-2" />
<module name="core-java-streams" />
<module name="core-java-io-2" />
<module name="core-java-io" />
<module name="core-java-8-datetime" />
<module name="discourse" />
<module name="image-processing" />
<module name="jackson-jr" />
<module name="spring-data-redis" />
<module name="xml-2" />
<module name="core-java" />
<module name="jackson-custom-conversions" />
<module name="core-java-collections-list-2" />
<module name="core-java-collections-conversions-2" />
<module name="jackson-exceptions" />
<module name="core-java-8" />
<module name="xstream" />
<module name="apache-httpclient" />
<module name="core-java-8" />
<module name="core-java-collections-3" />
<module name="core-java-9" />
<module name="jackson-conversions" />
<module name="core-java-collections-2" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="core-java-10" target="17" />
<module name="core-java-11-2" target="11" />
<module name="core-java-8-2" target="11" />
<module name="core-java-collections-list-3" target="11" />
<module name="jackson-annotations" target="17" />
<module name="spring-data-jpa-repo-2" target="17" />
</bytecodeTargetLevel>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="core-java-9" options="" />
<module name="core-java-streams" options="-parameters" />
</option>
</component>

32
.idea/encodings.xml generated
View File

@ -7,14 +7,8 @@
<file url="file://$PROJECT_DIR$/apache/apache-velocity/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/apache/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/apache/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-10/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-10/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-11-2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-11-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-11/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-11/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-8-2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-8-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-8-datetime/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-8-datetime/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-8/src/main/java" charset="UTF-8" />
@ -31,10 +25,6 @@
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-conversions-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-conversions/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-conversions/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-list-2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-list-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-list-3/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-list-3/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-list/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections-list/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-collections/src/main/java" charset="UTF-8" />
@ -47,8 +37,6 @@
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-io/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-lambdas/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-lambdas/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-numbers/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-numbers/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-serialization/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-serialization/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/core-java-streams/src/main/java" charset="UTF-8" />
@ -61,12 +49,12 @@
<file url="file://$PROJECT_DIR$/core-java-modules/core-java/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/core-java-modules/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ethereum/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ethereum/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/image-compressing/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/image-compressing/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/image-processing/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/image-processing/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries-jackson/jackson-annotations/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries-jackson/jackson-annotations/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries-jackson/jackson-conversions-2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries-jackson/jackson-conversions-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries-jackson/jackson-conversions/src/main/java" charset="UTF-8" />
@ -83,16 +71,14 @@
<file url="file://$PROJECT_DIR$/libraries-jackson/jackson/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries-jackson/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries-jackson/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/lucene/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/lucene/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/parent-boot-2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/parent-boot-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/parent-boot-3/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/parent-boot-3/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/activejdbc/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/activejdbc/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-jpa-repo-2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-jpa-repo-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-jpa-repo/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-jpa-repo/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-redis/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-redis/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/persistence-modules/src/main/java" charset="UTF-8" />
@ -106,9 +92,11 @@
<file url="file://$PROJECT_DIR$/testing-modules/junit-5-basics/src/test/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/testing-modules/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/testing-modules/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/toolkits/codebank/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/toolkits/codebank/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/toolkits/discourse/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/toolkits/discourse/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/xml-2/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/xml-2/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/xml/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/xml/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/xstream/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/xstream/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View File

@ -1,85 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="iSharkFly Private Releases" />
<option name="url" value="https://repo.isharkfly.com/repository/isharkfly-maven-releases/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
<option name="url" value="https://repo.isharkfly.com/repository/maven/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-snapshots" />
<option name="name" value="OSSEZ Private Snapshots" />
<option name="url" value="https://repo.ossez.com/repository/maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="OSSEZ Private Releases" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.ossez.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="iSharkFly Private Releases" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-public/" />
<option name="name" value="iSharkFly Private Snapshots" />
<option name="url" value="https://repo.isharkfly.com/repository/isharkfly-maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-snapshots" />
<option name="name" value="OSSEZ Private Snapshots" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-snapshots" />
<option name="name" value="iSharkFly Private Snapshots" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-snapshots" />
<option name="name" value="iSharkFly Private Snapshots" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="" />
<option name="name" value="" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-snapshots" />
<option name="name" value="OSSEZ Private Snapshots" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="OSSEZ Private Releases" />
<option name="url" value="https://repo.ossez.com/repository/maven-releases/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="iSharkFly Private Releases" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-releases/" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="OSSEZ Private Releases" />
<option name="url" value="https://repo.isharkfly.com/repository/maven-releases/" />
</remote-repository>
</component>
</project>

7
.idea/jpa.xml generated
View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="defaultUnitInitialized" value="true" />
<option name="renamerInitialized" value="true" />
</component>
</project>

6
.idea/prettier.xml generated
View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PrettierConfiguration">
<option name="myConfigurationMode" value="AUTOMATIC" />
</component>
</project>

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 iSharkFly
Copyright (c) 2025 iSharkFly
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -76,7 +76,7 @@
<dependency> <!-- needed to bridge to slf4j for projects that use the log4j APIs directly -->
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${version.slf4j}</version>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

12
ethereum/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,12 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Environment-dependent path to Maven home directory
/mavenHomeManager.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Zeppelin ignored files
/ZeppelinRemoteNotebooks/

16
ethereum/.idea/checkstyle-idea.xml generated Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA" serialisationVersion="2">
<checkstyleVersion>10.23.0</checkstyleVersion>
<scanScope>JavaOnly</scanScope>
<copyLibs>true</copyLibs>
<option name="thirdPartyClasspath" />
<option name="activeLocationIds" />
<option name="locations">
<list>
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
</list>
</option>
</component>
</project>

13
ethereum/.idea/compiler.xml generated Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="ethereum" />
</profile>
</annotationProcessing>
</component>
</project>

7
ethereum/.idea/encodings.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

35
ethereum/.idea/jarRepositories.xml generated Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="Ethereum" />
<option name="name" value="Ethereum" />
<option name="url" value="https://dl.bintray.com/ethereum/maven/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="iSharkFly Private Releases" />
<option name="url" value="https://repo.isharkfly.com/repository/isharkfly-maven-releases/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.isharkfly.com/repository/maven/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-snapshots" />
<option name="name" value="iSharkFly Private Snapshots" />
<option name="url" value="https://repo.isharkfly.com/repository/isharkfly-maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

15
ethereum/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK" />
<component name="ThriftCompiler">
<compilers />
</component>
</project>

6
ethereum/.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -3,15 +3,14 @@
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>
<groupId>com.baeldung.ethereum</groupId>
<groupId>com.ossez.ethereum</groupId>
<artifactId>ethereum</artifactId>
<name>ethereum</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-spring-5</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-spring-5</relativePath>
<groupId>com.ossez</groupId>
<artifactId>parent-modules</artifactId>
<version>0.0.2-SNAPSHOT</version>
</parent>
<dependencies>
@ -76,14 +75,15 @@
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
@ -91,9 +91,10 @@
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>${javax.servlet.jsp-api.version}</version>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<!-- Spring Testing -->
<dependency>
@ -113,19 +114,19 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<version>7.0.0-M4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<version>7.0.0-M4</version>
<scope>test</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<version>5.17.0</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
@ -170,15 +171,16 @@
</build>
<repositories>
<repository>
<id>Ethereum</id>
<name>Ethereum</name>
<url>https://dl.bintray.com/ethereum/maven/</url>
</repository>
<!-- <repository>-->
<!-- <id>Ethereum</id>-->
<!-- <name>Ethereum</name>-->
<!-- <url>https://dl.bintray.com/ethereum/maven/</url>-->
<!-- </repository>-->
</repositories>
<properties>
<ethereumj-core.version>1.5.0-RELEASE</ethereumj-core.version>
<spring.version>7.0.0-M4</spring.version>
<ethereumj-core.version>1.9.0-RELEASE</ethereumj-core.version>
<web3j.core.version>3.3.1</web3j.core.version>
<spring.boot.version>1.5.6.RELEASE</spring.boot.version>
<jsonpath.version>2.8.0</jsonpath.version>

View File

@ -1,4 +1,4 @@
package com.baeldung.ethereumj;
package com.isharkfly.ethereumj;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -8,7 +8,7 @@ import org.springframework.boot.web.support.SpringBootServletInitializer;
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
public class ApplicationMain extends SpringBootServletInitializer {
public abstract class ApplicationMain extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(ApplicationMain.class, args);

View File

@ -1,4 +1,4 @@
package com.baeldung.ethereumj;
package com.isharkfly.ethereumj;
public class Constants {

View File

@ -1,6 +1,6 @@
package com.baeldung.ethereumj.beans;
package com.isharkfly.ethereumj.beans;
import com.baeldung.ethereumj.listeners.EthListener;
import com.isharkfly.ethereumj.listeners.EthListener;
import org.ethereum.core.Block;
import org.ethereum.facade.Ethereum;
import org.ethereum.facade.EthereumFactory;

View File

@ -1,6 +1,6 @@
package com.baeldung.ethereumj.config;
package com.isharkfly.ethereumj.config;
import com.baeldung.ethereumj.beans.EthBean;
import com.isharkfly.ethereumj.beans.EthBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,8 +1,8 @@
package com.baeldung.ethereumj.controllers;
package com.isharkfly.ethereumj.controllers;
import com.baeldung.ethereumj.Constants;
import com.baeldung.ethereumj.beans.EthBean;
import com.baeldung.ethereumj.transfer.EthResponse;
import com.isharkfly.ethereumj.Constants;
import com.isharkfly.ethereumj.beans.EthBean;
import com.isharkfly.ethereumj.transfer.EthResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package com.baeldung.ethereumj.listeners;
package com.isharkfly.ethereumj.listeners;
import org.ethereum.core.Block;
import org.ethereum.core.TransactionReceipt;

View File

@ -1,4 +1,4 @@
package com.baeldung.ethereumj.transfer;
package com.isharkfly.ethereumj.transfer;
public class EthResponse {

View File

@ -1,6 +1,6 @@
package com.baeldung.web3j;
package com.isharkfly.web3j;
import com.baeldung.web3j.contracts.Greeting;
import com.isharkfly.web3j.contracts.Greeting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.web3j.crypto.Credentials;

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.config;
package com.isharkfly.web3j.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -18,7 +18,7 @@ import java.util.concurrent.Executor;
@Configuration
@EnableWebMvc
@EnableAsync
@ComponentScan("com.baeldung.web3j")
@ComponentScan("com.isharkfly.web3j")
public class AppConfig implements WebMvcConfigurer {
public void addViewControllers(ViewControllerRegistry registry) {

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.config;
package com.isharkfly.web3j.config;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.constants;
package com.isharkfly.web3j.constants;
public class Constants {

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.contracts;
package com.isharkfly.web3j.contracts;
import java.math.BigInteger;
import java.util.Arrays;

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.contracts;
package com.isharkfly.web3j.contracts;
import java.math.BigInteger;
import java.util.Arrays;

View File

@ -1,9 +1,9 @@
package com.baeldung.web3j.controllers;
package com.isharkfly.web3j.controllers;
import com.baeldung.web3j.constants.Constants;
import com.baeldung.web3j.helpers.TimeHelper;
import com.baeldung.web3j.services.Web3Service;
import com.baeldung.web3j.transfers.ResponseTransfer;
import com.isharkfly.web3j.constants.Constants;
import com.isharkfly.web3j.helpers.TimeHelper;
import com.isharkfly.web3j.services.Web3Service;
import com.isharkfly.web3j.transfers.ResponseTransfer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -17,7 +17,7 @@ import java.time.Instant;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import static com.baeldung.web3j.constants.Constants.GENERIC_EXCEPTION;
import static com.isharkfly.web3j.constants.Constants.GENERIC_EXCEPTION;
@RestController
public class EthereumRestController {

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.helpers;
package com.isharkfly.web3j.helpers;
import java.time.Duration;
import java.time.Instant;

View File

@ -1,6 +1,6 @@
package com.baeldung.web3j.services;
package com.isharkfly.web3j.services;
import com.baeldung.web3j.contracts.Example;
import com.isharkfly.web3j.contracts.Example;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.web3j.abi.FunctionEncoder;
@ -22,11 +22,10 @@ import java.io.File;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import static com.baeldung.web3j.constants.Constants.DEFAULT_ADDRESS;
import static com.baeldung.web3j.constants.Constants.GENERIC_EXCEPTION;
import static com.baeldung.web3j.constants.Constants.PLEASE_SUPPLY_REAL_DATA;
import static com.isharkfly.web3j.constants.Constants.DEFAULT_ADDRESS;
import static com.isharkfly.web3j.constants.Constants.GENERIC_EXCEPTION;
import static com.isharkfly.web3j.constants.Constants.PLEASE_SUPPLY_REAL_DATA;
@Service
public class Web3Service {

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.transfers;
package com.isharkfly.web3j.transfers;
import java.time.Duration;

View File

@ -1,4 +1,4 @@
package com.baeldung.ethereumj.controllers;
package com.isharkfly.ethereumj.controllers;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertNotNull;
@ -17,9 +17,9 @@ import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
import com.baeldung.ethereumj.ApplicationMain;
import com.baeldung.ethereumj.Constants;
import com.baeldung.ethereumj.transfer.EthResponse;
import com.isharkfly.ethereumj.ApplicationMain;
import com.isharkfly.ethereumj.Constants;
import com.isharkfly.ethereumj.transfer.EthResponse;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ApplicationMain.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)

View File

@ -1,8 +1,8 @@
package com.baeldung.web3j.controllers;
package com.isharkfly.web3j.controllers;
import com.baeldung.web3j.config.AppConfig;
import com.baeldung.web3j.constants.Constants;
import com.isharkfly.web3j.config.AppConfig;
import com.isharkfly.web3j.constants.Constants;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

View File

@ -1,7 +1,7 @@
package com.baeldung.web3j.controllers;
package com.isharkfly.web3j.controllers;
import com.baeldung.web3j.constants.Constants;
import com.baeldung.web3j.services.Web3Service;
import com.isharkfly.web3j.constants.Constants;
import com.isharkfly.web3j.services.Web3Service;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package com.baeldung.web3j.services;
package com.isharkfly.web3j.services;
import org.junit.After;
import org.junit.Before;

View File

@ -7,6 +7,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import java.io.File;
import java.net.URI;
import java.net.URL;
import java.util.List;
import java.util.Map;
@ -103,7 +104,7 @@ public class JavaReadWriteJsonExampleUnitTest {
@Test
public void wheReadFromUrl_thanCorrect() throws Exception {
URL resource = new URL("file:src/test/resources/json_car.json");
URL resource = new URI("file:src/test/resources/json_car.json").toURL();
ObjectMapper objectMapper = new ObjectMapper();
Car fromFile = objectMapper.readValue(resource, Car.class);

View File

@ -6,6 +6,10 @@
<artifactId>jackson-conversions</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>jackson-conversions</name>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<parent>
<groupId>com.ossez</groupId>

View File

@ -9,9 +9,9 @@
<description>An Apache Lucene demo application</description>
<parent>
<groupId>com.baeldung</groupId>
<groupId>com.ossez</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.0.2-SNAPSHOT</version>
</parent>
<dependencies>
@ -33,7 +33,7 @@
</dependencies>
<properties>
<lucene.version>7.4.0</lucene.version>
<lucene.version>8.0.0</lucene.version>
</properties>
</project>

View File

@ -4,10 +4,10 @@ import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.en.EnglishAnalyzer;
import org.apache.lucene.analysis.en.PorterStemFilter;
import org.apache.lucene.analysis.miscellaneous.CapitalizationFilter;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.analysis.standard.ClassicFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
public class MyCustomAnalyzer extends Analyzer{
@ -15,9 +15,9 @@ public class MyCustomAnalyzer extends Analyzer{
@Override
protected TokenStreamComponents createComponents(String fieldName) {
final StandardTokenizer src = new StandardTokenizer();
TokenStream result = new StandardFilter(src);
TokenStream result = new ClassicFilter(src);
result = new LowerCaseFilter(result);
result = new StopFilter(result, StandardAnalyzer.STOP_WORDS_SET);
result = new StopFilter(result, EnglishAnalyzer.ENGLISH_STOP_WORDS_SET);
result = new PorterStemFilter(result);
result = new CapitalizationFilter(result);
return new TokenStreamComponents(src, result);

View File

@ -42,7 +42,7 @@ public class LuceneAnalyzerIntegrationTest {
@Test
public void whenUseStopAnalyzer_thenAnalyzed() throws IOException {
List<String> result = analyze(SAMPLE_TEXT, new StopAnalyzer());
List<String> result = analyze(SAMPLE_TEXT, new StopAnalyzer(EnglishAnalyzer.ENGLISH_STOP_WORDS_SET));
assertThat(result, contains("baeldung", "com", "lucene", "analyzers", "test"));
}

View File

@ -34,7 +34,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${version.slf4j}</version>
<version>${slf4j.version}</version>
</dependency>
</dependencies>

22
pom.xml
View File

@ -41,9 +41,12 @@
<modules>
<module>apache</module>
<module>core-java-modules</module>
<module>ethereum</module>
<module>image-compressing</module>
<module>image-processing</module>
<module>libraries-jackson</module>
<module>lucene</module>
<!-- <module>jackson-simple</module>-->
<!-- <module>parent-java</module>-->
<module>parent-boot-2</module>
@ -51,7 +54,9 @@
<module>persistence-modules</module>
<module>testing-modules</module>
<module>toolkits</module>
<!-- <module>xml</module>-->
<module>xml</module>
<module>xml-2</module>
<module>xstream</module>
</modules>
<properties>
@ -61,9 +66,9 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Logging -->
<version.slf4j>1.7.36</version.slf4j>
<slf4j.version>2.0.0</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<log4j-over-slf4j.version>2.0.7</log4j-over-slf4j.version>
<log4j-over-slf4j.version>2.0.17</log4j-over-slf4j.version>
<version.log4j2>2.18.0</version.log4j2>
<!-- APACHE COMMONS-->
@ -75,8 +80,6 @@
<commons-cli.version>1.4</commons-cli.version>
<commons-io.version>2.11.0</commons-io.version>
<!-- UTILS -->
<guava.version>31.1-jre</guava.version>
<lombok.version>1.18.28</lombok.version>
@ -84,6 +87,7 @@
<colt.version>1.2.0</colt.version>
<trove4j.version>3.0.3</trove4j.version>
<fastutil.version>5.0.9</fastutil.version>
<jstl.version>1.2</jstl.version>
<!-- Hibernate / JPA -->
<jakarta.persistence.version>3.2.0-M2</jakarta.persistence.version>
@ -131,6 +135,8 @@
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
@ -139,6 +145,12 @@
<!-- OSSEZ COMMON -->
<!-- LOG -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>

View File

@ -52,14 +52,6 @@
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>

View File

@ -4,12 +4,15 @@ This module contains articles about eXtensible Markup Language (XML)
### Relevant Articles:
- [Pretty-Print XML in Java](https://www.baeldung.com/java-pretty-print-xml)
- [Validate an XML File Against an XSD File](https://www.baeldung.com/java-validate-xml-xsd)
- [Converting JSON to XML in Java](https://www.baeldung.com/java-convert-json-to-xml)
- [Convert an XML Object to a String in Java](https://www.baeldung.com/java-convert-xml-object-string)
- [Convert String Containing XML to org.w3c.dom.Document](https://www.baeldung.com/java-convert-string-xml-dom)
- [How to Parse XML to HashMap in Java](https://www.baeldung.com/java-xml-read-into-hashmap)
- [Convert an XML File to CSV File](https://www.baeldung.com/java-convert-xml-csv)
- [Invalid Characters in XML](https://www.baeldung.com/java-xml-invalid-characters)
- [How to Convert XML to PDF](https://www.baeldung.com/java-xml-pdf-conversion)
- [How to Convert org.w3c.dom.Document to String in Java](https://www.baeldung.com/java-convert-org-w3c-dom-document-string)
- [Introduction to JiBX](https://www.baeldung.com/jibx)
- [Write an org.w3.dom.Document to a File](https://www.baeldung.com/java-write-xml-document-file)
- [Modifying an XML Attribute in Java](https://www.baeldung.com/java-modify-xml-attribute)
- [Convert XML to HTML in Java](https://www.baeldung.com/java-convert-xml-to-html)
- - More articles: [[prev -->]](../xml)

View File

@ -1,16 +1,16 @@
<?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>xml-2</artifactId>
<version>0.1-SNAPSHOT</version>
<name>xml-2</name>
<parent>
<groupId>com.baeldung</groupId>
<groupId>com.ossez</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.0.2-SNAPSHOT</version>
</parent>
<dependencies>
@ -26,16 +26,6 @@
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
@ -52,14 +42,96 @@
<version>${xstream.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>${fop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>${xmlbeans.version}</version>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>${itextpdf.version}</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<version>${jibx-version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-assertj</artifactId>
<version>${xmlunit-assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>joox-java-6</artifactId>
<version>${joox.version}</version>
</dependency>
<!-- JMH Libraries -->
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh-core.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh-generator.version}</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>${jaxen.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta.xml.bind-api.version}</version>
</dependency>
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
<version>${mustache.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-impl.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${jaxb-runtime.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb-core.version}</version>
</dependency>
<dependency>
<groupId>net.htmlparser.jericho</groupId>
<artifactId>jericho-html</artifactId>
<version>${jericho.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlcleaner</groupId>
<artifactId>htmlcleaner</artifactId>
<version>${htmlcleaner.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
</dependencies>
@ -71,6 +143,14 @@
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -79,18 +159,228 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>${maven-jibx-plugin.version}</version>
<configuration>
<directory>src/main/resources</directory>
<includes>
<includes>*-binding.xml</includes>
</includes>
<excludes>
<exclude>template-binding.xml</exclude>
</excludes>
<schemaBindingDirectory>src/main/resources</schemaBindingDirectory>
<includeSchemaBindings>
<includeSchemaBindings>*-binding.xml</includeSchemaBindings>
</includeSchemaBindings>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<id>process-classes</id>
<phase>process-classes</phase>
<goals>
<goal>bind</goal>
</goals>
</execution>
<execution>
<id>process-test-classes</id>
<phase>process-test-classes</phase>
<goals>
<goal>test-bind</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.bcel</groupId>
<artifactId>bcel</artifactId>
<version>${bcel.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>schemaGen</id>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>${maven-jibx-plugin.version}</version>
<executions>
<execution>
<id>generate-java-code-from-schema</id>
<goals>
<goal>schema-codegen</goal>
</goals>
<configuration>
<directory>src/main/resources</directory>
<includes>
<include>Order.xsd</include>
</includes>
<verbose>true</verbose>
</configuration>
</execution>
<execution>
<id>compile-binding</id>
<goals>
<goal>bind</goal>
</goals>
<configuration>
<directory>target/generated-sources</directory>
<load>true</load>
<validate>true</validate>
<!--<verbose>true</verbose> -->
<verify>true</verify>
</configuration>
</execution>
<execution>
<id>generate-test-code-from-schema</id>
<phase>generate-test-sources</phase>
<goals>
<goal>test-schema-codegen</goal>
</goals>
</execution>
<execution>
<id>compile-test-binding</id>
<phase>process-test-classes</phase>
<goals>
<goal>test-bind</goal>
</goals>
<configuration>
<directory>target/generated-test-sources</directory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>CustomerTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bindGen</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>${maven-jibx-plugin.version}</version>
<configuration>
<directory>src/main/resources</directory>
<includes>
<includes>*-binding.xml</includes>
</includes>
<excludes>
<exclude>template-binding.xml</exclude>
</excludes>
<schemaBindingDirectory>src/main/resources</schemaBindingDirectory>
<includeSchemaBindings>
<includeSchemaBindings>*-binding.xml</includeSchemaBindings>
</includeSchemaBindings>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<id>process-classes</id>
<phase>process-classes</phase>
<goals>
<goal>bind</goal>
</goals>
</execution>
<execution>
<id>process-test-classes</id>
<phase>process-test-classes</phase>
<goals>
<goal>test-bind</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<!-- NOTE: We don't need a groupId specification because the group is org.apache.maven.plugins -->
<!--...which is assumed by default. -->
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>
com.baeldung.xml.jibx.JiBXDemoApplication
</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id><!-- this is used for inheritance merges -->
<phase>package</phase><!-- append to the packaging phase. -->
<goals>
<goal>attached</goal><!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<dom4j.version>2.1.3</dom4j.version>
<json.version>20240303</json.version>
<underscore.version>1.89</underscore.version>
<xstream.version>1.4.18</xstream.version>
<jaxb.version>2.3.3</jaxb.version>
<xmlbeans.version>5.0.2</xmlbeans.version>
<log4j-core.version>2.12.4</log4j-core.version>
<fop.version>2.9</fop.version>
<itextpdf.version>5.5.13.3</itextpdf.version>
<jibx-version>1.2.4.5</jibx-version>
<bcel.version>6.7.0</bcel.version>
<maven-jibx-plugin.version>1.3.1</maven-jibx-plugin.version>
<commons-lang3.version>3.14.0</commons-lang3.version>
<xmlunit-assertj.version>2.6.3</xmlunit-assertj.version>
<joox.version>1.6.2</joox.version>
<jaxen.version>1.2.0</jaxen.version>
<freemarker.version>2.3.29</freemarker.version>
<jakarta.xml.bind-api.version>4.0.2</jakarta.xml.bind-api.version>
<mustache.version>0.9.6</mustache.version>
<jaxb-core.version>2.3.0.1</jaxb-core.version>
<jaxb-impl.version>4.0.4</jaxb-impl.version>
<jaxb-runtime.version>4.0.3</jaxb-runtime.version>
<jericho.version>3.4</jericho.version>
<htmlcleaner.version>2.25</htmlcleaner.version>
<jsoup.version>1.17.2</jsoup.version>
</properties>
</project>

View File

@ -1,91 +0,0 @@
package com.baeldung.xml.prettyprint;
import org.dom4j.DocumentHelper;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.*;
public class XmlPrettyPrinter {
public static String prettyPrintByTransformer(String xmlString, int indent, boolean ignoreDeclaration) {
try {
final InputSource src = new InputSource(new StringReader(xmlString));
final Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformerFactory.setAttribute("indent-number", indent);
Transformer transformer = transformerFactory.newTransformer(new StreamSource(new StringReader(readPrettyPrintXslt())));
// Using the default transformer will create empty lines in Java9+
// Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, ignoreDeclaration ? "yes" : "no");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// Alternatively, we can set indent-size on the transformer object
// transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent));
Writer out = new StringWriter();
transformer.transform(new DOMSource(document), new StreamResult(out));
return out.toString();
} catch (Exception e) {
throw new RuntimeException("Error occurs when pretty-printing xml:\n" + xmlString, e);
}
}
public static String prettyPrintByDom4j(String xmlString, int indent, boolean skipDeclaration) {
try {
final OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("UTF-8");
format.setIndentSize(indent);
format.setSuppressDeclaration(skipDeclaration);
final org.dom4j.Document document = DocumentHelper.parseText(xmlString);
final StringWriter sw = new StringWriter();
final XMLWriter writer = new XMLWriter(sw, format);
writer.write(document);
return sw.toString();
} catch (Exception e) {
throw new RuntimeException("Error occurs when pretty-printing xml:\n" + xmlString, e);
}
}
public static void main(String[] args) throws IOException {
InputStream inputStream = XmlPrettyPrinter.class.getResourceAsStream("/xml/emails.xml");
String xmlString = readFromInputStream(inputStream);
System.out.println("Pretty printing by Transformer");
System.out.println("=============================================");
System.out.println(prettyPrintByTransformer(xmlString, 2, true));
System.out.println("=============================================");
System.out.println("Pretty printing by Dom4j");
System.out.println("=============================================");
System.out.println(prettyPrintByDom4j(xmlString, 8, false));
System.out.println("=============================================");
}
private static String readPrettyPrintXslt() throws IOException {
InputStream inputStream = XmlPrettyPrinter.class.getResourceAsStream("/xml/prettyprint.xsl");
return readFromInputStream(inputStream);
}
private static String readFromInputStream(InputStream inputStream) throws IOException {
StringBuilder resultStringBuilder = new StringBuilder();
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
String line;
while ((line = br.readLine()) != null) {
resultStringBuilder.append(line).append("\n");
}
}
return resultStringBuilder.toString();
}
}

View File

@ -1,35 +0,0 @@
package com.baeldung.xml.validation;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXParseException;
import java.util.ArrayList;
import java.util.List;
public class XmlErrorHandler implements ErrorHandler {
private List<SAXParseException> exceptions;
public XmlErrorHandler() {
this.exceptions = new ArrayList<>();
}
public List<SAXParseException> getExceptions() {
return exceptions;
}
@Override
public void warning(SAXParseException exception) {
exceptions.add(exception);
}
@Override
public void error(SAXParseException exception) {
exceptions.add(exception);
}
@Override
public void fatalError(SAXParseException exception) {
exceptions.add(exception);
}
}

View File

@ -1,62 +0,0 @@
package com.baeldung.xml.validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import javax.xml.XMLConstants;
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;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class XmlValidator {
private static final Logger LOGGER = LoggerFactory.getLogger(XmlValidator.class);
private String xsdPath;
private String xmlPath;
public XmlValidator(String xsdPath, String xmlPath) {
this.xsdPath = xsdPath;
this.xmlPath = xmlPath;
}
public boolean isValid() throws IOException, SAXException {
Validator validator = initValidator(xsdPath);
try {
validator.validate(new StreamSource(getFile(xmlPath)));
return true;
} catch (SAXException e) {
return false;
}
}
public List<SAXParseException> listParsingExceptions() throws IOException, SAXException {
XmlErrorHandler xsdErrorHandler = new XmlErrorHandler();
Validator validator = initValidator(xsdPath);
validator.setErrorHandler(xsdErrorHandler);
try {
validator.validate(new StreamSource(getFile(xmlPath)));
} catch (SAXParseException e) {}
xsdErrorHandler.getExceptions().forEach(e -> LOGGER.info(String.format("Line number: %s, Column number: %s. %s", e.getLineNumber(), e.getColumnNumber(), e.getMessage())));
return xsdErrorHandler.getExceptions();
}
private Validator initValidator(String xsdPath) throws SAXException {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(getFile(xsdPath));
Schema schema = factory.newSchema(schemaFile);
return schema.newValidator();
}
private File getFile(String location) {
return new File(getClass().getClassLoader().getResource(location).getFile());
}
}

View File

@ -1,19 +1,14 @@
package com.ossez.xml;
package com.isharkfly.xml;
import org.w3c.dom.Document;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
public class XMLDocumentWriter {
public void write(Document document, String fileName, boolean excludeDeclaration, boolean prettyPrint) {

View File

@ -1,4 +1,4 @@
package com.ossez.xml.attribute;
package com.isharkfly.xml.attribute;
import org.dom4j.*;
import org.dom4j.io.DocumentSource;
@ -27,7 +27,7 @@ public class Dom4jTransformer {
this.input = xmlReader.read(resourcePath);
}
public String modifyAttribute(String attribute, String oldValue, String newValue) throws TransformerException {
public String modifyAttribute(String attribute, String oldValue, String newValue) throws TransformerException, TransformerException {
// 2- Locate the node(s) with xpath, we can use index and iterator too.
String expr = String.format("//*[contains(@%s, '%s')]", attribute, oldValue);
XPath xpath = DocumentHelper.createXPath(expr);

View File

@ -1,28 +1,23 @@
package com.baeldung.xml.attribute;
package com.isharkfly.xml.attribute;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
public class JaxpTransformer {
@ -37,7 +32,8 @@ public class JaxpTransformer {
.parse(resourcePath);
}
public String modifyAttribute(String attribute, String oldValue, String newValue) throws XPathExpressionException, TransformerFactoryConfigurationError, TransformerException {
public String modifyAttribute(String attribute, String oldValue, String newValue)
throws XPathExpressionException, TransformerFactoryConfigurationError, TransformerException, TransformerConfigurationException {
// 2- Locate the node(s) with xpath
XPath xpath = XPathFactory.newInstance()
.newXPath();

View File

@ -1,4 +1,4 @@
package com.baeldung.xml.attribute;
package com.isharkfly.xml.attribute;
import org.joox.JOOX;
import org.joox.Match;

View File

@ -1,28 +1,21 @@
package com.ossez.xml.attribute.jmh;
package com.isharkfly.xml.attribute.jmh;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPathExpressionException;
import com.ossez.xml.attribute.JaxpTransformer;
import com.isharkfly.xml.attribute.Dom4jTransformer;
import com.isharkfly.xml.attribute.JaxpTransformer;
import com.isharkfly.xml.attribute.JooxTransformer;
import org.dom4j.DocumentException;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.xml.sax.SAXException;
import com.ossez.xml.attribute.Dom4jTransformer;
import com.ossez.xml.attribute.JooxTransformer;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPathExpressionException;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@ -63,7 +56,8 @@ public class AttributeBenchMark {
}
@Benchmark
public String jaxpBenchmark() throws TransformerException, ParserConfigurationException, SAXException, IOException, XPathExpressionException {
public String jaxpBenchmark()
throws TransformerException, ParserConfigurationException, SAXException, IOException, XPathExpressionException {
String path = this.getClass()
.getResource("/xml/attribute.xml")
.toString();

View File

@ -4,7 +4,7 @@
* Copyright 2008 Stefan J&auml;ger
*
*/
package com.baeldung.xml.jibx;
package com.isharkfly.xml.jibx;
import org.apache.commons.lang3.builder.ToStringBuilder;

View File

@ -1,4 +1,4 @@
package com.baeldung.xml.jibx;
package com.isharkfly.xml.jibx;
public class Identity {

View File

@ -4,7 +4,7 @@
* Copyright 2008 Stefan J&auml;ger
*
*/
package com.baeldung.xml.jibx;
package com.isharkfly.xml.jibx;
import org.apache.commons.lang3.builder.ToStringBuilder;

View File

@ -1,4 +1,4 @@
package com.ossez.xml.jibx;
package com.isharkfly.xml.jibx;
public class Phone {

View File

@ -1,4 +1,4 @@
package com.baeldung.xml.tohashmap;
package com.isharkfly.xml.tohashmap;
public class Employee {
private String id;

View File

@ -1,9 +1,10 @@
package com.baeldung.xml.tohashmap;
package com.isharkfly.xml.tohashmap;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "employees")
public class Employees {

View File

@ -1,4 +1,4 @@
package com.baeldung.xml.tohashmap;
package com.isharkfly.xml.tohashmap;
import java.io.IOException;
import java.io.StringReader;
@ -9,9 +9,6 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@ -21,6 +18,9 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

View File

@ -1,4 +1,4 @@
package com.baeldung.xml.xml2csv;
package com.isharkfly.xml.xml2csv;
import java.io.BufferedWriter;
import java.io.File;

View File

@ -0,0 +1,55 @@
package com.isharkfly.xml.xml2pdf;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
public class XmlToPdfConverter {
public static void convertXMLtoPDFUsingFop(String xmlFilePath, String xsltFilePath, String pdfFilePath) throws Exception {
// Initialize FOP
FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
// Specify output stream for PDF
try (OutputStream out = new BufferedOutputStream(Files.newOutputStream(new File(pdfFilePath).toPath()))) {
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
// Create Transformer from XSLT
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(new File(xsltFilePath)));
// Apply transformation
Source src = new StreamSource(new File(xmlFilePath));
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);
}
}
public static void convertXMLtoPDFUsingIText(String xmlFilePath, String pdfFilePath) throws Exception {
try (FileOutputStream outputStream = new FileOutputStream(pdfFilePath)) {
Document document = new Document();
PdfWriter.getInstance(document, outputStream);
document.open();
// Read XML content and add it to the Document
String xmlContent = new String(Files.readAllBytes(Paths.get(xmlFilePath)));
document.add(new Paragraph(xmlContent));
document.close();
}
}
}

View File

@ -1,6 +1,6 @@
package com.baeldung.xmlhtml;
package com.isharkfly.xmlhtml;
import com.baeldung.xmlhtml.helpers.XMLRunner;
import com.isharkfly.xmlhtml.helpers.XMLRunner;
public class Application {

View File

@ -1,4 +1,4 @@
package com.baeldung.xmlhtml;
package com.isharkfly.xmlhtml;
public class Constants {

View File

@ -1,6 +1,6 @@
package com.ossez.xmlhtml.freemarker;
package com.isharkfly.xmlhtml.freemarker;
import com.ossez.xmlhtml.stax.StaxTransformer;
import com.isharkfly.xmlhtml.stax.StaxTransformer;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;

View File

@ -1,7 +1,7 @@
package com.ossez.xmlhtml.helpers;
package com.isharkfly.xmlhtml.helpers;
import com.ossez.xmlhtml.helpers.jaxb.JAXBHelper;
import com.isharkfly.xmlhtml.helpers.jaxb.JAXBHelper;
public class XMLRunner {

View File

@ -1,19 +1,18 @@
package com.ossez.xmlhtml.helpers.jaxb;
package com.isharkfly.xmlhtml.helpers.jaxb;
import com.ossez.xmlhtml.pojo.jaxb.html.ExampleHTML;
import com.ossez.xmlhtml.pojo.jaxb.html.elements.Body;
import com.ossez.xmlhtml.pojo.jaxb.html.elements.CustomElement;
import com.ossez.xmlhtml.pojo.jaxb.html.elements.Meta;
import com.ossez.xmlhtml.pojo.jaxb.html.elements.NestedElement;
import com.ossez.xmlhtml.pojo.jaxb.xml.XMLExample;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import com.isharkfly.xmlhtml.pojo.jaxb.html.ExampleHTML;
import com.isharkfly.xmlhtml.pojo.jaxb.html.elements.Body;
import com.isharkfly.xmlhtml.pojo.jaxb.html.elements.CustomElement;
import com.isharkfly.xmlhtml.pojo.jaxb.html.elements.Meta;
import com.isharkfly.xmlhtml.pojo.jaxb.html.elements.NestedElement;
import com.isharkfly.xmlhtml.pojo.jaxb.xml.XMLExample;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
import java.io.File;
import static com.ossez.xmlhtml.Constants.*;
import static com.isharkfly.xmlhtml.Constants.*;
public class JAXBHelper {

View File

@ -1,4 +1,4 @@
package com.baeldung.xmlhtml.jaxp;
package com.isharkfly.xmlhtml.jaxp;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -1,6 +1,6 @@
package com.ossez.xmlhtml.mustache;
package com.isharkfly.xmlhtml.mustache;
import com.ossez.xmlhtml.stax.StaxTransformer;
import com.isharkfly.xmlhtml.stax.StaxTransformer;
import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache;
import com.github.mustachejava.MustacheFactory;

View File

@ -1,9 +1,9 @@
package com.ossez.xmlhtml.pojo.jaxb.html;
package com.isharkfly.xmlhtml.pojo.jaxb.html;
import com.ossez.xmlhtml.pojo.jaxb.html.elements.Body;
import com.ossez.xmlhtml.pojo.jaxb.html.elements.Meta;
import com.isharkfly.xmlhtml.pojo.jaxb.html.elements.Body;
import com.isharkfly.xmlhtml.pojo.jaxb.html.elements.Meta;
import jakarta.xml.bind.annotation.*;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.ossez.xmlhtml.pojo.jaxb.html.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.html.elements;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class Body {

View File

@ -1,6 +1,6 @@
package com.baeldung.xmlhtml.pojo.jaxb.html.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.html.elements;
import javax.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.XmlValue;
public class CustomElement {

View File

@ -1,7 +1,7 @@
package com.baeldung.xmlhtml.pojo.jaxb.html.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.html.elements;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlValue;
public class Meta {

View File

@ -1,6 +1,6 @@
package com.ossez.xmlhtml.pojo.jaxb.html.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.html.elements;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class NestedElement {

View File

@ -1,9 +1,8 @@
package com.baeldung.xmlhtml.pojo.jaxb.xml;
package com.isharkfly.xmlhtml.pojo.jaxb.xml;
import com.baeldung.xmlhtml.pojo.jaxb.xml.elements.Ancestor;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.isharkfly.xmlhtml.pojo.jaxb.xml.elements.Ancestor;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "xmlexample")
public class XMLExample {

View File

@ -1,6 +1,6 @@
package com.ossez.xmlhtml.pojo.jaxb.xml.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.xml.elements;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class Ancestor {

View File

@ -1,6 +1,6 @@
package com.baeldung.xmlhtml.pojo.jaxb.xml.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.xml.elements;
import javax.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.XmlValue;
public class DescendantOne {

View File

@ -1,6 +1,6 @@
package com.baeldung.xmlhtml.pojo.jaxb.xml.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.xml.elements;
import javax.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.XmlValue;
public class DescendantThree {

View File

@ -1,6 +1,6 @@
package com.baeldung.xmlhtml.pojo.jaxb.xml.elements;
package com.isharkfly.xmlhtml.pojo.jaxb.xml.elements;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class DescendantTwo {

View File

@ -1,4 +1,4 @@
package com.baeldung.xmlhtml.stax;
package com.isharkfly.xmlhtml.stax;
import javax.xml.stream.*;
import java.io.FileInputStream;

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding>
<mapping class="com.isharkfly.xml.jibx.Identity" abstract="true">
<value name="customer-id" field="customerId" />
</mapping>
<mapping name="customer" class="com.isharkfly.xml.jibx.Customer">
<structure field="person" />
<structure name="home-phone" field="homePhone" usage="optional" />
<structure name="office-phone" field="officePhone" usage="optional" />
<value name="city" field="city" />
</mapping>
<mapping name="person" class="com.isharkfly.xml.jibx.Person"
extends="com.isharkfly.xml.jibx.Identity">
<structure map-as="com.isharkfly.xml.jibx.Identity" />
<value name="name" field="name" />
</mapping>
<mapping class="com.isharkfly.xml.jibx.Phone" abstract="true">
<value name="number" field="number" />
</mapping>
</binding>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<notification id="5">
<to customer="true">john@email.com</to>
<from>mary@email.com</from>
</notification>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<notification id="5">
<to customer="false">john@email.com</to>
<from>mary@email.com</from>
</notification>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xmlexample>
<ancestor>
<descendantOne>Yo</descendantOne>
<descendantTwo>
<descendantThree>
DustyOrb
</descendantThree>
</descendantTwo>
</ancestor>
</xmlexample>

View File

@ -0,0 +1,14 @@
<html>
<head>
<meta title="example"/>
</head>
<body>
<p>descendantOne: Yo</p>
<div>
<p>descendantThree:
DustyOrb
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>descendantOne: Yo</p>
<div>
<p>descendantThree:
DustyOrb
</p>
</div>
</body>
</html>

View File

@ -1,11 +0,0 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,15 @@
<html>
<head>
<meta></meta>
</head>
<body>
<p>descendantOne: Yo</p>
<div>
<p>
descendantThree:
DustyOrb
</p>
</div>
</body>
</html>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<individual>
<name>Baeldung</name>
<address>
<zip>00001</zip>
<city>New York</city>
</address>
</individual>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="individual">
<xs:complexType>
<xs:sequence>
<xs:element name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="5" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="zip" type="xs:positiveInteger" />
<xs:element name="city" type="xs:string" />
<xs:element name="street" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="individual">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="zip" type="xs:positiveInteger" />
<xs:element name="city" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<Bookstores>
<Bookstore id="S001">
<Books>
<Book id="B001" category="Fiction">
<Title>Death and the Penguin</Title>
<Author id="A001">Andrey Kurkov</Author>
<Price>10.99</Price>
</Book>
<Book id="B002" category="Poetry">
<Title>Kobzar</Title>
<Author id="A002">Taras Shevchenko</Author>
<Price>8.50</Price>
</Book>
</Books>
</Bookstore>
<Bookstore id="S002">
<Books>
<Book id="B003" category="Novel">
<Title>Voroshilovgrad</Title>
<Author id="A003">Serhiy Zhadan</Author>
<Price>12.99</Price>
</Book>
</Books>
</Bookstore>
</Bookstores>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- Define the layout for the PDF -->
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4"
page-width="8.5in" page-height="11in" margin-top="0.5in"
margin-bottom="0.5in" margin-left="0.5in" margin-right="0.5in">
<fo:region-body margin-top="0.5in" margin-bottom="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<!-- Define the content of the PDF -->
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="18pt" font-weight="bold" text-align="center">
Bookstore Inventory
</fo:block>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell border="solid 1px" padding="5pt" background-color="#CCCCCC">
<fo:block>Bookstore ID</fo:block>
</fo:table-cell>
<fo:table-cell border="solid 1px" padding="5pt" background-color="#CCCCCC">
<fo:block>Book ID</fo:block>
</fo:table-cell>
<fo:table-cell border="solid 1px" padding="5pt" background-color="#CCCCCC">
<fo:block>Title</fo:block>
</fo:table-cell>
<fo:table-cell border="solid 1px" padding="5pt" background-color="#CCCCCC">
<fo:block>Author</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates select="//Book"/>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="Book">
<fo:table-row>
<fo:table-cell border="solid 1px" padding="5pt">
<fo:block><xsl:value-of select="ancestor::Bookstore/@id"/></fo:block>
</fo:table-cell>
<fo:table-cell border="solid 1px" padding="5pt">
<fo:block><xsl:value-of select="@id"/></fo:block>
</fo:table-cell>
<fo:table-cell border="solid 1px" padding="5pt">
<fo:block><xsl:value-of select="Title"/></fo:block>
</fo:table-cell>
<fo:table-cell border="solid 1px" padding="5pt">
<fo:block><xsl:value-of select="Author"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,77 +0,0 @@
package com.baeldung.xml.json2xml;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
import com.github.underscore.U;
import org.json.JSONObject;
import org.json.XML;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class JsonToXmlUnitTest {
@Test
public void givenJsonString_whenConvertToXMLUsingJsonJava_thenConverted() {
String jsonString = "{\"name\":\"John\", \"age\":20, \"address\":{\"street\":\"Wall Street\", \"city\":\"New York\"}}";
JSONObject jsonObject = new JSONObject(jsonString);
String xmlString = XML.toString(jsonObject);
Assertions.assertEquals("<address><city>New York</city><street>Wall Street</street></address><name>John</name><age>20</age>", xmlString);
}
@Test
public void givenJsonString_whenConvertToXMLUsingJackson_thenConverted() throws JsonProcessingException {
String jsonString = "{\"name\":\"John\", \"age\":20, \"address\":{\"street\":\"Wall Street\", \"city\":\"New York\"}}";
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(jsonString);
String xmlString = new XmlMapper().writeValueAsString(jsonNode);
Assertions.assertEquals("<ObjectNode><name>John</name><age>20</age><address><street>Wall Street</street><city>New York</city></address></ObjectNode>", xmlString);
}
@Test
public void givenJsonString_whenConvertToXMLUsingJacksonWithXMLDeclarationAndRoot_thenConverted() throws JsonProcessingException {
String jsonString = "{\"name\":\"John\", \"age\":20, \"address\":{\"street\":\"Wall Street\", \"city\":\"New York\"}}";
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(jsonString);
XmlMapper xmlMapper = new XmlMapper();
xmlMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_1_1, true);
String xmlString = xmlMapper.writer().withRootName("root").withDefaultPrettyPrinter().writeValueAsString(jsonNode);
Assertions.assertEquals("<?xml version='1.1' encoding='UTF-8'?>" + System.lineSeparator() +
"<root>" + System.lineSeparator() +
" <name>John</name>" + System.lineSeparator() +
" <age>20</age>" + System.lineSeparator() +
" <address>" + System.lineSeparator() +
" <street>Wall Street</street>" + System.lineSeparator() +
" <city>New York</city>" + System.lineSeparator() +
" </address>" + System.lineSeparator() +
"</root>" + System.lineSeparator(), xmlString);
}
@Test
public void givenJsonString_whenConvertToXMLUsingUnderscoreJava_thenConverted() {
String jsonString = "{\"name\":\"John\", \"age\":20}";
String xmlString = U.jsonToXml(jsonString);
Assertions.assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<root>\n" +
" <name>John</name>\n" +
" <age number=\"true\">20</age>\n" +
"</root>", xmlString);
}
@Test
public void givenJsonString_whenConvertToXMLUsingUnderscoreJavaWithoutAttributes_thenConverted() {
String jsonString = "{\"name\":\"John\", \"age\":20}";
String xmlString = U.jsonToXml(jsonString, U.JsonToXmlMode.REMOVE_ATTRIBUTES);
Assertions.assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<root>\n" +
" <name>John</name>\n" +
" <age>20</age>\n" +
"</root>", xmlString);
}
}

View File

@ -1,35 +0,0 @@
package com.baeldung.xml.validation;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.*;
class XmlValidatorUnitTest {
private static final String BAELDUNG_XML_PATH = "xml/validation/baeldung.xml";
private static final String PERSON_XSD_PATH = "xml/validation/person.xsd";
private static final String FULL_PERSON_XSD_PATH = "xml/validation/full-person.xsd";
@Test
public void givenValidXML_WhenIsValid_ThenTrue() throws IOException, SAXException {
assertTrue(new XmlValidator(PERSON_XSD_PATH, BAELDUNG_XML_PATH).isValid());
}
@Test
public void givenInvalidXML_WhenIsValid_ThenFalse() throws IOException, SAXException {
assertFalse(new XmlValidator(FULL_PERSON_XSD_PATH, BAELDUNG_XML_PATH).isValid());
}
@Test
public void givenValidXML_WhenListParsingExceptions_ThenNone() throws IOException, SAXException {
assertEquals(0, new XmlValidator(PERSON_XSD_PATH, BAELDUNG_XML_PATH).listParsingExceptions().size());
}
@Test
public void givenInvalidXML_WhenListParsingExceptions_ThenHasThree() throws IOException, SAXException {
assertEquals(3, new XmlValidator(FULL_PERSON_XSD_PATH, BAELDUNG_XML_PATH).listParsingExceptions().size());
}
}

View File

@ -1,87 +0,0 @@
package com.baeldung.xml2string;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.junit.Test;
import org.junit.Before;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.StringWriter;
import static org.junit.Assert.assertTrue;
public class XMLObjectToStringUnitTest {
private Document document;
@Before
public void setup() throws ParserConfigurationException {
// Create a DocumentBuilder
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
// Create a new Document
document = builder.newDocument();
// Create the root element
Element rootElement = document.createElement("root");
document.appendChild(rootElement);
// Create child elements
Element childElement1 = document.createElement("child1");
Element childElement2 = document.createElement("child2");
// Add text content to the child elements
childElement1.appendChild(document.createTextNode("This is child element 1"));
childElement2.appendChild(document.createTextNode("This is child element 2"));
// Append child elements to the root element
rootElement.appendChild(childElement1);
rootElement.appendChild(childElement2);
}
@Test
public void givenXMLDocument_whenUsingTransformer_thenConvertXMLToString() throws TransformerException {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
StringWriter stringWriter = new StringWriter();
transformer.transform(new DOMSource(document), new StreamResult(stringWriter));
String result = stringWriter.toString();
assertTrue(result.contains("<root>"));
assertTrue(result.contains("This is child element 1"));
assertTrue(result.contains("This is child element 2"));
}
@Test
public void givenXMLDocument_whenUsingXmlBeans_thenConvertXMLToString() {
try {
XmlObject xmlObject = XmlObject.Factory.parse(document);
XmlOptions options = new XmlOptions();
options.setSavePrettyPrint();
options.setUseDefaultNamespace();
options.setSaveAggressiveNamespaces();
String xmlString = xmlObject.xmlText(options);
xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + xmlString;
assertTrue(xmlString.contains("<root>"));
assertTrue(xmlString.contains("This is child element 1"));
assertTrue(xmlString.contains("This is child element 2"));
} catch (XmlException e) {
e.printStackTrace();
}
}
}

View File

@ -1,15 +1,15 @@
package com.ossez.xml;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
package com.isharkfly.xml;
import com.isharkfly.xml.XMLDocumentWriter;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
public class XMLDocumentWriterUnitTest {

Some files were not shown because too many files have changed in this diff Show More