Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.XmlObject


                Scriptable s = (Scriptable)jsResp;
                Object out = ScriptableObject.callMethod(s,
                                                         "getXmlObject",
                                                         Context.emptyArgs);
                Wrapper wrapped = (Wrapper)out;
                XmlObject xml = (XmlObject)wrapped.unwrap();
                node = xml.getDomNode();
                response.setNode(node.getOwnerDocument());
            } else {
                if (jsResp instanceof Wrapper) {
                    jsResp = ((Wrapper)jsResp).unwrap();
                }
View Full Code Here


     *
     * @see de.netseeker.ejoe.adapter.SerializeAdapter#write(java.lang.Object, java.io.OutputStream)
     */
    public void write( Object obj, OutputStream out ) throws Exception
    {
        XmlObject xmlObj = (XmlObject) obj;
        xmlObj.save( out );
    }
View Full Code Here

      XmlCursor cursor = null;
      String contentType = null;
      Map<String, String> namespaces = new HashMap<String, String>();
      for (State state : _states)
      {
        XmlObject o = (XmlObject) state.getContent();
        if (cursor == null)
        {
          cursor = o.copy().newCursor();
          cursor.push();
          cursor.toFirstChild();
          cursor.toEndToken();
          contentType = state.getContentType();
        }
        else
        {
          XmlCursor cursor2 = o.newCursor();
          cursor2.toFirstChild(); // Presence
          cursor2.toFirstChild(); // tuple
          cursor2.getAllNamespaces(namespaces);
          do
          {
            add(cursor2, cursor);
          }
          while (cursor2.toNextSibling());
          cursor2.dispose();
        }
      }
      cursor.toParent();
      cursor.toLastAttribute();
      for (String name : namespaces.keySet())
      {
        cursor.insertNamespace(name, namespaces.get(name));
      }
      cursor.pop();
      XmlObject o = cursor.getObject();
      cursor.dispose();
      return new State(contentType, o);
    }
  }
View Full Code Here

        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

        }
        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

        }
    }
   
    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

       // 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

        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

        }
    }

    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

            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

TOP

Related Classes of org.apache.xmlbeans.XmlObject

Copyright © 2018 www.massapicom. 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.