本文整理汇总了Java中org.apache.xmlbeans.XmlCursor.isStartdoc方法的典型用法代码示例。如果您正苦于以下问题:Java XmlCursor.isStartdoc方法的具体用法?Java XmlCursor.isStartdoc怎么用?Java XmlCursor.isStartdoc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlbeans.XmlCursor
的用法示例。
在下文中一共展示了XmlCursor.isStartdoc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tokenType
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @return
*/
XmlCursor.TokenType tokenType()
{
XmlCursor.TokenType result;
XmlCursor curs = newCursor();
if (curs.isStartdoc())
{
curs.toFirstContentToken();
}
result = curs.currentTokenType();
curs.dispose();
return result;
}
示例2: appendChild
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param xml
* @return
*/
XML appendChild(Object xml)
{
XmlCursor curs = newCursor();
if (curs.isStartdoc())
{
curs.toFirstContentToken();
}
// Move the cursor to the end of this element
if (curs.isStart())
{
curs.toEndToken();
}
insertChild(curs, xml);
curs.dispose();
return this;
}
示例3: copy
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @return
*/
Object copy()
{
XmlCursor srcCurs = newCursor();
if (srcCurs.isStartdoc())
{
srcCurs.toFirstContentToken();
}
XML xml = createEmptyXML(lib);
XmlCursor destCurs = xml.newCursor();
destCurs.toFirstContentToken();
srcCurs.copyXml(destCurs);
destCurs.dispose();
srcCurs.dispose();
return xml;
}
示例4: hasSimpleContent
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @return
*/
boolean hasSimpleContent()
{
boolean simpleContent = false;
XmlCursor curs = newCursor();
if (curs.isAttr() || curs.isText()) {
return true;
}
if (curs.isStartdoc())
{
curs.toFirstContentToken();
}
simpleContent = !(curs.toFirstChild());
curs.dispose();
return simpleContent;
}
示例5: localName
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @return
*/
String localName()
{
XmlCursor cursor = newCursor();
if (cursor.isStartdoc())
cursor.toFirstContentToken();
String name = null;
if(cursor.isStart() ||
cursor.isAttr() ||
cursor.isProcinst())
{
javax.xml.namespace.QName qname = cursor.getName();
name = qname.getLocalPart();
}
cursor.dispose();
return name;
}
示例6: prependChild
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param xml
* @return
*/
XML prependChild (Object xml)
{
XmlCursor curs = newCursor();
if (curs.isStartdoc())
{
curs.toFirstContentToken();
}
// Move the cursor to the first content token
curs.toFirstContentToken();
insertChild(curs, xml);
curs.dispose();
return this;
}
示例7: setLocalName
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @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();
}
}
示例8: setNamespace
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param ns
*/
void setNamespace(Namespace ns)
{
XmlCursor cursor = newCursor();
try
{
if(cursor.isStartdoc())
cursor.toFirstContentToken();
if(cursor.isText() ||
cursor.isComment() ||
cursor.isProcinst()) return;
String prefix = ns.prefix();
if (prefix == null) {
prefix = "";
}
cursor.setName(new javax.xml.namespace.QName(
ns.uri(), localName(), prefix));
}
finally
{
cursor.dispose();
}
}
示例9: toString
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @return
*/
public String toString()
{
String result;
XmlCursor curs = newCursor();
if (curs.isStartdoc())
{
curs.toFirstContentToken();
}
if (curs.isText())
{
result = curs.getChars();
}
else if (curs.isStart() && hasSimpleContent())
{
result = curs.getTextValue();
}
else
{
result = toXMLString(0);
}
return result;
}
示例10: dumpNode
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param cursor
* @param opts
* @return
*/
private static String dumpNode(XmlCursor cursor, XmlOptions opts)
{
if (cursor.isText())
return cursor.getChars();
if (cursor.isFinish())
return "";
cursor.push();
boolean wanRawText = cursor.isStartdoc() && !cursor.toFirstChild();
cursor.pop();
return wanRawText ? cursor.getTextValue() : cursor.xmlText( opts );
}
示例11: replace
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param destCurs
* @param newValue
*/
private void replace(XmlCursor destCurs, XML newValue)
{
if (destCurs.isStartdoc())
{
// Can't overwrite a whole document (user really wants to overwrite the contents of).
destCurs.toFirstContentToken();
}
// Orphan the token -- don't delete it outright on the XmlCursor.
removeToken(destCurs);
XmlCursor srcCurs = newValue.newCursor();
if (srcCurs.currentTokenType().isStartdoc())
{
// Cann't append a whole document (user really wants to append the contents of).
srcCurs.toFirstContentToken();
}
moveSrcToDest(srcCurs, destCurs, false);
// Re-link a new annotation to this cursor -- we just deleted the previous annotation on entrance to replace.
if (!destCurs.toPrevSibling())
{
destCurs.toPrevToken();
}
destCurs.setBookmark(new XScriptAnnotation(destCurs));
// todo would be nice if destCurs.toNextSibling went to where the next token if the cursor was pointing at the last token in the stream.
destCurs.toEndToken();
destCurs.toNextToken();
srcCurs.dispose();
}
示例12: namespace
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @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;
}
示例13: setName
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @param name
*/
void setName(QName qname)
{
XmlCursor cursor = newCursor();
try
{
if(cursor.isStartdoc())
cursor.toFirstContentToken();
if(cursor.isText() || cursor.isComment()) return;
if(cursor.isProcinst())
{
String localName = qname.localName();
cursor.setName(new javax.xml.namespace.QName(localName));
}
else
{
String prefix = qname.prefix();
if (prefix == null) { prefix = ""; }
cursor.setName(new javax.xml.namespace.QName(
qname.uri(), qname.localName(), prefix));
}
}
finally
{
cursor.dispose();
}
}
示例14: toXMLString
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
/**
*
* @return
*/
String toXMLString(int indent)
{
// XXX indent is ignored
String result;
XmlCursor curs = newCursor();
if (curs.isStartdoc())
{
curs.toFirstContentToken();
}
try
{
if (curs.isText())
{
result = curs.getChars();
}
else if (curs.isAttr())
{
result = curs.getTextValue();
}
else if (curs.isComment() || curs.isProcinst())
{
result = XML.dumpNode(curs, getOptions());
// todo: XBeans-dependent hack here
// If it's a comment or PI, take off the xml-frament stuff
String start = "<xml-fragment>";
String end = "</xml-fragment>";
if (result.startsWith(start))
{
result = result.substring(start.length());
}
if (result.endsWith(end))
{
result = result.substring(0, result.length() - end.length());
}
}
else
{
result = XML.dumpNode(curs, getOptions());
}
}
finally
{
curs.dispose();
}
return result;
}
示例15: nodesEqual
import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
public static boolean nodesEqual(XmlCursor xmlOne, XmlCursor xmlTwo)
{
boolean result = false;
if (xmlOne.isStartdoc())
{
xmlOne.toFirstContentToken();
}
if (xmlTwo.isStartdoc())
{
xmlTwo.toFirstContentToken();
}
if (xmlOne.currentTokenType() == xmlTwo.currentTokenType())
{
if (xmlOne.isEnddoc())
{
// Both empty
result = true;
}
else if (xmlOne.isAttr())
{
result = attributesEqual(xmlOne, xmlTwo);
}
else if (xmlOne.isText())
{
result = textNodesEqual(xmlOne, xmlTwo);
}
else if (xmlOne.isComment())
{
result = commentsEqual(xmlOne, xmlTwo);
}
else if (xmlOne.isProcinst())
{
result = processingInstructionsEqual(xmlOne, xmlTwo);
}
else if (xmlOne.isStart())
{
// Compare root elements
result = elementsEqual(xmlOne, xmlTwo);
}
}
return result;
}