📄 xmlserialization.html
字号:
readLongFromXML</H3><PRE>public long <B>readLongFromXML</B>(org.w3c.dom.Element node) throws java.lang.Exception</PRE><DL><DD>builds the primitive from the given DOM node.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>node</CODE> - the associated XML node<DT><B>Returns:</B><DD>the primitive created from the XML description<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if instantiation fails</DL></DD></DL><HR><A NAME="readShortFromXML(org.w3c.dom.Element)"><!-- --></A><H3>readShortFromXML</H3><PRE>public short <B>readShortFromXML</B>(org.w3c.dom.Element node) throws java.lang.Exception</PRE><DL><DD>builds the primitive from the given DOM node.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>node</CODE> - the associated XML node<DT><B>Returns:</B><DD>the primitive created from the XML description<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if instantiation fails</DL></DD></DL><HR><A NAME="readFromXML(java.lang.Object, java.lang.String, org.w3c.dom.Element)"><!-- --></A><H3>readFromXML</H3><PRE>public java.lang.Object <B>readFromXML</B>(java.lang.Object o, java.lang.String name, org.w3c.dom.Element child) throws java.lang.Exception</PRE><DL><DD>adds the specific node to the object via a set method<P><DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - the object to set a property<DD><CODE>name</CODE> - the name of the object for which to set a property (only for information reasons)<DD><CODE>child</CODE> - the value of the property to add<DT><B>Returns:</B><DD>the provided object, but augmented by the child<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong</DL></DD></DL><HR><A NAME="readFromXML(org.w3c.dom.Element)"><!-- --></A><H3>readFromXML</H3><PRE>public java.lang.Object <B>readFromXML</B>(org.w3c.dom.Element node) throws java.lang.Exception</PRE><DL><DD>builds the object from the given DOM node. (only public due to reflection)<P><DD><DL><DT><B>Parameters:</B><DD><CODE>node</CODE> - the associated XML node<DT><B>Returns:</B><DD>the instance created from the XML description<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if instantiation fails</DL></DD></DL><HR><A NAME="fromXML(org.w3c.dom.Document)"><!-- --></A><H3>fromXML</H3><PRE>public java.lang.Object <B>fromXML</B>(org.w3c.dom.Document document) throws java.lang.Exception</PRE><DL><DD>returns the given DOM document as an instance of the specified class<P><DD><DL><DT><B>Parameters:</B><DD><CODE>document</CODE> - the parsed DOM document representing the object<DT><B>Returns:</B><DD>the XML as object<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if object instantiation fails</DL></DD></DL><HR><A NAME="read(java.lang.String)"><!-- --></A><H3>read</H3><PRE>public java.lang.Object <B>read</B>(java.lang.String xml) throws java.lang.Exception</PRE><DL><DD>parses the given XML string (can be XML or a filename) and returns an Object generated from the representation<P><DD><DL><DT><B>Parameters:</B><DD><CODE>xml</CODE> - the xml to parse (if "<?xml" is not found then it is considered a file)<DT><B>Returns:</B><DD>the generated instance<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="read(java.io.File)"><!-- --></A><H3>read</H3><PRE>public java.lang.Object <B>read</B>(java.io.File file) throws java.lang.Exception</PRE><DL><DD>parses the given file and returns a DOM document<P><DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - the XML file to parse<DT><B>Returns:</B><DD>the parsed DOM document<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="read(java.io.InputStream)"><!-- --></A><H3>read</H3><PRE>public java.lang.Object <B>read</B>(java.io.InputStream stream) throws java.lang.Exception</PRE><DL><DD>parses the given stream and returns a DOM document<P><DD><DL><DT><B>Parameters:</B><DD><CODE>stream</CODE> - the XML stream to parse<DT><B>Returns:</B><DD>the parsed DOM document<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="read(java.io.Reader)"><!-- --></A><H3>read</H3><PRE>public java.lang.Object <B>read</B>(java.io.Reader reader) throws java.lang.Exception</PRE><DL><DD>parses the given reader and returns a DOM document<P><DD><DL><DT><B>Parameters:</B><DD><CODE>reader</CODE> - the XML reader to parse<DT><B>Returns:</B><DD>the parsed DOM document<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="write(java.lang.String, java.lang.Object)"><!-- --></A><H3>write</H3><PRE>public void <B>write</B>(java.lang.String file, java.lang.Object o) throws java.lang.Exception</PRE><DL><DD>writes the given object into the file<P><DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - the filename to write to<DD><CODE>o</CODE> - the object to serialize as XML<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="write(java.io.File, java.lang.Object)"><!-- --></A><H3>write</H3><PRE>public void <B>write</B>(java.io.File file, java.lang.Object o) throws java.lang.Exception</PRE><DL><DD>writes the given object into the file<P><DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - the filename to write to<DD><CODE>o</CODE> - the object to serialize as XML<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="write(java.io.OutputStream, java.lang.Object)"><!-- --></A><H3>write</H3><PRE>public void <B>write</B>(java.io.OutputStream stream, java.lang.Object o) throws java.lang.Exception</PRE><DL><DD>writes the given object into the stream<P><DD><DL><DT><B>Parameters:</B><DD><CODE>stream</CODE> - the filename to write to<DD><CODE>o</CODE> - the object to serialize as XML<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="write(java.io.Writer, java.lang.Object)"><!-- --></A><H3>write</H3><PRE>public void <B>write</B>(java.io.Writer writer, java.lang.Object o) throws java.lang.Exception</PRE><DL><DD>writes the given object into the writer<P><DD><DL><DT><B>Parameters:</B><DD><CODE>writer</CODE> - the filename to write to<DD><CODE>o</CODE> - the object to serialize as XML<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if something goes wrong with the parsing</DL></DD></DL><HR><A NAME="main(java.lang.String[])"><!-- --></A><H3>main</H3><PRE>public static void <B>main</B>(java.lang.String[] args) throws java.lang.Exception</PRE><DL><DD>for testing only. if the first argument is a filename with ".xml" as extension it tries to generate an instance from the XML description and does a <code>toString()</code> of the generated object.<P><DD><DL><DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://www.cs.waikato.ac.nz/ml/weka/" target="_blank"><FONT CLASS="NavBarFont1"><B>Weka's home</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../weka/core/xml/XMLOptions.html" title="class in weka.core.xml"><B>PREV CLASS</B></A> <A HREF="../../../weka/core/xml/XMLSerializationMethodHandler.html" title="class in weka.core.xml"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?weka/core/xml/XMLSerialization.html" target="_top"><B>FRAMES</B></A> <A HREF="XMLSerialization.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -