https://github.com/codeclou/java-xml-grepper
You want to get a value from your xml file? Then this is for you
https://github.com/codeclou/java-xml-grepper
grep java xpath
Last synced: about 1 year ago
JSON representation
You want to get a value from your xml file? Then this is for you
- Host: GitHub
- URL: https://github.com/codeclou/java-xml-grepper
- Owner: codeclou
- License: mit
- Created: 2018-04-13T10:12:43.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-23T08:47:37.000Z (almost 7 years ago)
- Last Synced: 2025-01-22T16:09:24.911Z (over 1 year ago)
- Topics: grep, java, xpath
- Language: Java
- Homepage:
- Size: 113 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Java XML Grepper
> You want to get a value from your xml file using XPath? Then this is for you. Easily grep the version from your POM.
[](https://github.com/codeclou/java-xml-grepper)
----
### Is this for me?
If you want to grep e.g. the version of a `pom.xml` file to commandline then this is for you.
```xml
4.0.0
io.codeclou
java-xml-grepper
1.4.5
```
----
### Usage
With current folder containing a `pom.xml` file and you want to print out the version on commandline.
The `-x` parameter accepts XPath expressions that can be cast to String.
```
# INSTALL
curl -L -o java-xml-grepper.jar \
https://github.com/codeclou/java-xml-grepper/releases/download/1.0.0/java-xml-grepper.jar
# RUN
java -jar java-xml-grepper.jar \
-f pom.xml \
-x /project/version
# PRINTS (example)
1.0.1
```
If something happens like parsing errors, file not found a.s.o the **exit code will be 1**.
Otherwise the exit code will be 0 and it will only print the grepped output.
-----
### Demo
```
git clone https://github.com/codeclou/java-xml-grepper.git src
cd src
curl -L -o java-xml-grepper.jar \
https://github.com/codeclou/java-xml-grepper/releases/download/1.0.0/java-xml-grepper.jar
java -jar java-xml-grepper.jar \
-f pom.xml \
-x /project/version
# Should print the version
```
----
### License
[MIT](https://github.com/codeclou/java-xml-grepper/blob/master/LICENSE) © [Bernhard Grünewaldt](https://github.com/clouless)