Examples of XmlCursor


Examples of org.apache.xmlbeans.XmlCursor

        Float floatVal = new Float(123.456);
        Double doubleVal = new Double(12345.6789);
        Boolean booleanVal = Boolean.TRUE;

        XmlObject doc = XmlObject.Factory.parse(TEST);
        XmlCursor cursor = doc.newCursor();
        try {
            cursor.toFirstChild();
            doc = cursor.getObject();
        } finally {
            cursor.dispose();
        }
        environmentEntryBuilder.buildNaming(doc, null, null, componentContext);
        Context context = EnterpriseNamingContext.createEnterpriseNamingContext(NamingBuilder.JNDI_KEY.get(componentContext));
        Set actual = new HashSet();
        for (NamingEnumeration e = context.listBindings("env"); e.hasMore();) {
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

                throw new DeploymentException(e);
            }
        }

        if (unknownXmlObject != null) {
            XmlCursor xmlCursor = unknownXmlObject.newCursor();
            //
            QName qname = xmlCursor.getName();
            if (qname == null) {
                xmlCursor.toFirstChild();
                qname = xmlCursor.getName();
            }
            if (qname.getLocalPart().equals("openejb-jar")) {
                ejbModule.getAltDDs().put("openejb-jar.xml", xmlCursor.xmlText());
            } else if (qname.getLocalPart().equals("ejb-jar") && qname.getNamespaceURI().equals("http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0")) {
                ejbModule.getAltDDs().put("geronimo-openejb.xml", xmlCursor.xmlText());
            }
        }

        // Read in the deploument desiptor files
        ReadDescriptors readDescriptors = new ReadDescriptors();
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

                    }
                }
            }
        }
        // Copy the content into the XmlAttributeType
        XmlCursor loginCursor = lcDoc.newCursor();
        loginCursor.toFirstContentToken();
        XmlCursor destination = config.newCursor();
        destination.toNextToken();
        loginCursor.moveXml(destination);
        loginCursor.dispose();
        destination.dispose();
        config.setName("LoginModuleConfiguration");
        root.setServiceArray(new AbstractServiceType[]{realm});


        //Above code inserts gbean using xsi:type=dep:GBeanType.  We also need to account for the substitution group
        //by changing the qname:
        XmlCursor gbeanCursor = root.newCursor();
        try {
            if (!gbeanCursor.toChild(ServiceDocument.type.getDocumentElementName())) {
                throw new RuntimeException("Could not find service element");
            }
            gbeanCursor.setName(GBEAN_QNAME);
        } finally {
            gbeanCursor.dispose();
        }

        return doc;
    }
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

        return result;
    }

    protected static XmlObject convert(XmlObject xmlObject, NamespaceElementConverter converter, SchemaType type) throws DeploymentException {
        Map ns = new HashMap();
        XmlCursor cursor = xmlObject.newCursor();
        try {
            cursor.getAllNamespaces(ns);
        } finally {
            cursor.dispose();
        }
        xmlObject = xmlObject.copy();
        cursor = xmlObject.newCursor();
        cursor.toNextToken();
        try {
            for (Object o : ns.entrySet()) {
                Map.Entry entry = (Map.Entry) o;
                cursor.insertNamespace((String) entry.getKey(), (String) entry.getValue());
            }
        } finally {
            cursor.dispose();
        }

        if (xmlObject.schemaType() != type) {
            converter.convertElement(xmlObject);
            xmlObject = xmlObject.changeType(type);
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

        }
    }

    private XmlObject parse(String xmlString) throws XmlException {
        XmlObject xmlObject = XmlObject.Factory.parse(xmlString);
        XmlCursor xmlCursor = xmlObject.newCursor();
        try {
            xmlCursor.toFirstChild();
            return xmlCursor.getObject();
        } finally {
            xmlCursor.dispose();
        }
    }
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

  /**
   * verifies that cursor is on the right position
   * @param cursor
   */
  private boolean isCursorInBody(XmlCursor cursor) {
    XmlCursor verify = cursor.newCursor();
    verify.toParent();
    if(verify.getObject() == this.ctDocument.getBody()){
      return true;
    }
    XmlObject o = verify.getObject();
    return false;
   
  }
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

  /**
   * get the TableCell which belongs to the TableCell
   * @param cell
   */
  public XWPFTableCell getTableCell(CTTc cell) {
    XmlCursor cursor = cell.newCursor();
    cursor.toParent();
    XmlObject o = cursor.getObject();
    if(!(o instanceof CTRow)){
      return null;
    }
    CTRow row = (CTRow)o;
    cursor.toParent();
    o = cursor.getObject();
        cursor.dispose();
    if(! (o instanceof CTTbl)){
      return null;
    }
    CTTbl tbl = (CTTbl) o;
    XWPFTable table = getTable(tbl);
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

            initFootnotes();
          
           
            // parse the document with cursor and add
            // the XmlObject to its lists
        XmlCursor cursor = ctDocument.getBody().newCursor();
            cursor.selectPath("./*");
            while (cursor.toNextSelection()) {
                XmlObject o = cursor.getObject();
                if (o instanceof CTP) {
                  XWPFParagraph p = new XWPFParagraph((CTP)o, this);
                  bodyElements.add(p);
                  paragraphs.add(p);
                }
                if (o instanceof CTTbl) {
                  XWPFTable t = new XWPFTable((CTTbl)o, this);
                  bodyElements.add(t);
                  tables.add(t);
                }
            }
            cursor.dispose();
     
            // Sort out headers and footers
      if (doc.getDocument().getBody().getSectPr() != null)
        headerFooterPolicy = new XWPFHeaderFooterPolicy(this);
       
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

      //TODO handle: not creating POSIX element if HPCProfile already exists
      return getPOSIXApplication(value);
    }
   
    if (getPOSIXApplication(value) == null) {
      XmlCursor acursor = application.newCursor();
      acursor.toEndToken();
      acursor.insertElement(POSIX_APPLICATION);
      acursor.dispose();
    }
    return getPOSIXApplication(value);
  }
View Full Code Here

Examples of org.apache.xmlbeans.XmlCursor

  public static SPMDApplicationType getOrCreateSPMDApplication(JobDefinitionType value) {
   
    ApplicationType application = getOrCreateApplication(value);
   
    if (getSPMDApplication(value) == null) {
      XmlCursor acursor = application.newCursor();
      acursor.toEndToken();
      acursor.insertElement(SPMD_APPLICATION);
      acursor.dispose();
    }
    return getSPMDApplication(value);
  }
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.