You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/01/20 18:23:04 UTC

svn commit: r370866 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/utils/ doom/src/org/apache/axis2/om/impl/dom/ xml/src/org/apache/axis2/om/ xml/src/org/apache/axis2/om/impl/llom/ xml/src/org/apache/axis2/om/impl/llom...

Author: chinthaka
Date: Fri Jan 20 09:22:39 2006
New Revision: 370866

URL: http://svn.apache.org/viewcvs?rev=370866&view=rev
Log:
Adding a way for the OMElement to store the location information.

Added:
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/EmptyOMLocation.java
Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java
    webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java
    webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/ElementImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java?rev=370866&r1=370865&r2=370866&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java Fri Jan 20 09:22:39 2006
@@ -3,6 +3,8 @@
 import org.apache.axis2.databinding.ADBBean;
 import org.apache.axis2.om.OMAttribute;
 import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.OMStAXWrapper;
+import org.apache.axis2.om.impl.llom.EmptyOMLocation;
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
@@ -122,50 +124,50 @@
      * @param properties - this should contain all the stuff that stax events should be generated.
      *                   Lets take an example of a bean.
      *                   <pre>
-     *                       <Person>
-     *                           <DependentOne>
-     *                              <Name>FooTwo</Name>
-     *                              <Age>25</Age>
-     *                              <Sex>Male</Sex>
-     *                              </DependentOne>
-     *                      </Person>
-     *                   <p/>
-     *                   <p/>
-     *                  so the mapping bean for this is
-     *                  class Person {
-     *                     String Name;
-     *                     Dependent dependentOne;
-     *                  }
-     *                   <p/>
-     *                   <p/>
-     *                                                                                                                                                                     }
-     *                   <p/>
-     *                   <p/>
-     *                  So if one needs to generate pull events out of a Person bean, the array he needs
-     *                  to pass is like this.
-     *                  ---------------------------------------------------------------------------------------------------
-     *                  | "Name" | "FooOne" | QName("DependentOne") | Dependent object| null | Array of Dependent objects |
-     *                  ---------------------------------------------------------------------------------------------------
-     *                  This DependentObject can either be an ADBBean, OMElement or a POJO. If its an ADBBean
-     *                  We directly get the pull parser from that. If not we create a reflection based
-    pull parser for that java bean.
-
-    <p/>
-     *                   <p/>
-    This is the how the passed array should look like
-     *                           Key             Value
-     *                         String          String
-     *                         QName           ADBBean, OMElement, Bean, String
-    String          String[]
-    QName           Object[] - this contains only one type of objects
-     *                   <p/>
-     *                   <p/>
-    This is how the passed attribute array should look like
-    Key             Value
-    null            OMAttribute[]
-    QName           String
-    String          String
-    </pre>
+     *                                         <Person>
+     *                                             <DependentOne>
+     *                                                <Name>FooTwo</Name>
+     *                                                <Age>25</Age>
+     *                                                <Sex>Male</Sex>
+     *                                                </DependentOne>
+     *                                        </Person>
+     *                   <p/>
+     *                   <p/>
+     *                                    so the mapping bean for this is
+     *                                    class Person {
+     *                                       String Name;
+     *                                       Dependent dependentOne;
+     *                                    }
+     *                   <p/>
+     *                   <p/>
+     *                                                                                                                                                                                       }
+     *                   <p/>
+     *                   <p/>
+     *                                    So if one needs to generate pull events out of a Person bean, the array he needs
+     *                                    to pass is like this.
+     *                                    ---------------------------------------------------------------------------------------------------
+     *                                    | "Name" | "FooOne" | QName("DependentOne") | Dependent object| null | Array of Dependent objects |
+     *                                    ---------------------------------------------------------------------------------------------------
+     *                                    This DependentObject can either be an ADBBean, OMElement or a POJO. If its an ADBBean
+     *                                    We directly get the pull parser from that. If not we create a reflection based
+     *                   pull parser for that java bean.
+     *                   <p/>
+     *                   <p/>
+     *                   <p/>
+     *                   This is the how the passed array should look like
+     *                                             Key             Value
+     *                                           String          String
+     *                                           QName           ADBBean, OMElement, Bean, String
+     *                   String          String[]
+     *                   QName           Object[] - this contains only one type of objects
+     *                   <p/>
+     *                   <p/>
+     *                   This is how the passed attribute array should look like
+     *                   Key             Value
+     *                   null            OMAttribute[]
+     *                   QName           String
+     *                   String          String
+     *                   </pre>
      * @return XMLStreamReader
      */
     public static XMLStreamReader createPullParser(QName adbBeansQName, Object[] properties, Object[] attributes) {
@@ -271,10 +273,10 @@
                     complexArrayQName = (QName) o;
                     getPullParser(complexArray[secondArrayIndex], complexArrayQName);
                     processingComplexArray = true;
-                } else if(object instanceof String) {
+                } else if (object instanceof String) {
                     processingADBNameValuePair = true;
-                    return processADBNameValuePair((QName)o, (String) object);
-                }else {
+                    return processADBNameValuePair((QName) o, (String) object);
+                } else {
                     getPullParser(object, (QName) o);
                 }
                 accessingChildPullParser = true;
