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