cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1178557 - in /cxf/trunk/common/common/src: main/java/org/apache/cxf/staxutils/transform/ test/java/org/apache/cxf/staxutils/transform/
Date Mon, 03 Oct 2011 20:28:31 GMT
Author: sergeyb
Date: Mon Oct  3 20:28:30 2011
New Revision: 1178557

URL: http://svn.apache.org/viewvc?rev=1178557&view=rev
Log:
[CXF-3843] Replacing ':' content sep with '=' to provide for future xpath extensions - Aki's
idea

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
    cxf/trunk/common/common/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java?rev=1178557&r1=1178556&r2=1178557&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
Mon Oct  3 20:28:30 2011
@@ -111,10 +111,10 @@ public class InTransformReader extends D
                 attributesIndexed = false;
                 final QName theName = super.getName();
                 final ElementProperty appendProp = inAppendMap.remove(theName);
-                final boolean replaced = appendProp != null && theName.equals(appendProp.getName());
+                final boolean replaceContent = appendProp != null && theName.equals(appendProp.getName());
                 
                 final boolean dropped = inDropSet.contains(theName);
-                if (appendProp != null && !replaced) {
+                if (appendProp != null && !replaceContent) {
                     
                     if (appendProp.isChild()) {
                         // append-post-*
@@ -150,17 +150,16 @@ public class InTransformReader extends D
                     return XMLStreamConstants.END_ELEMENT;
                 }
                 
-                if (appendProp != null && appendProp.isChild()) {
+                if (appendProp != null && appendProp.isChild() && !replaceContent)
{
                     // append-post-*
                     currentQName = expected;
-                } else if (appendProp != null && !appendProp.isChild()
-                           && !replaced) {
+                } else if (appendProp != null && !appendProp.isChild() &&
!replaceContent) {
                     // append-pre-*
                     pushBackQName = expected;
                 } else {
                     // no append
                     currentQName = expected;
-                    if (replaced) {
+                    if (replaceContent) {
                         replaceText = appendProp.getText();
                     }
                     pushElement();

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java?rev=1178557&r1=1178556&r2=1178557&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/transform/TransformUtils.java
Mon Oct  3 20:28:30 2011
@@ -127,7 +127,7 @@ public final class TransformUtils {
                 
                 // if the content delimiter is present in the value, extract the content
                 int d = value.indexOf('}');
-                d = value.indexOf(':', d < 0 ? 0 : d);
+                d = value.indexOf('=', d < 0 ? 0 : d);
                 if (d > 0) {
                     text = value.substring(d + 1);
                     value = value.substring(0, d);

Modified: cxf/trunk/common/common/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java?rev=1178557&r1=1178556&r2=1178557&view=diff
==============================================================================
--- cxf/trunk/common/common/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
(original)
+++ cxf/trunk/common/common/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java
Mon Oct  3 20:28:30 2011
@@ -61,7 +61,7 @@ public class InTransformReaderTest exten
         XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
         reader = new InTransformReader(reader, 
                                         null,
-                                        Collections.singletonMap("{http://bar}a", "{http://bar}a:1
2 3"),
+                                        Collections.singletonMap("{http://bar}a", "{http://bar}a=1
2 3"),
                                         null, 
                                         null, false);
         
@@ -78,7 +78,7 @@ public class InTransformReaderTest exten
         XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
         reader = new InTransformReader(reader, 
                                        Collections.singletonMap("{http://bar}*", "{http://foo}*"),
-                                       Collections.singletonMap("{http://bar}a", "{http://bar}a:1
2 3"),
+                                       Collections.singletonMap("{http://bar}a", "{http://bar}a=1
2 3"),
                                        null, 
                                        null, false);
         
@@ -307,7 +307,7 @@ public class InTransformReaderTest exten
     public void testReadWithAppendPreInclude1() throws Exception {
         Map<String, String> appendElements = new HashMap<String, String>();
         appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}ItemId",
-                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType:ASIN");
+                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType=ASIN");
         transformStreamAndCompare("../resources/amazonIn1.xml", "../resources/amazon.xml",
                                   null, appendElements, null, null, null);
         
@@ -317,7 +317,7 @@ public class InTransformReaderTest exten
     public void testReadWithAppendPreInclude2() throws Exception {
         Map<String, String> appendElements = new HashMap<String, String>();
         appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}ItemId",
-                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType:ASIN");
+                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType=ASIN");
         transformStreamAndCompare("../resources/amazonIn1nospace.xml", "../resources/amazon.xml",
                                   null, appendElements, null, null, null);
         
@@ -351,7 +351,7 @@ public class InTransformReaderTest exten
     public void testReadWithAppendPostInclude1() throws Exception {
         Map<String, String> appendElements = new HashMap<String, String>();
         appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}Request/",
-                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType:ASIN");
+                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType=ASIN");
         transformStreamAndCompare("../resources/amazonIn1.xml", "../resources/amazon.xml",
                                   null, appendElements, null, null, null);
         
@@ -361,7 +361,7 @@ public class InTransformReaderTest exten
     public void testReadWithAppendPostInclude2() throws Exception {
         Map<String, String> appendElements = new HashMap<String, String>();
         appendElements.put("{http://xml.amazon.com/AWSECommerceService/2004-08-01}Request/",
-                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType:ASIN");
+                           "{http://xml.amazon.com/AWSECommerceService/2004-08-01}IdType=ASIN");
         transformStreamAndCompare("../resources/amazonIn1nospace.xml", "../resources/amazon.xml",
                                   null, appendElements, null, null, null);
         



Mime
View raw message