Properties XML Reader

Round trip java properties files to an extended XML format, including comments, retaining 100% fidelity.

License

License

GroupId

GroupId

com.brentcroft.tools
ArtifactId

ArtifactId

pxr
Last Version

Last Version

01.01.05
Release Date

Release Date

Type

Type

jar
Description

Description

Properties XML Reader
Round trip java properties files to an extended XML format, including comments, retaining 100% fidelity.
Project URL

Project URL

http://github.com/brentcroft/properties-reader
Source Code Management

Source Code Management

http://github.com/brentcroft/properties-reader

Download pxr

How to add to project

<!-- https://jarcasting.com/artifacts/com.brentcroft.tools/pxr/ -->
<dependency>
    <groupId>com.brentcroft.tools</groupId>
    <artifactId>pxr</artifactId>
    <version>01.01.05</version>
</dependency>
// https://jarcasting.com/artifacts/com.brentcroft.tools/pxr/
implementation 'com.brentcroft.tools:pxr:01.01.05'
// https://jarcasting.com/artifacts/com.brentcroft.tools/pxr/
implementation ("com.brentcroft.tools:pxr:01.01.05")
'com.brentcroft.tools:pxr:jar:01.01.05'
<dependency org="com.brentcroft.tools" name="pxr" rev="01.01.05">
  <artifact name="pxr" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.brentcroft.tools', module='pxr', version='01.01.05')
)
libraryDependencies += "com.brentcroft.tools" % "pxr" % "01.01.05"
[com.brentcroft.tools/pxr "01.01.05"]

Dependencies

compile (1)

Group / Artifact Type Version
com.brentcroft.tools : materializer jar 00.01.05

provided (2)

Group / Artifact Type Version
org.projectlombok : lombok jar RELEASE
net.java.dev.javacc : javacc jar 7.0.10

test (2)

Group / Artifact Type Version
junit : junit jar RELEASE
com.tngtech.jgiven : jgiven-junit jar 0.18.2

Project Modules

There are no modules declared in this project.

properties-reader

Maven Central

JavaCC grammar and kit to generate SAX events describing a java properties file, and an XSL transform to regenerate the original file.

Java 1.5+

Following, and extending, on the decomposition of Java properties text specified by Apache PropertiesConfiguration, this kit attempts to provide 100% round trip fidelity between Java properties text and a simple XML form (extending the Java properties XML specification) via a simple object model (PxrProperties).

The XML form is further extended to support insert, update and delete actions on all parts of a properties text.

Summary operations are provided in:

JavaCC grammar

A JavaCC grammar generates the PxrParser which parses PxrProperties objects from properties text:

PxrReader

A PxrReader emits SAX events from a PxrProperties object.

For example, given the following properties text:

#sample header

color=red

#the size is large
size=large

#sample footer

when the properties text is parsed the SAX events will be:

<properties>
    <comment key="_header">
        <![CDATA[#sample header]]>
    </comment>
    <comment key="color"/>
    <entry key="color" index="1">red</entry>
    <comment key="size" lines-before="1">
        <![CDATA[#the size is large]]>
    </comment>
    <entry key="size" index="2">large</entry>
    <comment key="_footer" lines-before="1" eol="0">
        <![CDATA[#sample footer]]>
    </comment>
</properties>

PxrWriter

A PxrWriter handles SAX events to create or update a PxrProperties object.

For example, given the properties text:

color=red
size=large

when the following SAX events are handled:

<update>
    <entry key='color'>
        <text>blue, </text>
        <text prefix='    ' >red</text>
    </entry>
</update>

Then the properties text will be:

color=blue, \
    red
size=large

XSL Transform

An XSL transform re-constitutes properties text from SAX events:

com.brentcroft.tools

Brentcroft

Good at grasping things, and then twisting them.

Versions

Version
01.01.05
01.01.04
01.01.03
01.01.02
01.01.01