本文整理汇总了Java中org.jdom.output.Format.setOmitDeclaration方法的典型用法代码示例。如果您正苦于以下问题:Java Format.setOmitDeclaration方法的具体用法?Java Format.setOmitDeclaration怎么用?Java Format.setOmitDeclaration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdom.output.Format
的用法示例。
在下文中一共展示了Format.setOmitDeclaration方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import org.jdom.output.Format; //导入方法依赖的package包/类
static void write(File file) throws FileNotFoundException, IOException{
Document document = new Document();
Element root = new Element("document");
root.setAttribute("version", Main.VERSION_ID);
for(Blueprint bp : Main.blueprints){
Element blueprint = writeGraphEditor(bp);
for(VFunction f : bp.getFunctions()){
blueprint.addContent(writeGraphEditor(f.getEditor()));
}
root.addContent(blueprint);
}
document.setRootElement(root);
XMLOutputter output = new XMLOutputter();
Format format = Format.getPrettyFormat();//getRawFormat();
format.setOmitDeclaration(true);
format.setOmitEncoding(true);
format.setTextMode(TextMode.PRESERVE);
output.setFormat(format);
output.output(document, new FileOutputStream(file));
}
示例2: JPFClasspathFixProcessor
import org.jdom.output.Format; //导入方法依赖的package包/类
public JPFClasspathFixProcessor()
{
super();
sax = new SAXBuilder();
sax.setValidation(false);
sax.setReuseParser(true);
sax.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
Format format = Format.getRawFormat();
format.setOmitEncoding(true);
format.setOmitDeclaration(true);
format.setLineSeparator("\n");
format.setEncoding("UTF-8");
xmlOut = new XMLOutputter(format);
}
示例3: NewPluginWizard
import org.jdom.output.Format; //导入方法依赖的package包/类
public NewPluginWizard()
{
fFirstPage = new NewJPFPluginWizardPageOne();
fSecondPage = new NewJavaProjectWizardPageTwo(fFirstPage);
Format format = Format.getPrettyFormat();
format.setIndent("\t");
format.setOmitEncoding(true);
format.setOmitDeclaration(true);
format.setLineSeparator("\n");
format.setEncoding("UTF-8");
xmlOut = new XMLOutputter(format);
}
示例4: toCompactString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toCompactString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return xml;
}
示例5: toCompactString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toCompactString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return "<?xml version=\"1.0\"?>"+xml;
}
示例6: toEncodedURLString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toEncodedURLString() throws UnsupportedEncodingException {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return URLEncoder.encode("<?xml version=\"1.0\"?>"+xml, "UTF-8");
}
示例7: toEncodedJavaScriptSafeURLString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toEncodedJavaScriptSafeURLString() throws UnsupportedEncodingException {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
//xml = xml.replaceAll("\"","\\\\\"");
xml = xml.replaceAll("'","\\\\'");;
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return URLEncoder.encode("<?xml version=\"1.0\"?>"+xml, "UTF-8");
}
示例8: toJavaScriptSafeString
import org.jdom.output.Format; //导入方法依赖的package包/类
public String toJavaScriptSafeString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml="<?xml version=\"1.0\"?>"+xml;
xml = xml.replaceAll("'","\\\\'");
xml = xml.replaceAll("\"","\\\\\"");
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return xml;
}
示例9: toEncodedURLString
import org.jdom.output.Format; //导入方法依赖的package包/类
/**
* Returns the document encoded by the URLEncoder class after striping carriage returns and line feeds.
* @return the encoded string
* @throws UnsupportedEncodingException
*/
public String toEncodedURLString() throws UnsupportedEncodingException {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return URLEncoder.encode("<?xml version=\"1.0\"?>"+xml, "UTF-8");
}
示例10: toEncodedJavaScriptSafeURLString
import org.jdom.output.Format; //导入方法依赖的package包/类
/**
* An attempt to return an encoded string that is usable in JavaScript variable assignments.
* @return the encoded string
* @throws UnsupportedEncodingException
*/
public String toEncodedJavaScriptSafeURLString() throws UnsupportedEncodingException {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("\"","\\\\\"");
xml = xml.replaceAll("'","\\\\'");;
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return URLEncoder.encode("<?xml version=\"1.0\"?>"+xml, "UTF-8");
}
示例11: toJavaScriptSafeString
import org.jdom.output.Format; //导入方法依赖的package包/类
/**
* Attempt to return the document as a string that can be used in a JavaScript variable assignment.
* @return the docuement as a string
*/
public String toJavaScriptSafeString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
String xml = toString(format);
xml = xml.replaceAll("'","\\\\'");
xml = xml.replaceAll("\"","\\\\\"");
xml = xml.replaceAll("\\r\\n","");
xml = xml.replaceAll("\\r","");
xml = xml.replaceAll("\\n","");
return "<?xml version=\"1.0\"?>"+xml;
}
示例12: cswUPDATETransaction
import org.jdom.output.Format; //导入方法依赖的package包/类
private String cswUPDATETransaction(String query) throws KettleException, UnsupportedEncodingException{
try {
StringBuilder st = new StringBuilder("<response>");
Element rootElement=fromStringToJDOMDocument("<root>"+query+"</root>").getRootElement();
List<?> list=rootElement.getChildren();
final Iterator<?> it=list.iterator();
while (it.hasNext()){
Element courant1=(Element)it.next();
Element courant=(Element) courant1.clone();
StringBuilder sb = new StringBuilder(ENTETE_TRANSACTION_UPDATE);
courant.detach();
Format fmt = Format.getPrettyFormat();
fmt.setOmitDeclaration(true);
XMLOutputter outputter = new XMLOutputter(fmt);
String xmlString = outputter.outputString(new Document(courant));
sb.append(xmlString);
sb.append(getFilter(courant));
sb.append(FOOTPAGE_TRANSACTION_UPDATE);
sb = new StringBuilder (new String(sb.toString().getBytes(),"UTF-8"));
st.append(CSWPOST(sb.toString()));
st.delete(st.indexOf("<?"),st.indexOf("?>")+2);
}
st.append("</response>");
return st.toString();
} catch (KettleException e) {
throw new KettleException(e);
}
}
示例13: toCompactString
import org.jdom.output.Format; //导入方法依赖的package包/类
/**
* Returns the document as a String without any extra white space.
* @return the document as a compact string.
*/
public String toCompactString() {
Format format = Format.getCompactFormat();
format.setOmitDeclaration(true);
return "<?xml version=\"1.0\"?>"+toString(format);
}