Fixed bug: insertNodes inserted nodes in reverse order

git-svn-id: https://brutex.net/svn/xservices/trunk@158 e7e49efb-446e-492e-b9ec-fcafc1997a86
xservices-jre6
Brian Rosenberger 2014-06-15 09:24:33 +00:00
parent bf6af8a056
commit 7e6b6bef40
1 changed files with 9 additions and 1 deletions

View File

@ -29,12 +29,14 @@ import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import javax.jws.WebService; import javax.jws.WebService;
import javax.ws.rs.NotAuthorizedException;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter; import javax.xml.stream.XMLStreamWriter;
import net.brutex.xservices.security.DirectoryPermission;
import net.brutex.xservices.types.AttributeType; import net.brutex.xservices.types.AttributeType;
import net.brutex.xservices.types.NamespaceListType; import net.brutex.xservices.types.NamespaceListType;
import net.brutex.xservices.types.NamespaceType; import net.brutex.xservices.types.NamespaceType;
@ -42,6 +44,7 @@ import net.brutex.xservices.types.StringSplitType;
import net.brutex.xservices.types.ant.FileResource; import net.brutex.xservices.types.ant.FileResource;
import net.brutex.xservices.ws.XServicesFault; import net.brutex.xservices.ws.XServicesFault;
import net.brutex.xservices.ws.XmlService; import net.brutex.xservices.ws.XmlService;
import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMCloneOptions; import org.apache.axiom.om.OMCloneOptions;
@ -56,6 +59,8 @@ import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLBuilderFactory; import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.xpath.AXIOMXPath; import org.apache.axiom.om.xpath.AXIOMXPath;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.UnauthorizedException;
import org.jaxen.JaxenException; import org.jaxen.JaxenException;
import org.jaxen.SimpleNamespaceContext; import org.jaxen.SimpleNamespaceContext;
@ -420,6 +425,7 @@ public class XmlServiceImpl implements XmlService {
private OMDocument replaceNodes(OMDocument xmldocument, AXIOMXPath axp, OMDocument xmlfragment) throws XServicesFault { private OMDocument replaceNodes(OMDocument xmldocument, AXIOMXPath axp, OMDocument xmlfragment) throws XServicesFault {
List<?> olist = null; List<?> olist = null;
try { try {
olist = axp.selectNodes(xmldocument.getOMDocumentElement()); olist = axp.selectNodes(xmldocument.getOMDocumentElement());
@ -469,7 +475,7 @@ public class XmlServiceImpl implements XmlService {
while (children.hasNext()) { while (children.hasNext()) {
OMNode container = (OMNode) children.next(); OMNode container = (OMNode) children.next();
match.insertSiblingAfter((OMNode) container.clone(new OMCloneOptions())); match.insertSiblingBefore((OMNode) container.clone(new OMCloneOptions()));
} }
match.detach(); match.detach();
} }
@ -503,4 +509,6 @@ public class XmlServiceImpl implements XmlService {
logger.debug("Setting source xml string encoding to '"+encoding+"'"); logger.debug("Setting source xml string encoding to '"+encoding+"'");
return encoding; return encoding;
} }
} }