程序包 org.xmeta.codes
类 XmlCoder
java.lang.Object
org.xmeta.codes.XmlCoder
public class XmlCoder extends Object
XML格式的模型编码,XML格式的模型不保存修改日期等。
- 作者:
- zyx
-
字段概要
-
构造器概要
构造器 构造器 说明 XmlCoder()
-
方法概要
修饰符和类型 方法 说明 static void
encode(Thing thing, OutputStream out)
把指定的模型以XML编码到输出流中。static void
encode(Thing thing, OutputStream out, boolean includeDefaultValue)
把指定的模型以XML编码到输出流中。static String
encodeToString(Thing thing)
把模型编码成XML字符串。static String
encodeToString(Thing thing, boolean includeDefaultValue)
把模型编码成XML字符串。static void
initDefaultValues(Thing thing)
static boolean
isAttributeNode(Node node)
具有换行的字符串可以保存到cdata下,如果节点不包含任何属性,并且子节点只有一个并且是CDATA,那么认为是属性: <xxx><!static void
parse(Thing thing, InputStream input)
从输入流中读取模型。static void
parse(Thing thing, String content)
分析XML字符串。static void
parse(Thing thing, Thing descriptor, InputStream input)
从输入流中读取模型。static void
parse(Thing thing, Thing descriptor, String content)
分析XML字符串并返回模型。static void
parse(Thing thing, Thing parentDescriptor, Element element, long lastModifyed)
分析XML元素数据到模型中。static void
setLastModified(Thing thing, long lastModified)
-
字段详细资料
-
构造器详细资料
-
XmlCoder
public XmlCoder()
-
-
方法详细资料
-
encodeToString
把模型编码成XML字符串。- 参数:
thing
- 模型- 返回:
- XML代码
-
encode
把指定的模型以XML编码到输出流中。- 参数:
thing
- 模型out
- 输出流- 抛出:
XMLStreamException
- XML异常IOException
- IO异常
-
encodeToString
把模型编码成XML字符串。- 参数:
thing
- 模型includeDefaultValue
- 是否包含默认值- 返回:
- XML字符串
-
encode
public static void encode(Thing thing, OutputStream out, boolean includeDefaultValue) throws XMLStreamException, IOException把指定的模型以XML编码到输出流中。- 参数:
thing
- 模型out
- 输出流includeDefaultValue
- 是否包含默认值- 抛出:
XMLStreamException
- XML异常IOException
- IO异常
-
parse
public static void parse(Thing thing, String content) throws ParserConfigurationException, SAXException, IOException分析XML字符串。- 参数:
thing
- 模型content
- 内容- 抛出:
ParserConfigurationException
- 分析异常IOException
- IO异常SAXException
- XML异常
-
parse
public static void parse(Thing thing, Thing descriptor, String content) throws ParserConfigurationException, SAXException, IOException分析XML字符串并返回模型。- 参数:
thing
- 模型content
- 内容- 抛出:
ParserConfigurationException
- 分析异常IOException
- IO异常SAXException
- XML异常
-
parse
public static void parse(Thing thing, InputStream input) throws SAXException, IOException, ParserConfigurationException从输入流中读取模型。- 参数:
thing
- 模型input
- 输入流- 抛出:
SAXException
- SAX异常IOException
- IO异常ParserConfigurationException
- 分析异常
-
parse
public static void parse(Thing thing, Thing descriptor, InputStream input) throws SAXException, IOException, ParserConfigurationException从输入流中读取模型。- 参数:
thing
- 模型input
- 输入流- 抛出:
SAXException
- SAX异常IOException
- IO异常ParserConfigurationException
- 分析异常
-
initDefaultValues
-
parse
分析XML元素数据到模型中。- 参数:
thing
- 模型element
- 元素parentDescriptor
- 父描述者lastModifyed
- 最后修改日期
-
isAttributeNode
具有换行的字符串可以保存到cdata下,如果节点不包含任何属性,并且子节点只有一个并且是CDATA,那么认为是属性: <xxx><![CDATA[]]></xxx>- 参数:
node
- 节点- 返回:
- 是否是属性
-
setLastModified
-