Search in sources :

Example 11 with XmlCursor

use of org.apache.xmlbeans.XmlCursor in project hackpad by dropbox.

the class XML method getXmlObject.

XmlObject getXmlObject() {
    XmlObject xo;
    XmlCursor cursor = newCursor();
    try {
        xo = cursor.getObject();
    } finally {
        cursor.dispose();
    }
    return xo;
}
Also used : XmlObject(org.apache.xmlbeans.XmlObject) XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 12 with XmlCursor

use of org.apache.xmlbeans.XmlCursor in project hackpad by dropbox.

the class XML method setLocalName.

/**
     *
     * @param name
     */
void setLocalName(String localName) {
    XmlCursor cursor = newCursor();
    try {
        if (cursor.isStartdoc())
            cursor.toFirstContentToken();
        if (cursor.isText() || cursor.isComment())
            return;
        javax.xml.namespace.QName qname = cursor.getName();
        cursor.setName(new javax.xml.namespace.QName(qname.getNamespaceURI(), localName, qname.getPrefix()));
    } finally {
        cursor.dispose();
    }
}
Also used : XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 13 with XmlCursor

use of org.apache.xmlbeans.XmlCursor in project hackpad by dropbox.

the class XML method tokenType.

/**
     *
     * @return
     */
XmlCursor.TokenType tokenType() {
    XmlCursor.TokenType result;
    XmlCursor curs = newCursor();
    if (curs.isStartdoc()) {
        curs.toFirstContentToken();
    }
    result = curs.currentTokenType();
    curs.dispose();
    return result;
}
Also used : TokenType(org.apache.xmlbeans.XmlCursor.TokenType) XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 14 with XmlCursor

use of org.apache.xmlbeans.XmlCursor in project hackpad by dropbox.

the class XML method removeChild.

/**
     *
     * @param index
     */
protected void removeChild(long index) {
    XmlCursor curs = newCursor();
    if (moveToChild(curs, index, false, false)) {
        removeToken(curs);
    }
    curs.dispose();
}
Also used : XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 15 with XmlCursor

use of org.apache.xmlbeans.XmlCursor in project hackpad by dropbox.

the class XML method namespace.

/**
     *
     * @param prefix
     * @return
     */
Object namespace(String prefix) {
    XmlCursor cursor = newCursor();
    if (cursor.isStartdoc()) {
        cursor.toFirstContentToken();
    }
    Object result = null;
    if (prefix == null) {
        if (cursor.isStart() || cursor.isAttr()) {
            Object[] inScopeNS = NamespaceHelper.inScopeNamespaces(lib, cursor);
            // XXX Is it reaaly necessary to create the second cursor?
            XmlCursor cursor2 = newCursor();
            if (cursor2.isStartdoc())
                cursor2.toFirstContentToken();
            result = NamespaceHelper.getNamespace(lib, cursor2, inScopeNS);
            cursor2.dispose();
        }
    } else {
        Map prefixToURI = NamespaceHelper.getAllNamespaces(lib, cursor);
        String uri = (String) prefixToURI.get(prefix);
        result = (uri == null) ? Undefined.instance : new Namespace(lib, prefix, uri);
    }
    cursor.dispose();
    return result;
}
Also used : XmlObject(org.apache.xmlbeans.XmlObject) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

XmlCursor (org.apache.xmlbeans.XmlCursor)160 XmlObject (org.apache.xmlbeans.XmlObject)68 QName (javax.xml.namespace.QName)21 XmlException (org.apache.xmlbeans.XmlException)16 TokenType (org.apache.xmlbeans.XmlCursor.TokenType)14 CTTbl (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)14 CTP (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP)10 ArrayList (java.util.ArrayList)9 POSIXApplicationType (org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType)8 HPCProfileApplicationType (org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType)8 SPMDApplicationType (org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.SPMDApplicationType)8 IOException (java.io.IOException)5 POIXMLException (org.apache.poi.POIXMLException)5 InputStream (java.io.InputStream)4 DrawPaint (org.apache.poi.sl.draw.DrawPaint)3 ArrayType (org.dmg.pmml.ArrayType)3 ApplicationType (org.ggf.schemas.jsdl.x2005.x11.jsdl.ApplicationType)3 LineString (org.locationtech.jts.geom.LineString)3 CTRow (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow)3 CTSdtBlock (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtBlock)3