Examples of XmlObject


Examples of org.apache.xmlbeans.XmlObject

        try {
            cursor.toStartDoc();
            cursor.toFirstChild();
            if ("http://java.sun.com/xml/ns/j2ee".equals(cursor.getName().getNamespaceURI())) {
                SchemaConversionUtils.convertSchemaVersion(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
                XmlObject result = xmlObject.changeType(WebAppDocument.type);
                XmlBeansUtil.validateDD(result);
                return (WebAppDocument) result;
            }

            if ("http://java.sun.com/xml/ns/javaee".equals(cursor.getName().getNamespaceURI())) {
                SchemaConversionUtils.convertSchemaVersion(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
                XmlObject result = xmlObject.changeType(WebAppDocument.type);
                XmlBeansUtil.validateDD(result);
                return (WebAppDocument) result;
            }

            //otherwise assume DTD
            XmlDocumentProperties xmlDocumentProperties = cursor.documentProperties();
            String publicId = xmlDocumentProperties.getDoctypePublicId();
            boolean is22 = "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN".equals(publicId);
            if ("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN".equals(publicId) ||
                    is22) {
                XmlCursor moveable = xmlObject.newCursor();
                try {
                    moveable.toStartDoc();
                    moveable.toFirstChild();

                    SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
                    cursor.toStartDoc();
                    cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "web-app");
                    cursor.toFirstChild();
                    SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
                    SchemaConversionUtils.convertToJNDIEnvironmentRefsGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
                    cursor.push();
                    if (cursor.toNextSibling(TAGLIB)) {
                        cursor.toPrevSibling();
                        moveable.toCursor(cursor);
                        cursor.beginElement("jsp-config", SchemaConversionUtils.JAVAEE_NAMESPACE);
                        while (moveable.toNextSibling(TAGLIB)) {
                            moveable.moveXml(cursor);
                        }
                    }
                    cursor.pop();
                    do {
                        String name = cursor.getName().getLocalPart();
                        if ("filter".equals(name) || "servlet".equals(name) || "context-param".equals(name)) {
                            cursor.push();
                            cursor.toFirstChild();
                            SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
                            while (cursor.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "init-param")) {
                                cursor.push();
                                cursor.toFirstChild();
                                SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
                                cursor.pop();
                            }
                            cursor.pop();
                            cursor.push();
                            if (cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "jsp-file")) {
                                String jspFile = cursor.getTextValue();
                                if (!jspFile.startsWith("/")){
                                    if (is22) {
                                        cursor.setTextValue("/" + jspFile);
                                    } else {
                                        throw new XmlException("jsp-file does not start with / and this is not a 2.2 web app: " + jspFile);
                                    }
                                }
                            }
                            cursor.pop();
                        }
                    } while (cursor.toNextSibling());
                } finally {
                    moveable.dispose();
                }
            }
        } finally {
            cursor.dispose();
        }
        XmlObject result = xmlObject.changeType(WebAppDocument.type);
        if (result != null) {
            XmlBeansUtil.validateDD(result);
            return (WebAppDocument) result;
        }
        XmlBeansUtil.validateDD(xmlObject);
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

        }
        return portMap;
    }
   
    public static Map<String,PortInfo> parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile, boolean isEJB, Map servletLocations) throws DeploymentException {
        XmlObject webservicesType = getWebservicesType(wsDDUrl);
        if (webservicesType instanceof WebservicesType) {
            WebservicesType webServices = (WebservicesType)webservicesType;
            return parseWebServiceDescriptor(webServices, moduleFile, isEJB, servletLocations);
        } else if (webservicesType instanceof org.apache.geronimo.xbeans.javaee.WebservicesType) {
            org.apache.geronimo.xbeans.javaee.WebservicesType webServices = (org.apache.geronimo.xbeans.javaee.WebservicesType)webservicesType;
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

        }
    }
   
    static XmlObject getWebservicesType(URL wsDDUrl) throws DeploymentException {
        try {
            XmlObject webservicesDocumentUntyped = XmlObject.Factory.parse(wsDDUrl);
            XmlCursor cursor = webservicesDocumentUntyped.newCursor();
            try {
                if (cursor.currentTokenType() != XmlCursor.TokenType.START) {
                    while(cursor.toNextToken()  != XmlCursor.TokenType.START) {}
                }
                QName qname = cursor.getName();
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

       // Get all our child nodes in order, and process them
       //  into XWPFRuns where we can
       XmlCursor c = paragraph.newCursor();
       c.selectPath("child::*");
       while (c.toNextSelection()) {
          XmlObject o = c.getObject();
          if(o instanceof CTR) {
             runs.add(new XWPFRun((CTR)o, this));
          }
          if(o instanceof CTHyperlink) {
             CTHyperlink link = (CTHyperlink)o;
             for(CTR r : link.getRList()) {
                runs.add(new XWPFHyperlinkRun(link, r, this));
             }
          }
          if(o instanceof CTSdtRun) {
             CTSdtContentRun run = ((CTSdtRun)o).getSdtContent();
             for(CTR r : run.getRList()) {
                runs.add(new XWPFRun(r, this));
             }
          }
          if(o instanceof CTRunTrackChange) {
             for(CTR r : ((CTRunTrackChange)o).getRList()) {
                runs.add(new XWPFRun(r, this));
             }
          }
          if(o instanceof CTSimpleField) {
             for(CTR r : ((CTSimpleField)o).getRList()) {
                runs.add(new XWPFRun(r, this));
             }
          }
       }

       c.dispose();
      
       // Look for bits associated with the runs
       for(XWPFRun run : runs) {
          CTR r = run.getCTR();
         
          // Check for bits that only apply when
          //  attached to a core document
          // TODO Make this nicer by tracking the XWPFFootnotes directly
          if(document != null) {
             c = r.newCursor();
             c.selectPath("child::*");
             while (c.toNextSelection()) {
                XmlObject o = c.getObject();
                if(o instanceof CTFtnEdnRef) {
                   CTFtnEdnRef ftn = (CTFtnEdnRef)o;
                   footnoteText.append("[").append(ftn.getId()).append(": ");
                   XWPFFootnote footnote =
                      ftn.getDomNode().getLocalName().equals("footnoteReference") ?
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

        int beginTextPos = 0,beginCharPos = 0, textPos = 0,  charPos = 0
        CTR ctRun = paragraph.getRArray(runPos);
        XmlCursor c = ctRun.newCursor();
        c.selectPath("./*");
        while(c.toNextSelection()){
          XmlObject o = c.getObject();
          if(o instanceof CTText){
            if(textPos>=startText){
              String candidate = ((CTText)o).getStringValue();
              if(runPos==startRun)
                charPos= startChar;
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

        }
    }

    private void addSchemaElement(Element element, Map namespaceMap, List schemaList) throws DeploymentException {
        try {
            XmlObject xmlObject = parseWithNamespaces(element, namespaceMap);
            schemaList.add(xmlObject);
        } catch (XmlException e) {
            throw new DeploymentException("Could not parse schema element", e);
        }
    }
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

            URI location = ((URI) uris.peek()).resolve(systemId);
            InputStream wsdlInputStream;
            try {
                ZipEntry entry = moduleFile.getEntry(location.toString());
                wsdlInputStream = moduleFile.getInputStream(entry);
                XmlObject xmlObject = SchemaDocument.Factory.parse(wsdlInputStream);
                wsdlMap.put(location, xmlObject);
                wsdlInputStream.close();
                wsdlInputStream = moduleFile.getInputStream(entry);
            } catch (XmlException e) {
                throw (IOException) new IOException("Could not parse schema document").initCause(e);
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

                temp.dispose();
                if(!namespace.equals(GENERIC_NAMESPACE) && !namespace.equals(this.namespace) && !namespace.equals(OLD_GENERIC_NAMESPACE)) {
                    throw new DeploymentException("Cannot handle web plan with namespace "+namespace+" -- expecting "+GENERIC_NAMESPACE+" or "+this.namespace);
                }

                XmlObject webPlan = rawCursor.getObject().copy();

                XmlCursor cursor = webPlan.newCursor();
                XmlCursor end = cursor.newCursor();
                try {
                    cursor.push();
                    if (cursor.toChild(GENERIC_CONFIG_QNAME) || cursor.toChild(OLD_GENERIC_CONFIG_QNAME)) {
                        XmlCursor source = cursor.newCursor();
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

        assert moduleFile != null : "moduleFile is null";
        assert targetPath != null : "targetPath is null";
        assert !targetPath.endsWith("/") : "targetPath must not end with a '/'";

        String specDD;
        XmlObject connector;
        try {
            if (specDDUrl == null) {
                specDDUrl = DeploymentUtil.createJarURL(moduleFile, "META-INF/ra.xml");
            }

            // read in the entire specDD as a string, we need this for getDeploymentDescriptor
            // on the J2ee management object
            specDD = DeploymentUtil.readAll(specDDUrl);
        } catch (Exception e) {
            //no ra.xml, not for us.
            return null;
        }
        //we found ra.xml, if it won't parse it's an error.
        try {
            // parse it
            XmlObject xmlObject = XmlBeansUtil.parse(specDD);
            ConnectorDocument connectorDoc = convertToConnectorSchema(xmlObject);
            connector = connectorDoc.getConnector();
        } catch (XmlException e) {
            throw new DeploymentException("Could not parse ra.xml descriptor", e);
        }
View Full Code Here

Examples of org.apache.xmlbeans.XmlObject

            }
        } finally {
            cursor.dispose();
        }
        XmlObject result = xmlObject.changeType(ConnectorDocument.type);
        if (result != null) {
            XmlBeansUtil.validateDD(result);
            return (ConnectorDocument) result;
        }
        XmlBeansUtil.validateDD(xmlObject);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.