protected void write(OutputStream out) throws IOException { XmlObject rootObject = XmlObject.Factory.newInstance(); XmlCursor rootCursor = rootObject.newCursor(); rootCursor.toNextToken(); rootCursor.beginElement("xml"); for(int i=0; i < _items.size(); i++){ XmlCursor xc = _items.get(i).newCursor(); rootCursor.beginElement(_qnames.get(i)); while(xc.toNextToken() == XmlCursor.TokenType.ATTR) { Node anode = xc.getDomNode(); rootCursor.insertAttributeWithValue(anode.getLocalName(), anode.getNamespaceURI(), anode.getNodeValue()); } xc.toStartDoc(); xc.copyXmlContents(rootCursor); rootCursor.toNextToken(); xc.dispose(); } rootCursor.dispose(); rootObject.save(out, DEFAULT_XML_OPTIONS); }
picCur.toStartDoc(); picCur.moveXmlContents(grCur); picCur.dispose();
/** * Gets the root XmlObject for this document. */ private XmlObject getRootXmlObject() { XmlCursor cur = newCursor(); if (cur == null) return this; cur.toStartDoc(); XmlObject result = cur.getObject(); cur.dispose(); return result; }
private static Map<Object, List<XmlCursor>> createElementMap(XmlCursor cursor) { Map<Object, List<XmlCursor>> map = new HashMap<Object, List<XmlCursor>>(); cursor.toStartDoc(); if (cursor.toFirstChild()) { do { QName name = cursor.getName(); List<XmlCursor> locations = map.get(name); if (locations == null) { locations = new ArrayList<XmlCursor>(); map.put(name, locations); map.put(name.getLocalPart(), locations); } locations.add(cursor.newCursor()); } while(cursor.toNextSibling()); } return map; }
/** * Gets the root XmlObject for this document. */ private XmlObject getRootXmlObject() { XmlCursor cur = newCursor(); if (cur == null) return this; cur.toStartDoc(); XmlObject result = cur.getObject(); cur.dispose(); return result; }
/** * Gets the root XmlObject for this document. */ private XmlObject getRootXmlObject() { XmlCursor cur = newCursor(); if (cur == null) return this; cur.toStartDoc(); XmlObject result = cur.getObject(); cur.dispose(); return result; }
try { cursor = XmlBeansUtil.parse(originalSpecDD).newCursor(); cursor.toStartDoc(); cursor.toFirstChild(); String nameSpaceURI = cursor.getName().getNamespaceURI();
public DDBeanRootImpl(DeployableObject deployable, URL descriptor) throws DDBeanCreateException { this.deployable = deployable; InputStream is = null; try { is = descriptor.openStream(); try { XmlObject xmlObject = XmlBeansUtil.parse(is); XmlCursor c = xmlObject.newCursor(); try { c.toStartDoc(); c.toFirstChild(); docBean = new DDBeanImpl(this, this, "/" + c.getName().getLocalPart(), c); } finally { c.dispose(); } } finally { is.close(); } } catch (Exception e) { throw (DDBeanCreateException) new DDBeanCreateException("problem").initCause(e); } }
protected void write(OutputStream out) throws IOException { XmlObject rootObject = XmlObject.Factory.newInstance(); XmlCursor rootCursor = rootObject.newCursor(); rootCursor.toNextToken(); rootCursor.beginElement("xml"); for(int i=0; i < _items.size(); i++){ XmlCursor xc = _items.get(i).newCursor(); rootCursor.beginElement(_qnames.get(i)); while(xc.toNextToken() == XmlCursor.TokenType.ATTR) { Node anode = xc.getDomNode(); rootCursor.insertAttributeWithValue(anode.getLocalName(), anode.getNamespaceURI(), anode.getNodeValue()); } xc.toStartDoc(); xc.copyXmlContents(rootCursor); rootCursor.toNextToken(); xc.dispose(); } rootCursor.dispose(); XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSavePrettyPrint(); HashMap<String, String> map = new HashMap<String, String>(); map.put("urn:schemas-microsoft-com:vml", "v"); map.put("urn:schemas-microsoft-com:office:office", "o"); map.put("urn:schemas-microsoft-com:office:excel", "x"); xmlOptions.setSaveSuggestedPrefixes(map); rootObject.save(out, xmlOptions); }
protected void write(OutputStream out) throws IOException { XmlObject rootObject = XmlObject.Factory.newInstance(); XmlCursor rootCursor = rootObject.newCursor(); rootCursor.toNextToken(); rootCursor.beginElement("xml"); for(int i=0; i < _items.size(); i++){ XmlCursor xc = _items.get(i).newCursor(); rootCursor.beginElement(_qnames.get(i)); while(xc.toNextToken() == XmlCursor.TokenType.ATTR) { Node anode = xc.getDomNode(); rootCursor.insertAttributeWithValue(anode.getLocalName(), anode.getNamespaceURI(), anode.getNodeValue()); } xc.toStartDoc(); xc.copyXmlContents(rootCursor); rootCursor.toNextToken(); xc.dispose(); } rootCursor.dispose(); rootObject.save(out, DEFAULT_XML_OPTIONS); }
/** * * @param qname * @param value * @return */ static XML createTextElement(XMLLibImpl lib, javax.xml.namespace.QName qname, String value) { XScriptAnnotation anno; XmlObject xo = XmlObject.Factory.newInstance(); XmlCursor cursor = xo.newCursor(); try { cursor.toNextToken(); cursor.beginElement(qname.getLocalPart(), qname.getNamespaceURI()); //if(namespace.length() > 0) // cursor.insertNamespace("", namespace); cursor.insertChars(value); cursor.toStartDoc(); cursor.toNextToken(); anno = new XScriptAnnotation(cursor); cursor.setBookmark(anno); } finally { cursor.dispose(); } return new XML(lib, anno); }
copyCurs.toStartDoc(); copyCurs.toFirstContentToken();
picCur.toStartDoc(); picCur.moveXmlContents(grCur); picCur.dispose();
String version = "1.5"; SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.J2EE_NAMESPACE, schemaLocationURL, version); cursor.toStartDoc(); cursor.toChild(SchemaConversionUtils.J2EE_NAMESPACE, "connector"); cursor.toFirstChild();