Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 77042 invoked from network); 5 Aug 2008 21:33:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Aug 2008 21:33:22 -0000 Received: (qmail 22394 invoked by uid 500); 5 Aug 2008 21:33:21 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 22336 invoked by uid 500); 5 Aug 2008 21:33:21 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 22327 invoked by uid 99); 5 Aug 2008 21:33:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2008 14:33:21 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2008 21:32:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B04FD238889E; Tue, 5 Aug 2008 14:32:31 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r682962 - in /cxf/branches/2.0.x-fixes: ./ common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java Date: Tue, 05 Aug 2008 21:32:29 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080805213231.B04FD238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Tue Aug 5 14:32:27 2008 New Revision: 682962 URL: http://svn.apache.org/viewvc?rev=682962&view=rev Log: Merged revisions 680435 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r680435 | bimargulies | 2008-07-28 14:28:43 -0400 (Mon, 28 Jul 2008) | 2 lines Suppress PIs from Stax document copies if we're not writing the prolog. ........ Modified: cxf/branches/2.0.x-fixes/ (props changed) cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java cxf/branches/2.0.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Aug 5 14:32:27 2008 @@ -1 +1 @@ -/cxf/trunk:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597 +/cxf/trunk:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435 Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=682962&r1=682961&r2=682962&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original) +++ cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Tue Aug 5 14:32:27 2008 @@ -441,7 +441,10 @@ NodeList rootChildren = d.getChildNodes(); for (int rcx = 0; rcx < rootChildren.getLength(); rcx++) { Node rootChild = rootChildren.item(rcx); - writeNode(rootChild, writer, repairing); + // don't write PIs if we're not writing a prolog. + if (writeProlog || rootChild.getNodeType() == Node.ELEMENT_NODE) { + writeNode(rootChild, writer, repairing); + } } if (writeProlog) { Modified: cxf/branches/2.0.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java?rev=682962&r1=682961&r2=682962&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java (original) +++ cxf/branches/2.0.x-fixes/common/common/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java Tue Aug 5 14:32:27 2008 @@ -232,4 +232,19 @@ assertTrue(output.contains("")); assertTrue(output.contains("")); } + + @Test + public void testRootPInoProlog() throws Exception { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + Document doc = dbf.newDocumentBuilder().parse(getTestStream("./resources/rootMaterialTest.xml")); + StringWriter sw = new StringWriter(); + XMLStreamWriter swriter = StaxUtils.createXMLStreamWriter(sw); + StaxUtils.writeDocument(doc, swriter, false, false); + swriter.flush(); + swriter.close(); + String output = sw.toString(); + assertFalse(output.contains("")); + assertFalse(output.contains("")); + } }