本文整理了Java中org.jdom2.output.Format.getRawFormat()
方法的一些代码示例,展示了Format.getRawFormat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Format.getRawFormat()
方法的具体详情如下:
包路径:org.jdom2.output.Format
类名称:Format
方法名:getRawFormat
[英]Returns a new Format object that performs no whitespace changes, uses the UTF-8 encoding, doesn't expand empty elements, includes the declaration and encoding, and uses the default entity escape strategy. Tweaks can be made to the returned Format instance without affecting other instances.
[中]返回一个新的Format对象,该对象不执行空格更改,使用UTF-8编码,不展开空元素,包括声明和编码,并使用默认的实体转义策略。可以对返回的格式实例进行调整,而不会影响其他实例。
代码示例来源:origin: org.jdom/jdom
/**
* Set the current {@link Format} to be used for output.
*
* @param format
* the new Format
*/
public void setFormat(Format format) {
this.format = format == null ? Format.getRawFormat() : format;
}
代码示例来源:origin: org.jdom/jdom
/**
* Set a new Format instance for this DOMOutputter
*
* @param format
* the new Format instance to use (null implies the default)
* @since JDOM2
*/
public void setFormat(Format format) {
this.format = format == null ? Format.getRawFormat() : format;
}
代码示例来源:origin: org.jdom/jdom
/**
* The complete constructor for specifying a custom DOMAdaptor, Format, and
* DOMOutputProcessor.
*
* @param adapter
* The adapter to use to create the base Document instance (null
* implies the default).
* @param format
* The output Format to use (null implies the default).
* @param processor
* The custom mechanism for doing the output (null implies the
* default).
* @since JDOM2
*/
public DOMOutputter(DOMAdapter adapter, Format format,
DOMOutputProcessor processor) {
this.adapter = adapter == null ? DEFAULT_ADAPTER : adapter;
this.format = format == null ? Format.getRawFormat() : format;
this.processor = processor == null ? DEFAULT_PROCESSOR : processor;
}
代码示例来源:origin: org.jdom/jdom
LexicalHandler lexicalHandler) {
this.processor = processor == null ? DEFAULT_PROCESSOR : processor;
this.format = format == null ? Format.getRawFormat() : format;
this.contentHandler = contentHandler;
this.errorHandler = errorHandler;
代码示例来源:origin: org.jdom/jdom
/**
* This will create an <code>XMLOutputter</code> with the specified format
* characteristics.
* <p>
* <b>Note:</b> the format object is cloned internally before use. If you
* want to modify the Format after constructing the XMLOutputter you can
* modify the Format instance {@link #getFormat()} returns.
*
* @param format
* The Format instance to use. This instance will be cloned() and as
* a consequence, changes made to the specified format instance
* <b>will not</b> be reflected in this XMLOutputter. A null input
* format indicates that XMLOutputter should use the default
* {@link Format#getRawFormat()}
* @param processor
* The XMLOutputProcessor to delegate output to. If null the
* XMLOutputter will use the default XMLOutputProcessor.
*/
public XMLOutputter(Format format, XMLOutputProcessor processor) {
myFormat = format == null ? Format.getRawFormat() : format.clone();
myProcessor = processor == null ? DEFAULTPROCESSOR : processor;
}
代码示例来源:origin: org.jdom/jdom
/**
* This will create an <code>StAXStreamOutputter</code> with the specified format
* characteristics.
* <p>
* <b>Note:</b> the format object is cloned internally before use. If you
* want to modify the Format after constructing the StAXStreamOutputter you can
* modify the Format instance {@link #getFormat()} returns.
*
* @param format
* The Format instance to use. This instance will be cloned() and as
* a consequence, changes made to the specified format instance
* <b>will not</b> be reflected in this StAXStreamOutputter. A null input
* format indicates that StAXStreamOutputter should use the default
* {@link Format#getRawFormat()}
* @param processor
* The XMLOutputProcessor to delegate output to. If null the
* StAXStreamOutputter will use the default XMLOutputProcessor.
*/
public StAXStreamOutputter(Format format, StAXStreamProcessor processor) {
myFormat = format == null ? Format.getRawFormat() : format.clone();
myProcessor = processor == null ? DEFAULTPROCESSOR : processor;
}
代码示例来源:origin: org.jdom/jdom
/**
* This will create an <code>StAXStreamOutputter</code> with the specified format
* characteristics.
* <p>
* <b>Note:</b> the format object is cloned internally before use. If you
* want to modify the Format after constructing the StAXStreamOutputter you can
* modify the Format instance {@link #getFormat()} returns.
*
* @param format
* The Format instance to use. This instance will be cloned() and as
* a consequence, changes made to the specified format instance
* <b>will not</b> be reflected in this StAXStreamOutputter. A null input
* format indicates that StAXStreamOutputter should use the default
* {@link Format#getRawFormat()}
* @param processor
* The XMLOutputProcessor to delegate output to. If null the
* StAXStreamOutputter will use the default XMLOutputProcessor.
* @param eventfactory
* The factory to use to create XMLEvent instances.
*/
public StAXEventOutputter(Format format, StAXEventProcessor processor, XMLEventFactory eventfactory) {
myFormat = format == null ? Format.getRawFormat() : format.clone();
myProcessor = processor == null ? DEFAULTPROCESSOR : processor;
myEventFactory = eventfactory == null ? DEFAULTEVENTFACTORY : eventfactory;
}
代码示例来源:origin: usethesource/rascal
public IString xmlRaw(IConstructor node) throws IOException {
return xmlToString(node, Format.getRawFormat());
}
代码示例来源:origin: com.sap.cloud.s4hana.plugins/usage-analytics
void output( @Nonnull final Document document, @Nonnull final File outputFile )
throws IOException
{
try( final FileOutputStream fileOutputStream = new FileOutputStream(outputFile) ) {
new XMLOutputter(Format.getRawFormat()).output(document, fileOutputStream);
}
}
}
代码示例来源:origin: com.xebialabs.cloud/overcast
public static String documentToRawString(Document xml) throws IOException {
return documentToString(xml, Format.getRawFormat().setOmitDeclaration(true)).trim();
}
代码示例来源:origin: org.openfuxml/ofx-wiki
public static synchronized void writeXml(String dirName, String fileName, String content)
{
logger.debug("Writing Xml to "+dirName+"/"+fileName);
try
{
Reader sr = new StringReader(content);
Document doc = new SAXBuilder().build(sr);
XMLOutputter xmlOut = new XMLOutputter(Format.getRawFormat() );
File f = new File(dirName+"/"+fileName);
OutputStream os = new FileOutputStream(f);
OutputStreamWriter osw = new OutputStreamWriter(os,"UTF-8");
xmlOut.output( doc, osw );
osw.close();os.close();
}
catch (JDOMException e) {logger.error("",e);}
catch (IOException e) {logger.error("",e);}
}
代码示例来源:origin: org.openfuxml/ofx-util
public void createIds(File srcFile, File dstFile) throws OfxInternalProcessingException
{
if(srcFile==null){throw new OfxInternalProcessingException("FileNoteFound: "+srcFile.getAbsolutePath());}
doc = JDomUtil.load(srcFile);
if(doc==null){throw new OfxInternalProcessingException("FileNoteFound: "+srcFile.getAbsolutePath());}
try
{
idCreator();
JDomUtil.save(doc, dstFile, Format.getRawFormat());
}
catch (JDOMException e)
{
logger.error("",e);
}
}
代码示例来源:origin: org.apache.maven.plugins/maven-shade-plugin
/**
* Method write
*
* @param project
* @param writer
* @param document
*/
public void write( Model project, Document document, OutputStreamWriter writer )
throws java.io.IOException
{
Format format = Format.getRawFormat();
format.setEncoding( writer.getEncoding() ).setLineSeparator( System.getProperty( "line.separator" ) );
write( project, document, writer, format );
} // -- void write(Model, Document, OutputStreamWriter)
代码示例来源:origin: org.mycore/oaipmh-dataprovider
@Override
public String toString(Format format) {
try {
Element e = marshal();
XMLOutputter out = new XMLOutputter(Format.formatted.equals(format) ? org.jdom2.output.Format.getPrettyFormat() : org.jdom2.output.Format.getRawFormat());
StringWriter writer = new StringWriter();
out.output(e, writer);
return writer.toString();
} catch (Exception exc) {
throw new OAIImplementationException(exc);
}
}
代码示例来源:origin: org.openfuxml/ofx-wiki
public synchronized static StringBuffer toString(Wikiinjection injection)
{
StringBufferOutputStream sbos = new StringBufferOutputStream();
try
{
Element element = toElement(injection, Wikiinjection.class);
XMLOutputter xmlOut = new XMLOutputter(Format.getRawFormat() );
xmlOut.output(element, sbos);
}
catch (IOException e) {logger.error("",e);}
return sbos.getStringBuffer();
}
代码示例来源:origin: org.openfuxml/ofx-wiki
public void process() throws OfxInternalProcessingException, OfxConfigurationException
{
File fTemplateDir = getDir(WikiProcessor.WikiDir.wikiTemplate);
for(File fTemplate : fTemplateDir.listFiles())
{
try
{
Template template = (Template)JaxbUtil.loadJAXB(fTemplate.getAbsolutePath(), Template.class);
File fOfxTemplate = new File(getDir(WikiProcessor.WikiDir.ofxTemplate),template.getId()+".xml");
Document doc = processTemplate(template);
JDomUtil.save(doc, fOfxTemplate, Format.getRawFormat());
}
catch (FileNotFoundException e)
{
throw new OfxInternalProcessingException(e.getMessage());
}
}
}
代码示例来源:origin: org.openfuxml/ofx-wiki
public void processPage(Page page) throws OfxAuthoringException, OfxInternalProcessingException
{
checkPageConfig(page);
try
{
String srcName = page.getFile()+"."+WikiProcessor.WikiFileExtension.xhtml;
String dstName = page.getFile()+"."+WikiProcessor.WikiFileExtension.xml;
String txtMarkup = StringIO.loadTxt(srcDir, srcName);
String result = process(txtMarkup, page.getName());
File fDst = new File(dstDir, dstName);
Document doc = JDomUtil.txtToDoc(result);
doc = checkTransparent(doc, page.getSection());
logger.warn("Content Trimmer deactivated here");
// doc = ofxContentTrimmer.trim(doc);
JDomUtil.save(doc, fDst, Format.getRawFormat());
}
catch (IOException e) {logger.error("",e);}
catch (ParserConfigurationException e) {logger.error("",e);}
catch (XMLStreamException e) {logger.error("",e);}
catch (SAXException e) {logger.error("",e);}
catch (JDOMException e) {logger.error("",e);}
}
代码示例来源:origin: org.apache.jspwiki/jspwiki-main
/**
* {@inheritDoc}
*/
public String getString()
throws IOException
{
m_document.setContext( m_context );
CustomXMLOutputProcessor processor = new CustomXMLOutputProcessor();
XMLOutputter output = new XMLOutputter(processor);
StringWriter out = new StringWriter();
Format fmt = Format.getRawFormat();
fmt.setExpandEmptyElements( false );
fmt.setLineSeparator( LINEBREAK );
output.setFormat( fmt );
output.outputElementContent( m_document.getRootElement(), out );
String result = out.toString();
return result;
}
}
代码示例来源:origin: org.apache.jspwiki/jspwiki-main
/**
* {@inheritDoc}
*/
public String getString()
throws IOException
{
Element rootElement = m_document.getRootElement();
processChildren( rootElement );
m_document.setContext( m_context );
XMLOutputter output = new XMLOutputter();
StringWriter out = new StringWriter();
Format fmt = Format.getRawFormat();
fmt.setExpandEmptyElements( false );
fmt.setLineSeparator( LINEBREAK );
output.setFormat( fmt );
output.outputElementContent( m_document.getRootElement(), out );
return out.toString();
}
}
代码示例来源:origin: com.atlassian.maven.plugins/maven-jgitflow-plugin
Format format = Format.getRawFormat();
format.setLineSeparator( ls );
XMLOutputter out = new XMLOutputter( format );
内容来源于网络,如有侵权,请联系作者删除!