本文整理了Java中org.exolab.castor.xml.Marshaller.setProperty()
方法的一些代码示例,展示了Marshaller.setProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marshaller.setProperty()
方法的具体详情如下:
包路径:org.exolab.castor.xml.Marshaller
类名称:Marshaller
方法名:setProperty
[英]Sets a custom value of a given Castor XML-specific property.
[中]设置给定Castor XML特定属性的自定义值。
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-atom
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the document.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/atom"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
//serializer.getMarshaller().setNamespaceMapping("", "http://www.w3.org/2005/Atom");
serializer.marshal(_feed, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-asx
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the ASX playlist.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/playlist/asx"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
serializer.marshal(this, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8"; // FIXME US-ASCII?
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-b4s
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the B4S playlist.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/playlist/b4s"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
serializer.marshal(this, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-smil
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the SMIL playlist.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/playlist/smil"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
serializer.marshal(this, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-hypetape
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the playlist.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping(
"chameleon/playlist/hypetape"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
serializer.marshal(this, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-plist
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the PLIST playlist.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/plist"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
serializer.marshal(_plist, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-wpl
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the SMIL playlist.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/playlist/wpl"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
serializer.marshal(this, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-xspf
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the playlist.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/playlist/xspf"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
serializer.marshal(this, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
代码示例来源:origin: com.github.muff1nman.chameleon/playlist-rss
@Override
public void writeTo(final OutputStream out, final String encoding) throws Exception
{
// Marshal the RSS document.
final StringWriter writer = new StringWriter();
final XmlSerializer serializer = XmlSerializer.getMapping("chameleon/rss"); // May throw Exception.
// Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
serializer.getMarshaller().setProperty("org.exolab.castor.indent", "true");
//serializer.getMarshaller().setNamespaceMapping("", "http://purl.org/rss/1.0/modules/content/");
serializer.getMarshaller().setNamespaceMapping("media", "http://search.yahoo.com/mrss/");
serializer.marshal(_rss, writer, false); // May throw Exception.
String enc = encoding;
if (enc == null)
{
enc = "UTF-8";
}
final byte[] bytes = writer.toString().getBytes(enc); // May throw UnsupportedEncodingException.
out.write(bytes); // Throws NullPointerException if out is null. May throw IOException.
out.flush(); // May throw IOException.
}
内容来源于网络,如有侵权,请联系作者删除!