@@ -298,24 +300,24 @@
 
                 } else if (property instanceof String) {
                     String simplePropertyValue = (String) properties[currentIndex];
-                    if(ELEMENT_TEXT.equals(simplePropertyName)){
+                    if (ELEMENT_TEXT.equals(simplePropertyName)) {
                         // this is element text.
                         processingElementText = true;
                     }
                     processingADBNameValuePair = true;
                     return processADBNameValuePair(new QName(simplePropertyName), simplePropertyValue);
-                }else if (property == null){
+                } else if (property == null) {
                     // a null value has a special resolution, it should produce an element with nil="true" attribute and
                     // no content
                     //add to the attributes nil="true" to the list
-                    if (attributesList==null || attributesList.size()==0){
+                    if (attributesList == null || attributesList.size() == 0) {
                         attributesList = new ArrayList();
                         attributesList.add(NIL_QNAME);
                         attributesList.add("true");
-                    }else{
+                    } else {
                         //since we append the nil attribute at the end, check the nil attrib at the end
                         //if it's already there, move on
-                        if (!attributesList.contains(NIL_QNAME)){
+                        if (!attributesList.contains(NIL_QNAME)) {
                             attributesList.add(NIL_QNAME);
                             attributesList.add("true");
                         }
@@ -332,7 +334,7 @@
     }
 
     private void removeDeclaredNamespaces() {
-        if(declaredNamespaces != null){
+        if (declaredNamespaces != null) {
             Iterator declaredNamespacesURIIter = declaredNamespaces.keySet().iterator();
             while (declaredNamespacesURIIter.hasNext()) {
                 String s = (String) declaredNamespacesURIIter.next();
@@ -386,7 +388,7 @@
                     checkNamespaceList(qName.getNamespaceURI(), qName.getPrefix());
                     attributesList.add(qName);
                     attributesList.add(attributes[i + 1]);
-                }else if (key instanceof String) {
+                } else if (key instanceof String) {
                     String keyString = (String) key;
                     attributesList.add(new QName(keyString));
                     attributesList.add(attributes[i + 1]);
@@ -669,7 +671,7 @@
     }
 
     public Location getLocation() {
-        throw new UnsupportedOperationException("Yet to be implemented !!");
+        return new EmptyOMLocation();
     }
 
     public String getVersion() {
@@ -705,7 +707,7 @@
 
     private int processADBNameValuePair(QName simplePropertyName, Object simplePropertyValue) {
         int event = 0;
-        if(processingElementText){
+        if (processingElementText) {
             this.parserInformation.setText(ConverterUtil.convertToString(simplePropertyValue));
             finishedProcessingNameValuePair = true;
             event = XMLStreamConstants.CHARACTERS;
@@ -716,8 +718,8 @@
             nameValuePairStartElementProcessed = true;
             finishedProcessingNameValuePair = false;
             //Forcibly set nameValuePairTextProcessed to avoid a character event
-            if (simplePropertyValue==null){
-                nameValuePairTextProcessed=true;
+            if (simplePropertyValue == null) {
+                nameValuePairTextProcessed = true;
             }
         } else if (nameValuePairStartElementProcessed && !nameValuePairTextProcessed) {
             event = XMLStreamConstants.CHARACTERS;

Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java?rev=370866&r1=370865&r2=370866&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/DOMStAXWrapper.java Fri Jan 20 09:22:39 2006
@@ -25,6 +25,7 @@
 import org.apache.axis2.om.OMText;
 import org.apache.axis2.om.OMXMLParserWrapper;
 import org.apache.axis2.om.impl.llom.exception.OMStreamingException;
+import org.apache.axis2.om.impl.llom.EmptyOMLocation;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Node;
 
@@ -964,7 +965,7 @@
      * @return Returns Location.
      */
     public Location getLocation() {
-        throw new UnsupportedOperationException();
+        return new EmptyOMLocation();
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/ElementImpl.java?rev=370866&r1=370865&r2=370866&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/ElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/om/impl/dom/ElementImpl.java Fri Jan 20 09:22:39 2006
@@ -55,6 +55,8 @@
 public class ElementImpl extends ParentNode implements Element, OMElement,
         OMConstants {
 
+    private int lineNumber;
+
     protected OMNamespace namespace;
 
     protected String localName;
@@ -1148,6 +1150,14 @@
         ElementImpl elem = (ElementImpl) (new StAXOMBuilder(new OMDOMFactory(),
                 this.getXMLStreamReader(true))).getDocumentElement();
         return elem;
+    }
+
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    public int getLineNumber() {
+        return lineNumber;
     }
 
     public Node cloneNode(boolean deep) {

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java?rev=370866&r1=370865&r2=370866&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java Fri Jan 20 09:22:39 2006
@@ -294,4 +294,6 @@
     public OMElement cloneOMElement();
 
 
+    public void setLineNumber(int lineNumber);
+    public int getLineNumber();
 }

Added: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/EmptyOMLocation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/EmptyOMLocation.java?rev=370866&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/EmptyOMLocation.java (added)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/EmptyOMLocation.java Fri Jan 20 09:22:39 2006
@@ -0,0 +1,45 @@
+package org.apache.axis2.om.impl.llom;
+
+import javax.xml.stream.Location;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ */
+
+public class EmptyOMLocation implements Location {
+
+
+    public int getLineNumber() {
+        return -1;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public int getColumnNumber() {
+        return -1;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public int getCharacterOffset() {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public String getPublicId() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public String getSystemId() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java?rev=370866&r1=370865&r2=370866&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java Fri Jan 20 09:22:39 2006
@@ -78,6 +78,7 @@
      */
     protected int noPrefixNamespaceCounter = 0;
     private OMNode lastChild;
+    private int lineNumber;
 
     /**
      * Constructor OMElementImpl.
@@ -849,5 +850,13 @@
         OMElement clonedElement = new StAXOMBuilder(this.getXMLStreamReader(true)).getDocumentElement();
         clonedElement.build();
         return clonedElement;
+    }
+
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    public int getLineNumber() {
+        return lineNumber;
     }
 }

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java?rev=370866&r1=370865&r2=370866&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java Fri Jan 20 09:22:39 2006
@@ -993,7 +993,7 @@
      * @return Returns Location.
      */
     public Location getLocation() {
-        return null;
+         return new EmptyOMLocation();
     }
 
     /**
@@ -1224,4 +1224,5 @@
     public void setParser(XMLStreamReader parser) {
         this.parser = parser;
     }
+
 }

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java?rev=370866&r1=370865&r2=370866&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java Fri Jan 20 09:22:39 2006
@@ -31,13 +31,14 @@
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.Location;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 
 
 /**
- * Constructs an OM without using SOAP specific classes like SOAPEnvelope, 
+ * Constructs an OM without using SOAP specific classes like SOAPEnvelope,
  * SOAPHeader, SOAPHeaderBlock and SOAPBody. This has the document concept also.
  */
 public class StAXOMBuilder extends StAXBuilder {
@@ -60,22 +61,20 @@
     }
 
     /**
-     *
      * @param filePath - Path to the XML file
      * @throws XMLStreamException
      * @throws FileNotFoundException
      */
     public StAXOMBuilder(String filePath) throws XMLStreamException, FileNotFoundException {
-       this(XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(filePath)));
+        this(XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(filePath)));
     }
 
     /**
-     *
      * @param inStream - instream which contains the XML
      * @throws XMLStreamException
      */
     public StAXOMBuilder(InputStream inStream) throws XMLStreamException {
-       this(XMLInputFactory.newInstance().createXMLStreamReader(inStream));
+        this(XMLInputFactory.newInstance().createXMLStreamReader(inStream));
     }
 
     /**
@@ -90,7 +89,7 @@
     }
 
     /**
-     * Method createOMElement. 
+     * Method createOMElement.
      *
      * @return Returns OMNode.
      * @throws OMException
@@ -103,8 +102,8 @@
         } else if (lastNode.isComplete()) {
             node = omfactory.createOMElement(elementName, null,
                     lastNode.getParent(), this);
-            ((OMNodeEx)lastNode).setNextOMSibling(node);
-            ((OMNodeEx)node).setPreviousOMSibling(lastNode);
+            ((OMNodeEx) lastNode).setNextOMSibling(node);
+            ((OMNodeEx) node).setPreviousOMSibling(lastNode);
         } else {
             OMElement e = (OMElement) lastNode;
             node = omfactory.createOMElement(elementName, null,
@@ -115,6 +114,7 @@
         processNamespaceData(node, false);
         // fill in the attributes
         processAttributes(node);
+        node.setLineNumber(parser.getLocation().getLineNumber());
         return node;
     }
 
@@ -150,6 +150,7 @@
 
     /**
      * Method createPI.
+     *
      * @return Returns OMNode.
      * @throws OMException
      */
@@ -169,21 +170,21 @@
         return node;
     }
 
-    protected void endElement(){
+    protected void endElement() {
         if (lastNode.isComplete()) {
             OMElement parent = (OMElement) lastNode.getParent();
-            ((OMNodeEx)parent).setComplete(true);
+            ((OMNodeEx) parent).setComplete(true);
             lastNode = parent;
         } else {
             OMElement e = (OMElement) lastNode;
-            ((OMNodeEx)e).setComplete(true);
+            ((OMNodeEx) e).setComplete(true);
         }
 
         //return lastNode;
     }
-    
+
     /**
-     * Method next. 
+     * Method next.
      *
      * @return Returns int.
      * @throws OMException
@@ -199,72 +200,72 @@
             }
             switch (token) {
                 case XMLStreamConstants.START_ELEMENT:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("START_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
                     }
                     lastNode = createOMElement();
                     break;
                 case XMLStreamConstants.START_DOCUMENT:
                     // Document has already being created.
-                    
+
                     document.setXMLVersion(parser.getVersion());
                     document.setCharsetEncoding(parser.getEncoding());
                     document.setStandalone(parser.isStandalone() ? "yes" : "no");
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("START_DOCUMENT: ");
                     }
                     break;
                 case XMLStreamConstants.CHARACTERS:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("CHARACTERS: [" + parser.getText() + "]");
                     }
                     lastNode = createOMText(XMLStreamConstants.CHARACTERS);
                     break;
                 case XMLStreamConstants.CDATA:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("CDATA: [" + parser.getText() + "]");
                     }
                     lastNode = createOMText(XMLStreamConstants.CDATA);
                     break;
                 case XMLStreamConstants.END_ELEMENT:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("END_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
                     }
                     endElement();
                     break;
                 case XMLStreamConstants.END_DOCUMENT:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("END_DOCUMENT: ");
                     }
                     done = true;
-                    ((OMContainerEx)this.document).setComplete(true);
+                    ((OMContainerEx) this.document).setComplete(true);
                     break;
                 case XMLStreamConstants.SPACE:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("SPACE: [" + parser.getText() + "]");
                     }
                     lastNode = createOMText(XMLStreamConstants.SPACE);
                     break;
                 case XMLStreamConstants.COMMENT:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("COMMENT: [" + parser.getText() + "]");
                     }
                     createComment();
                     break;
                 case XMLStreamConstants.DTD:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("DTD: [" + parser.getText() + "]");
                     }
                     createDTD();
                     break;
                 case XMLStreamConstants.PROCESSING_INSTRUCTION:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("PROCESSING_INSTRUCTION: [" + parser.getPITarget() + "][" + parser.getPIData() + "]");
                     }
                     createPI();
                     break;
                 case XMLStreamConstants.ENTITY_REFERENCE:
-                    if(doDebug) {
+                    if (doDebug) {
                         System.out.println("ENTITY_REFERENCE: " + parser.getLocalName() + "[" + parser.getText() + "]");
                     }
                     lastNode = createOMText(XMLStreamConstants.ENTITY_REFERENCE);
@@ -280,7 +281,7 @@
         }
     }
 
-   /**
+    /**
      * Method getDocumentElement.
      *
      * @return Returns root element.
@@ -317,26 +318,25 @@
 
         int namespaceCount = parser.getNamespaceCount();
         for (int i = 0; i < namespaceCount; i++) {
-        	String nsprefix = parser.getNamespacePrefix(i);
-        	nsprefix = (nsprefix == null?"":nsprefix);
-        	
-        	//if the namespace is not defined already when we write the start tag declare it
-        	
-            if (!nsprefix.equals(prefix)){
-            node.declareNamespace(parser.getNamespaceURI(i),
-                    parser.getNamespacePrefix(i));
+            String nsprefix = parser.getNamespacePrefix(i);
+            nsprefix = (nsprefix == null ? "" : nsprefix);
+
+            //if the namespace is not defined already when we write the start tag declare it
+
+            if (!nsprefix.equals(prefix)) {
+                node.declareNamespace(parser.getNamespaceURI(i),
+                        parser.getNamespacePrefix(i));
             }
         }
     }
 
 
-
     public void setDoDebug(boolean doDebug) {
         this.doDebug = doDebug;
     }
 
-    protected String createPrefix(){
-        return "ns"+ nsCount++;
+    protected String createPrefix() {
+        return "ns" + nsCount++;
     }
 
 }