Skip to content

Commit

Permalink
refactor package name to galinet.ch
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsaellen committed May 4, 2017
1 parent 3e338da commit c532ffe
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
33 changes: 32 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.aellen.xml</groupId>
<groupId>ch.galinet.xml</groupId>
<artifactId>xsd-hierarchy</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
Expand All @@ -20,20 +20,51 @@
</plugins>
</build>

<distributionManagement>
<repository>
<id>artifactory-releases</id>
<name>artifactory.pnet.ch-releases</name>
<url>http://artifactory.pnet.ch/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>artifactory-snapshots</id>
<name>artifactory.pnet.ch-snapshots</name>
<url>http://artifactory.pnet.ch/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>

<dependencies>
<!-- Third party tools -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-osgi</artifactId>
<version>2.3.0-b170127.1453</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
</project>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aellen.xml.xsd;
package ch.galinet.xml.xsdhierarchy;

import javax.xml.namespace.NamespaceContext;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aellen.xml.xsd;
package ch.galinet.xml.xsdhierarchy;

/**
* Created by aellenn on 28.04.2017.
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/ch/galinet/xml/xsdhierarchy/XsdHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package ch.galinet.xml.xsdhierarchy;

import org.apache.commons.lang3.tuple.Pair;
import org.jdom.Element;

import java.util.ArrayList;
import java.util.List;

/**
* Created by aellenn on 04.05.2017.
*/
public class XsdHelper {

public static Pair<String, MapNamespaceContext> generateScdPath(Element element) {
List<String> path = new ArrayList<>();
final MapNamespaceContext ctx = new MapNamespaceContext();

while (element.getParent() instanceof Element) {
path.add(0, !element.getNamespacePrefix().equals("") ? element.getNamespacePrefix() + ":" : "" + element.getName());
ctx.register(element.getNamespacePrefix(), element.getNamespace().getURI());
element = element.getParentElement();
}

final StringBuilder sb = new StringBuilder();
for (int i = 0; i < path.size(); i++) {
if (i == 0) sb.append("/");
sb.append(path.get(i));
if (i < path.size() - 1) sb.append("//");
}
return Pair.of(sb.toString(), ctx);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aellen.xml.xsd;
package ch.galinet.xml.xsdhierarchy;

import com.sun.xml.xsom.impl.ComplexTypeImpl;
import com.sun.xml.xsom.impl.ElementDecl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aellen.xml.xsd;
package ch.galinet.xml.xsdhierarchy;

import org.junit.Assert;
import org.junit.Before;
Expand Down

0 comments on commit c532ffe

Please sign in to comment.