cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r835586 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/ common/common/src/main/java/org/apache/cxf/staxutils/ rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/validator/src/main/java/org/apache/cxf/to...
Date Thu, 12 Nov 2009 22:06:37 GMT
Author: dkulp
Date: Thu Nov 12 22:06:37 2009
New Revision: 835586

URL: http://svn.apache.org/viewvc?rev=835586&view=rev
Log:
Merged revisions 835577 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r835577 | dkulp | 2009-11-12 17:00:22 -0500 (Thu, 12 Nov 2009) | 4 lines
  
  [CXF-1500] Remove duplicate code from the tools "Stax2DOM" thing and
  move it into StaxUtils.   Allow WSDLManager to have line numbers of
  elements recorded into DOM that the wsdls schemas use so an error
  with a line number can be displayed.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/WSDLConstants.java
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
    cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
    cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/FailureLocation.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/WSDLConstants.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/WSDLConstants.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/WSDLConstants.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/WSDLConstants.java
Thu Nov 12 22:06:37 2009
@@ -103,9 +103,6 @@
     public static final String ATTR_PART_TYPE = "type";
     public static final String ATTR_TYPE = "type";
 
-    //For Stax2DOM getUserData(location)
-    public static final String NODE_LOCATION = "location";
-
     public static final int DOC_WRAPPED = 1;
     public static final int DOC_BARE = 2;
     public static final int RPC_WRAPPED = 3;

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Thu Nov 12 22:06:37 2009
@@ -33,6 +33,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.Location;
 import javax.xml.stream.StreamFilter;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
@@ -50,6 +51,7 @@
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
 
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
@@ -62,6 +64,7 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
+import org.w3c.dom.UserDataHandler;
 
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
@@ -738,13 +741,18 @@
         readDocElements(doc, reader, true);
         return doc;
     }
+    public static Document read(XMLStreamReader reader, boolean recordLoc) throws XMLStreamException
{
+        Document doc = DOMUtils.createDocument();
+        doc.setDocumentURI(reader.getLocation().getSystemId());
+        readDocElements(doc, doc, reader, true, recordLoc);
+        return doc;
+    }
     
     public static Document read(DocumentBuilder builder, XMLStreamReader reader, boolean
repairing) 
         throws XMLStreamException {
         Document doc = builder.newDocument();
-
+        doc.setDocumentURI(reader.getLocation().getSystemId());
         readDocElements(doc, reader, repairing);
-
         return doc;
     }
 
@@ -762,16 +770,19 @@
      * @return
      * @throws XMLStreamException
      */
-    private static Element startElement(Node parent, XMLStreamReader reader, boolean repairing)
+    private static Element startElement(Document doc, 
+                                        Node parent, 
+                                        XMLStreamReader reader,
+                                        boolean repairing,
+                                        boolean recordLocation)
         throws XMLStreamException {
-        Document doc = getDocument(parent);
 
         Element e = doc.createElementNS(reader.getNamespaceURI(), reader.getLocalName());
         if (reader.getPrefix() != null) {
             e.setPrefix(reader.getPrefix());
-        }
-
+        }       
         e = (Element)parent.appendChild(e);
+        addLocation(doc, e, reader, recordLocation);
 
         for (int ns = 0; ns < reader.getNamespaceCount(); ns++) {
             String uri = reader.getNamespaceURI(ns);
@@ -798,7 +809,7 @@
 
         reader.next();
 
-        readDocElements(e, reader, repairing);
+        readDocElements(doc, e, reader, repairing, recordLocation);
 
         return e;
     }
@@ -821,21 +832,26 @@
 
         return false;
     }
+    public static void readDocElements(Node parent, XMLStreamReader reader, boolean repairing)

+        throws XMLStreamException {
+        Document doc = getDocument(parent);
+        readDocElements(doc, parent, reader, repairing, false);
+    }
 
     /**
      * @param parent
      * @param reader
      * @throws XMLStreamException
      */
