Author: veithen
Date: Sun Nov 22 20:52:50 2015
New Revision: 1715694

URL: http://svn.apache.org/viewvc?rev=1715694&view=rev
Log:
Group together some code related to character classes defined by the XML 
specification.

Added:
    webservices/axiom/trunk/components/   (with props)
    webservices/axiom/trunk/components/pom.xml   (with props)
    webservices/axiom/trunk/components/xml-utils/   (with props)
    webservices/axiom/trunk/components/xml-utils/pom.xml   (with props)
    webservices/axiom/trunk/components/xml-utils/src/
    webservices/axiom/trunk/components/xml-utils/src/main/
    webservices/axiom/trunk/components/xml-utils/src/main/java/
    webservices/axiom/trunk/components/xml-utils/src/main/java/org/
    webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/
    webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/
    
webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/
    
webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/xml/
    
webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/xml/XMLChar.java
   (with props)
Modified:
    webservices/axiom/trunk/aspects/dom-aspects/pom.xml
    
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/NSUtil.java
    webservices/axiom/trunk/implementations/pom.xml
    webservices/axiom/trunk/pom.xml
    webservices/axiom/trunk/testing/soap-testsuite/pom.xml
    
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java

Modified: webservices/axiom/trunk/aspects/dom-aspects/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/pom.xml?rev=1715694&r1=1715693&r2=1715694&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/pom.xml (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/pom.xml Sun Nov 22 20:52:50 2015
@@ -44,6 +44,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>xml-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.aspectj</groupId>
             <artifactId>aspectjrt</artifactId>
         </dependency>

Modified: 
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/NSUtil.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/NSUtil.java?rev=1715694&r1=1715693&r2=1715694&view=diff
==============================================================================
--- 
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/NSUtil.java
 (original)
+++ 
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/NSUtil.java
 Sun Nov 22 20:52:50 2015
@@ -18,6 +18,9 @@
  */
 package org.apache.axiom.dom;
 
+import static org.apache.axiom.util.xml.XMLChar.isNameChar;
+import static org.apache.axiom.util.xml.XMLChar.isNameStartChar;
+
 import javax.xml.XMLConstants;
 
 import org.w3c.dom.DOMException;
@@ -25,22 +28,6 @@ import org.w3c.dom.DOMException;
 public final class NSUtil {
     private NSUtil() {}
     
-    // This is the NameStartChar production from 
http://www.w3.org/TR/2008/REC-xml-20081126/
-    private static boolean isNameStartChar(char c) {
-        return c == ':' || 'A' <= c && c <= 'Z' || c == '_' || 'a' <= c && c 
<= 'z' || 0xC0 <= c && c <= 0xD6
-                || 0xD8 <= c && c <= 0xF6 || 0xF8 <= c && c <= 0x2FF || 0x370 
<= c && c <= 0x37D
-                || 0x37F <= c && c <= 0x1FFF || 0x200C <= c && c <= 0x200D
-                || 0x2070 <= c && c <= 0x218F || 0x2C00 <= c && c <= 0x2FEF
-                || 0x3001 <= c && c <= 0xD7FF || 0xF900 <= c && c <= 0xFDCF
-                || 0xFDF0 <= c && c <= 0xFFFD || 0x10000 <= c && c <= 0xEFFFF;
-    }
-    
-    // This is the NameChar production from 
http://www.w3.org/TR/2008/REC-xml-20081126/
-    private static boolean isNameChar(char c) {
-        return isNameStartChar(c) || c == '-' || c == '.' || '0' <= c && c <= 
'9' || c == 0xB7
-                || 0x0300 <= c && c <= 0x036F || 0x203F <= c && c <= 0x2040;
-    }
-    
     public static void validateName(String name) throws DOMException {
         if (name.length() == 0) {
             throw 
DOMExceptionTranslator.newDOMException(DOMException.INVALID_CHARACTER_ERR);

Propchange: webservices/axiom/trunk/components/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Nov 22 20:52:50 2015
@@ -0,0 +1,3 @@
+.project
+.settings
+target

Added: webservices/axiom/trunk/components/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/components/pom.xml?rev=1715694&view=auto
==============================================================================
--- webservices/axiom/trunk/components/pom.xml (added)
+++ webservices/axiom/trunk/components/pom.xml Sun Nov 22 20:52:50 2015
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ws.commons.axiom</groupId>
+        <artifactId>axiom</artifactId>
+        <version>1.2.17-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>components</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>xml-utils</module>
+    </modules>
+</project>

Propchange: webservices/axiom/trunk/components/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axiom/trunk/components/xml-utils/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Nov 22 20:52:50 2015
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: webservices/axiom/trunk/components/xml-utils/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/components/xml-utils/pom.xml?rev=1715694&view=auto
==============================================================================
--- webservices/axiom/trunk/components/xml-utils/pom.xml (added)
+++ webservices/axiom/trunk/components/xml-utils/pom.xml Sun Nov 22 20:52:50 
2015
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ws.commons.axiom</groupId>
+        <artifactId>components</artifactId>
+        <version>1.2.17-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>xml-utils</artifactId>
+    <packaging>bundle</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: webservices/axiom/trunk/components/xml-utils/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/xml/XMLChar.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/xml/XMLChar.java?rev=1715694&view=auto
==============================================================================
--- 
webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/xml/XMLChar.java
 (added)
+++ 
webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/xml/XMLChar.java
 Sun Nov 22 20:52:50 2015
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.xml;
+
+/**
+ * Contains utility methods to test characters for various properties defined 
by the XML
+ * specification.
+ */
+public final class XMLChar {
+    private XMLChar() {}
+    
+    /**
+     * Determine if the given character is whitespace according to the XML 
specification.
+     * 
+     * @param c
+     *            the character to examine
+     * @return {@code true} if the character is whitespace, {@code false} 
otherwise
+     */
+    public static boolean isWhitespace(char c) {
+        return c == ' ' || c == '\r' || c == '\n' || c == '\t';
+    }
+    
+    /**
+     * Determine if the given character matches the <a
+     * 
href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameStartChar";>{@code 
NameStartChar}</a>
+     * production in the XML specification.
+     * 
+     * @param c
+     *            the character to examine
+     * @return {@code true} if the character is name start char, {@code false} 
otherwise
+     */
+    public static boolean isNameStartChar(char c) {
+        return c == ':' || 'A' <= c && c <= 'Z' || c == '_' || 'a' <= c && c 
<= 'z' || 0xC0 <= c && c <= 0xD6
+                || 0xD8 <= c && c <= 0xF6 || 0xF8 <= c && c <= 0x2FF || 0x370 
<= c && c <= 0x37D
+                || 0x37F <= c && c <= 0x1FFF || 0x200C <= c && c <= 0x200D
+                || 0x2070 <= c && c <= 0x218F || 0x2C00 <= c && c <= 0x2FEF
+                || 0x3001 <= c && c <= 0xD7FF || 0xF900 <= c && c <= 0xFDCF
+                || 0xFDF0 <= c && c <= 0xFFFD || 0x10000 <= c && c <= 0xEFFFF;
+    }
+    
+    /**
+     * Determine if the given character matches the <a
+     * href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar";>{@code 
NameChar}</a>
+     * production in the XML specification.
+     * 
+     * @param c
+     *            the character to examine
+     * @return {@code true} if the character is name char, {@code false} 
otherwise
+     */
+    public static boolean isNameChar(char c) {
+        return isNameStartChar(c) || c == '-' || c == '.' || '0' <= c && c <= 
'9' || c == 0xB7
+                || 0x0300 <= c && c <= 0x036F || 0x203F <= c && c <= 0x2040;
+    }
+}

Propchange: 
webservices/axiom/trunk/components/xml-utils/src/main/java/org/apache/axiom/util/xml/XMLChar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/implementations/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/pom.xml?rev=1715694&r1=1715693&r2=1715694&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/pom.xml (original)
+++ webservices/axiom/trunk/implementations/pom.xml Sun Nov 22 20:52:50 2015
@@ -88,6 +88,7 @@
                     <artifactSet>
                         <includes>
                             <include>${project.groupId}:*-aspects</include>
+                            <include>${project.groupId}:xml-utils</include>
                             <include>org.aspectj:aspectjrt</include>
                         </includes>
                     </artifactSet>

Modified: webservices/axiom/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/pom.xml?rev=1715694&r1=1715693&r2=1715694&view=diff
==============================================================================
--- webservices/axiom/trunk/pom.xml (original)
+++ webservices/axiom/trunk/pom.xml Sun Nov 22 20:52:50 2015
@@ -223,6 +223,7 @@
         <module>testing</module>
         <module>aspects</module>
         <module>implementations</module>
+        <module>components</module>
     </modules>
 
     <scm>

Modified: webservices/axiom/trunk/testing/soap-testsuite/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/pom.xml?rev=1715694&r1=1715693&r2=1715694&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/pom.xml (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/pom.xml Sun Nov 22 20:52:50 
2015
@@ -45,6 +45,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>xml-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
         </dependency>

Modified: 
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java?rev=1715694&r1=1715693&r2=1715694&view=diff
==============================================================================
--- 
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java
 (original)
+++ 
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java
 Sun Nov 22 20:52:50 2015
@@ -18,6 +18,8 @@
  */
 package org.apache.axiom.ts.soap;
 
+import static org.apache.axiom.util.xml.XMLChar.isWhitespace;
+
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.HashMap;
@@ -206,10 +208,6 @@ final class ConvertedSOAPSampleContent e
         return null;
     }
     
-    private static boolean isWhitespace(char c) {
-        return " \r\n\t".indexOf(c) != -1;
-    }
-    
     private static String transform(String text, TextTransformer transformer) {
         int start = 0;
         while (isWhitespace(text.charAt(start))) {


Reply via email to