-    public static void readDocElements(Node parent, XMLStreamReader reader, boolean repairing)
+    public static void readDocElements(Document doc, Node parent,
+                                       XMLStreamReader reader, boolean repairing, boolean
recordLoc)
         throws XMLStreamException {
-        Document doc = getDocument(parent);
 
         int event = reader.getEventType();
         while (reader.hasNext()) {
             switch (event) {
             case XMLStreamConstants.START_ELEMENT:
-                startElement(parent, reader, repairing);
+                startElement(doc, parent, reader, repairing, recordLoc);
                 
                 if (parent instanceof Document) {
                     return;
@@ -849,27 +865,24 @@
                 break;
             case XMLStreamConstants.CHARACTERS:
                 if (parent != null) {
-                    parent.appendChild(doc.createTextNode(reader.getText()));
+                    addLocation(doc, parent.appendChild(doc.createTextNode(reader.getText())),
+                                reader, recordLoc);
                 }
-
                 break;
             case XMLStreamConstants.COMMENT:
                 if (parent != null) {
                     parent.appendChild(doc.createComment(reader.getText()));
                 }
-
                 break;
             case XMLStreamConstants.CDATA:
-                parent.appendChild(doc.createCDATASection(reader.getText()));
-
+                addLocation(doc, parent.appendChild(doc.createCDATASection(reader.getText())),
+                            reader, recordLoc);
                 break;
             case XMLStreamConstants.PROCESSING_INSTRUCTION:
                 parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(),
reader.getPIData()));
-
                 break;
             case XMLStreamConstants.ENTITY_REFERENCE:
                 parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(),
reader.getPIData()));
-
                 break;
             default:
                 break;
@@ -880,6 +893,45 @@
             }
         }
     }
+    private static void addLocation(final Document doc, Node node, 
+                                    XMLStreamReader reader, boolean recordLoc) {
+        if (recordLoc) {
+            final Location loc = reader.getLocation();
+            if (loc != null && (loc.getColumnNumber() != 0 || loc.getLineNumber()
!= 0)) {
+                Location loc2 = new Location() {
+                    public int getCharacterOffset() {
+                        return loc.getCharacterOffset();
+                    }
+                    public int getColumnNumber() {
+                        return loc.getColumnNumber();
+                    }
+                    public int getLineNumber() {
+                        return loc.getLineNumber();
+                    }
+                    public String getPublicId() {
+                        if (loc.getPublicId() == null) {
+                            return doc.getDocumentURI();
+                        }
+                        return loc.getPublicId();
+                    }
+                    public String getSystemId() {
+                        if (loc.getSystemId() == null) {
+                            return doc.getDocumentURI();
+                        }
+                        return loc.getSystemId();
+                    }
+                    
+                };
+                node.setUserData("location", loc2, new UserDataHandler() {
+                    public void handle(short operation, String key, Object data, Node src,
Node dst) {
+                        if (operation == NODE_CLONED) {
+                            dst.setUserData(key, data, this);
+                        }
+                    }
+                });
+            }
+        }
+    }
 
     private static void declare(Element node, String uri, String prefix) {
         String qualname;
@@ -892,7 +944,21 @@
         attr.setValue(uri);
         node.setAttributeNodeNS(attr);
     }
-
+    public static XMLStreamReader createXMLStreamReader(InputSource src) {
+        if (src.getByteStream() != null) {
+            if (src.getEncoding() == null) {
+                StreamSource ss = new StreamSource(src.getByteStream(), src.getSystemId());
+                ss.setPublicId(src.getPublicId());
+                return createXMLStreamReader(ss);
+            }
+            return createXMLStreamReader(src.getByteStream(), src.getEncoding());
+        } else if (src.getCharacterStream() != null) {
+            StreamSource ss = new StreamSource(src.getCharacterStream(), src.getSystemId());
+            ss.setPublicId(src.getPublicId());
+            return createXMLStreamReader(ss);
+        }
+        throw new IllegalArgumentException("InputSource must have a ByteStream or CharacterStream");
+    }
     /**
      * @param in
      * @param encoding
@@ -1191,6 +1257,7 @@
             //shouldn't get here
         }
     }
+
     public static String toString(Document doc) throws XMLStreamException {
         StringWriter sw = new StringWriter(1024);
         XMLStreamWriter writer = createXMLStreamWriter(sw);

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
Thu Nov 12 22:06:37 2009
@@ -22,6 +22,7 @@
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamException;
 
 import org.w3c.dom.Attr;
@@ -390,5 +391,14 @@
 
     public String getPIData() {
         throw new UnsupportedOperationException();
+    }   
+    public Location getLocation() {
+        Object o = getCurrentNode().getUserData("location");
+        if (o instanceof Location) { 
+            return (Location)o;
+        }
+        return super.getLocation();
     }
+
+    
 }

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
Thu Nov 12 22:06:37 2009
@@ -43,8 +43,11 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.xml.sax.InputSource;
+
 import com.ibm.wsdl.extensions.soap.SOAPHeaderImpl;
 import com.ibm.wsdl.extensions.soap.SOAPHeaderSerializer;
 
@@ -56,6 +59,7 @@
 import org.apache.cxf.common.util.CacheMap;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
 import org.apache.cxf.service.model.ServiceSchemaInfo;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.wsdl.JAXBExtensionHelper;
 import org.apache.cxf.wsdl.WSDLManager;
 
@@ -207,7 +211,16 @@
         ResourceManagerWSDLLocator wsdlLocator = new ResourceManagerWSDLLocator(url,
                                                                                 catLocator,
                                                                                 bus);
-        Definition def = reader.readWSDL(wsdlLocator);
+        InputSource src = wsdlLocator.getBaseInputSource();
+        Document doc;
+        try {
+            doc = StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
+            doc.setDocumentURI(src.getSystemId());
+        } catch (Exception e) {
+            throw new WSDLException(WSDLException.PARSER_ERROR, e.getMessage(), e);
+        }
+        
+        Definition def = reader.readWSDL(wsdlLocator, doc.getDocumentElement());
         synchronized (definitionsMap) {
             definitionsMap.put(url, def);
         }

Modified: cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
Thu Nov 12 22:06:37 2009
@@ -20,53 +20,23 @@
 package org.apache.cxf.tools.validator.internal;
 
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
-import java.util.Iterator;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.Namespace;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
+import javax.xml.transform.stream.StreamSource;
 
-import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
-import org.apache.cxf.common.WSDLConstants;
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.URIParserUtil;
 
 public class Stax2DOM {
     static final String XML_NS = "http://www.w3.org/2000/xmlns/";
 
-    private  Element currentElement;
-    private  Document doc;
-    private XMLInputFactory factory;
-    private  XMLEventReader reader;
-
     public Stax2DOM() {
     }
 
-    private void init() {
-        try {
-            factory = XMLInputFactory.newInstance();
-            factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true);
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new ToolException(e);
-        }
-    }
+
 
     public Document getDocument(String wsdl) throws ToolException {
         try {
@@ -75,123 +45,30 @@
                 return getDocument(wsdlURI.toURL());
             }
             return getDocument(wsdlURI.toURL());
+        } catch (ToolException e) {
+            throw e;
         } catch (Exception e) {
             throw new ToolException(e);
         }
     }
 
     public Document getDocument(URL url) throws ToolException {
-        if (reader == null) {
-            init();
-            try {
-                reader = factory.createXMLEventReader(url.openStream());
-            } catch (FileNotFoundException fe) {
-                throw new ToolException("Cannot get the wsdl " + url, fe);
-            } catch (XMLStreamException e) {
-                throw new ToolException(e);
-            } catch (IOException ioe) {
-                throw new ToolException(ioe);
-            }
+        try {
+            StreamSource src = new StreamSource(url.openStream(), url.toExternalForm());
+            return StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
+        } catch (Exception e) {
+            throw new ToolException(e);
         }
-        return getDocument(reader, url.toString());
     }
 
     public Document getDocument(File wsdl) throws ToolException {
-        if (reader == null) {
-            init();
-            try {
-                reader = factory.createXMLEventReader(new FileReader(wsdl));
-            } catch (FileNotFoundException fe) {
-                throw new ToolException("Cannot get the wsdl " + wsdl, fe);
-            } catch (XMLStreamException e) {
-                throw new ToolException(e);
-            }
-
-        }
-        return getDocument(reader, wsdl.toString());
-    }
-
-    public Document getDocument(XMLEventReader xmlEventReader) throws ToolException {
-        return getDocument(xmlEventReader, null);
-    }
-
-    public Document getDocument(XMLEventReader xmlEventReader, String wsdlurl) throws ToolException
{
         try {
-            doc = XMLUtils.newDocument();
-        } catch (ParserConfigurationException e) {
+            StreamSource src = new StreamSource(wsdl);
+            return StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
+        } catch (Exception e) {
             throw new ToolException(e);
         }
-        doc.setDocumentURI(wsdlurl);
-
-        currentElement = doc.getDocumentElement();
-
-        while (xmlEventReader.hasNext()) {
-            XMLEvent xmleve = (XMLEvent)xmlEventReader.next();
-
-            if (xmleve.getEventType() == XMLStreamConstants.END_ELEMENT) {
-                endElement();
-            }
-
-            if (xmleve.getEventType() == XMLStreamConstants.START_ELEMENT) {
-                startElement((StartElement)xmleve);
-            }
-        }
-        return doc;
-    }
-
-    public void startElement(StartElement ele) {
-        Element element = null;
-        if (!StringUtils.isEmpty(ele.getName().getPrefix())) {
-            element = doc.createElementNS(ele.getName().getNamespaceURI(),
-                                          ele.getName().getPrefix() + ":"
-                                          + ele.getName().getLocalPart());
-        } else {
-            element = doc.createElementNS(ele.getName().getNamespaceURI(), 
-                                          ele.getName().getLocalPart());
-        }
-
-        Iterator ite = ele.getNamespaces();
-        while (ite.hasNext()) {
-            Namespace ns = (Namespace) ite.next();
-            String pfx = ns.getPrefix();
-            String uri = ns.getNamespaceURI();
-            if (!StringUtils.isEmpty(pfx)) {
-                Attr attr = element.getOwnerDocument().createAttributeNS(XML_NS,
-                                                                        "xmlns:" + pfx);
-                attr.setValue(uri);
-                element.setAttributeNodeNS(attr);
-            } else {
-                Attr attr = element.getOwnerDocument().createAttributeNS(XML_NS,
-                                                                         "xmlns");
-                attr.setValue(uri);
-                element.setAttributeNodeNS(attr);
-            }
-        }
-        ite = ele.getAttributes();
-        while (ite.hasNext()) {
-            Attribute attr = (Attribute)ite.next();
-            element.setAttribute(attr.getName().getLocalPart(), attr.getValue());
-        }
-
-
-        if (currentElement == null) {
-            doc.appendChild(element);
-        } else {
-            currentElement.appendChild(element);
-        }
-
-        currentElement = element;
-        element.setUserData(WSDLConstants.NODE_LOCATION, ele.getLocation(), null);
-
     }
 
-    public void endElement() {
-        Node node = currentElement.getParentNode();
-        if (node instanceof Document) {
-            currentElement = ((Document)node).getDocumentElement();
-        } else {
-            currentElement = (Element)currentElement.getParentNode();
-        }
-    }
 
 }

Modified: cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
Thu Nov 12 22:06:37 2009
@@ -220,7 +220,7 @@
         for (Document doc : docs) {
             Node node = (Node) xpather.getValue(fNode.toString(), doc, XPathConstants.NODE);
             if (null != node) {
-                return new FailureLocation((Location)node.getUserData(WSDLConstants.NODE_LOCATION),
+                return new FailureLocation((Location)node.getUserData("location"),
                                            doc.getDocumentURI());
             }
         }

Modified: cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/FailureLocation.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/FailureLocation.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/FailureLocation.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/FailureLocation.java
Thu Nov 12 22:06:37 2009
@@ -30,6 +30,9 @@
     public FailureLocation(Location loc, String docURI) {
         this.location = loc;
         this.documentURI = docURI;
+        if (documentURI == null) {
+            documentURI = loc.getSystemId();
+        }
     }
 
     public Location getLocation() {

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=835586&r1=835585&r2=835586&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Thu Nov 12 22:06:37 2009
@@ -330,7 +330,6 @@
             schemaCompiler.setDefaultPackageName(context.getPackageName());
         }  
         
-
         rawJaxbModelGenCode = schemaCompiler.bind();
 
         addedEnumClassToCollector(schemas, allocator);
@@ -398,7 +397,12 @@
                 is.setSystemId(key);
                 is.setPublicId(key);
                 opts.addGrammar(is);
-                schemaCompiler.parseSchema(key, ele);
+                try {
+                    schemaCompiler.parseSchema(key, StaxUtils.createXMLStreamReader(ele));
+                } catch (XMLStreamException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
             }
         }
         for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
@@ -443,7 +447,12 @@
                 is.setSystemId(key);
                 is.setPublicId(key);
                 opts.addGrammar(is);
-                schemaCompiler.parseSchema(key, ele);
+                try {
+                    schemaCompiler.parseSchema(key, StaxUtils.createXMLStreamReader(ele));
+                } catch (XMLStreamException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
             }
         }
 



Mime
View raw message