×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

This is the ruleset bean. Use this bean you can marshal and unmarshal XML file. Use getPrcondition to get all precondition or one index precondition. Use setPrecondition to set precondition.

本文发表在 rolia.net 枫下论坛/**
* This file is generated by BorlandXML.
*/

package tmp;

import java.util.*;

/**
* The Ruleset class represents the element "ruleset" with the content
* model defined as follows:
* <p>
* &lt;!ELEMENT ruleset (rule*,prcondition*)&gt;<br>
*/
public class Ruleset extends com.borland.xml.toolkit.XmlObject
{
/** element-type name of this element. */
public static String _tagName = "ruleset";
/** Defines a list of Rule objects. */
protected ArrayList _objRule = new ArrayList();
/** Defines a list of Prcondition objects. */
protected ArrayList _objPrcondition = new ArrayList();
/** Public identifier. */
protected String publicId = "";
/** System identifier. */
protected String systemId = "";
/** Outputter object to control the format of XML output. */
protected com.borland.xml.toolkit.Outputter _outputter = null;

/**
* Creates an empty Ruleset object
*/
public Ruleset()
{
super();
}

/**
* Returns an array of Rule objects. The length of the returned
* array is zero if the list of Rule object is empty.
*/
public Rule[] getRule()
{
return (Rule[])_objRule.toArray(new Rule[0]);
}

/**
* Replaces all existing Rule objects with a new array of
* Rule objects.
* @param objArray an array of Rule objects.
*/
public void setRule(Rule[] objArray)
{
if( objArray == null || objArray.length == 0 )
this._objRule.clear();
else
{
this._objRule = new ArrayList(Arrays.asList(objArray));
for( int i=0; i<objArray.length; i++ )
{
if( objArray[i] != null )
objArray[i]._setParent(this);
}
}
}

/**
* Gets the Rule object at the specified index.
* @param index index of the returned object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public Rule getRule(int index)
{
return (Rule)_objRule.get(index);
}

/**
* Replaces an existing Rule object at the specified index with
* a new Rule object.
* @param index index of replaced object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public void setRule(int index, Rule obj)
{
if( obj == null )
removeRule(index);
else
{
_objRule.set(index, obj);
obj._setParent(this);
}
}

/**
* Returns the number of Rule objects in the list.
*/
public int getRuleCount()
{
return _objRule.size();
}

/**
* Returns <code>true</code> if there is no Rule object in the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean isNoRule()
{
return _objRule.size() == 0;
}

/**
* Returns a read-only list of Rule objects.
*/
public List getRuleList()
{
return Collections.unmodifiableList(_objRule);
}

/**
* Adds a new Rule object at the end of the list.
* @return <code>true</code> if the new object is added to the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean addRule(Rule obj)
{
if( obj==null )
return false;

obj._setParent(this);
return _objRule.add(obj);
}

/**
* Adds a list of new Rule objects at the end of the list.
* @return <code>true</code> if the list was changed; otherwise, the method
* returns <code>false</code>.
*/
public boolean addRule(Collection coRule)
{
if( coRule==null )
return false;

java.util.Iterator it = coRule.iterator();
while( it.hasNext() )
{
Object obj = it.next();
if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
}
return _objRule.addAll(coRule);
}

/**
* Removes an existing Rule object at the specified index.
* @return The removed object.
*/
public Rule removeRule(int index)
{
return (Rule)_objRule.remove(index);
}

/**
* Removes the specified Rule object.
* @return <code>true</code> if this list contains the object; otherwise,
* the method returns <code>false</code>.
*/
public boolean removeRule(Rule obj)
{
return _objRule.remove(obj);
}

/**
* Clears all Rule objects from the list.
*/
public void clearRuleList()
{
_objRule.clear();
}
/**
* Returns an array of Prcondition objects. The length of the returned
* array is zero if the list of Prcondition object is empty.
*/
public Prcondition[] getPrcondition()
{
return (Prcondition[])_objPrcondition.toArray(new Prcondition[0]);
}

/**
* Replaces all existing Prcondition objects with a new array of
* Prcondition objects.
* @param objArray an array of Prcondition objects.
*/
public void setPrcondition(Prcondition[] objArray)
{
if( objArray == null || objArray.length == 0 )
this._objPrcondition.clear();
else
{
this._objPrcondition = new ArrayList(Arrays.asList(objArray));
for( int i=0; i<objArray.length; i++ )
{
if( objArray[i] != null )
objArray[i]._setParent(this);
}
}
}

/**
* Gets the Prcondition object at the specified index.
* @param index index of the returned object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public Prcondition getPrcondition(int index)
{
return (Prcondition)_objPrcondition.get(index);
}

/**
* Replaces an existing Prcondition object at the specified index with
* a new Prcondition object.
* @param index index of replaced object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public void setPrcondition(int index, Prcondition obj)
{
if( obj == null )
removePrcondition(index);
else
{
_objPrcondition.set(index, obj);
obj._setParent(this);
}
}

/**
* Returns the number of Prcondition objects in the list.
*/
public int getPrconditionCount()
{
return _objPrcondition.size();
}

/**
* Returns <code>true</code> if there is no Prcondition object in the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean isNoPrcondition()
{
return _objPrcondition.size() == 0;
}

/**
* Returns a read-only list of Prcondition objects.
*/
public List getPrconditionList()
{
return Collections.unmodifiableList(_objPrcondition);
}

/**
* Adds a new Prcondition object at the end of the list.
* @return <code>true</code> if the new object is added to the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean addPrcondition(Prcondition obj)
{
if( obj==null )
return false;

obj._setParent(this);
return _objPrcondition.add(obj);
}

/**
* Adds a list of new Prcondition objects at the end of the list.
* @return <code>true</code> if the list was changed; otherwise, the method
* returns <code>false</code>.
*/
public boolean addPrcondition(Collection coPrcondition)
{
if( coPrcondition==null )
return false;

java.util.Iterator it = coPrcondition.iterator();
while( it.hasNext() )
{
Object obj = it.next();
if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
}
return _objPrcondition.addAll(coPrcondition);
}

/**
* Removes an existing Prcondition object at the specified index.
* @return The removed object.
*/
public Prcondition removePrcondition(int index)
{
return (Prcondition)_objPrcondition.remove(index);
}

/**
* Removes the specified Prcondition object.
* @return <code>true</code> if this list contains the object; otherwise,
* the method returns <code>false</code>.
*/
public boolean removePrcondition(Prcondition obj)
{
return _objPrcondition.remove(obj);
}

/**
* Clears all Prcondition objects from the list.
*/
public void clearPrconditionList()
{
_objPrcondition.clear();
}
/**
* Marshals this object to an instance document and outputs it to the specified output stream.
* @param out OutputStream object to receive the instance document.
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.OutputStream out)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(), _outputter );
}

/**
* Marshals this object to an instance document and outputs it to the specified output stream.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the default encoding specified in XmlUtil class </li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param out OutputStream object to receive the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
* @see com.borland.xml.toolkit.XmlUtil
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.OutputStream out, String indent)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent) );
}

/**
* Marshals this object to an instance document and outputs it to the specified output stream.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param out OutputStream object to receive the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param encoding an encoding format, such as UTF-8.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.OutputStream out, String indent, String encoding)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, encoding) );
}

/**
* Marshals this object to an instance document and outputs it to the specified output stream.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>newlines</code> is <code>true</code>, elements
* are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration if
* <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
* <li>printing the XML declaration if <code>printDeclaration</code> is
* <code>true</code>; no printing, otherwise.</li><br>
* @param out OutputStream object to receive the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param newlines boolean value to specify whether you want to separate
* elements with carriage return and line feed ("\r\n").
* @param encoding an encoding format, such as UTF-8.
* @param printEncoding <code>true</code> to print the "encoding" attribute;
* <code>false</code>, otherwise.
* @param printDeclaration <code>true</code> to print the XML declaration;
* <code>false</code>, otherwise.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
* boolean printEncoding, boolean printDeclaration)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.OutputStream out, String indent, boolean newlines,
String encoding, boolean printEncoding, boolean printDeclaration)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
printEncoding,
printDeclaration) );
}

/**
* Marshals this object to an instance document and outputs it to the specified output stream.
* The format of XML output is controlled by the specified outputter.
* @param out OutputStream object to receive the instance document.
* @param outputter Outputter object to control the format of XML output.
* @see com.borland.xml.toolkit.Outputter
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.OutputStream out, com.borland.xml.toolkit.Outputter outputter)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
outputter );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* @param fileName file to store the instance document.
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(String fileName)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(),
getSystemId(), _outputter );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the default encoding specified in XmlUtil class </li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param fileName file to store the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
* @see com.borland.xml.toolkit.XmlUtil
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(String fileName, String indent)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent) );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param fileName file to store the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param encoding an encoding format, such as UTF-8.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(String fileName, String indent, String encoding)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, encoding) );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>newlines</code> is <code>true</code>, elements
* are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration if
* <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
* <li>printing the XML declaration if <code>printDeclaration</code> is
* <code>true</code>; no printing, otherwise.</li><br>
* @param fileName file to store the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param newlines boolean value to specify whether you want to separate
* elements with carriage return and line feed ("\r\n").
* @param encoding an encoding format, such as UTF-8.
* @param printEncoding <code>true</code> to print the "encoding" attribute;
* <code>false</code>, otherwise.
* @param printDeclaration <code>true</code> to print the XML declaration;
* <code>false</code>, otherwise.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
* boolean printEncoding, boolean printDeclaration)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(String fileName, String indent, boolean newlines,
String encoding, boolean printEncoding, boolean printDeclaration)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
printEncoding,
printDeclaration) );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The format of XML output is controlled by the specified outputter.
* @param fileName file to store the instance document.
* @param outputter Outputter object to control the format of XML output.
* @see com.borland.xml.toolkit.Outputter
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(String fileName, com.borland.xml.toolkit.Outputter outputter)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(),
getSystemId(), outputter );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* @param file File to store the instance document.
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.File file)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(),
getSystemId(), _outputter );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the default encoding specified in XmlUtil class </li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param file File to store the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
* @see com.borland.xml.toolkit.XmlUtil
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.File file, String indent)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent) );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param file File to store the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param encoding an encoding format, such as UTF-8.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.File file, String indent, String encoding)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, encoding) );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>newlines</code> is <code>true</code>, elements
* are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration if
* <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
* <li>printing the XML declaration if <code>printDeclaration</code> is
* <code>true</code>; no printing, otherwise.</li><br>
* @param file File to store the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param newlines boolean value to specify whether you want to separate
* elements with carriage return and line feed ("\r\n").
* @param encoding an encoding format, such as UTF-8.
* @param printEncoding <code>true</code> to print the "encoding" attribute;
* <code>false</code>, otherwise.
* @param printDeclaration <code>true</code> to print the XML declaration;
* <code>false</code>, otherwise.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
* boolean printEncoding, boolean printDeclaration)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.File file, String indent, boolean newlines,
String encoding, boolean printEncoding, boolean printDeclaration)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
printEncoding,
printDeclaration) );
}

/**
* Marshals this object to an instance document and stores it in the specified file.
* The format of XML output is controlled by the specified outputter.
* @param file File to store the instance document.
* @param outputter Outputter object to control the format of XML output.
* @see com.borland.xml.toolkit.Outputter
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.File file, com.borland.xml.toolkit.Outputter outputter)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
outputter );
}

/**
* Marshals this object to an instance document and outputs it to the specified writer.
* @param writer Writer object to receive the instance document.
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.Writer writer)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(),
getSystemId(), _outputter );
}

/**
* Marshals this object to an instance document and outputs it to the specified writer.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the default encoding specified in XmlUtil class </li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param writer Writer object to receive the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
* @see com.borland.xml.toolkit.XmlUtil
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.Writer writer, String indent)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent) );
}

/**
* Marshals this object to an instance document and outputs it to the specified writer.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>indent</code> is not <code>null</code>, elements
* are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration</li><br>
* <li>printing the XML declaration</li><br>
* @param writer Writer object to receive the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param encoding an encoding format, such as UTF-8.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.Writer writer, String indent, String encoding)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, encoding) );
}

/**
* Marshals this object to an instance document and outputs it to the specified writer.
* The XML output has the following attributes:<br>
* <li>using the specified indent</li><br>
* <li>If the parameter <code>newlines</code> is <code>true</code>, elements
* are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
* no newline is generated between elements.</li><br>
* <li>using the specified encoding</li><br>
* <li>printing the "encoding" attribute in the XML declaration if
* <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
* <li>printing the XML declaration if <code>printDeclaration</code> is
* <code>true</code>; no printing, otherwise.</li><br>
* @param writer Writer object to receive the instance document.
* @param indent the string (usually white spaces) used to indent elements.
* @param newlines boolean value to specify whether you want to separate
* elements with carriage return and line feed ("\r\n").
* @param encoding an encoding format, such as UTF-8.
* @param printEncoding <code>true</code> to print the "encoding" attribute;
* <code>false</code>, otherwise.
* @param printDeclaration <code>true</code> to print the XML declaration;
* <code>false</code>, otherwise.
* @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
* boolean printEncoding, boolean printDeclaration)
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.Writer writer, String indent, boolean newlines,
String encoding, boolean printEncoding, boolean printDeclaration)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
printEncoding,
printDeclaration) );
}

/**
* Marshals this object to an instance document and outputs it to the specified writer.
* The format of XML output is controlled by the specified outputter.
* @param writer Writer object to receive the instance document.
* @param outputter Outputter object to control the format of XML output.
* @see com.borland.xml.toolkit.Outputter
* @throws java.io.IOException An IO error occurs when writing out the instance document.
*/
public void marshal(java.io.Writer writer, com.borland.xml.toolkit.Outputter outputter)
throws java.io.IOException
{
com.borland.xml.toolkit.Element elem = marshal();
com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
outputter );
}

/**
* Unmarshals an instance document back to a Ruleset object from an input stream.
* @param in The InputStream object to read the instance document.
* @param saxParserClass fully qualified class name to identify a SAX parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.SAXParser</code> is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
* @param entityResolver EntityResolver object to provide customized handling for
* external entities.
* @param dtdHandler DtdHandler object to receive notification of notation
* declaration and unparsed entity declaration events.
* @param errorHandler ErrorHandler object to provide customized error handling.
*/
public static Ruleset unmarshal(java.io.InputStream in, String saxParserClass,
boolean validation,
org.xml.sax.EntityResolver entityResolver,
org.xml.sax.DTDHandler dtdHandler,
org.xml.sax.ErrorHandler errorHandler)
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(in, saxParserClass,
validation, entityResolver,
dtdHandler, errorHandler);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from an input stream.
* @param in The InputStream object to read the instance document.
* @param domParserClass fully qualified class name to identify a DOM parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.DOMParser#xerces</code>
* is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
*/
public static Ruleset unmarshal(java.io.InputStream in, String domParserClass,
boolean validation)
throws com.borland.xml.toolkit.DOMAdapterNotFoundException
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(in, domParserClass,
validation);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from an input stream.
* @param in The InputStream object to read the instance document.
*/
public static Ruleset unmarshal(java.io.InputStream in)
{
return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(in));
}

/**
* Unmarshals an instance document back to a Ruleset object from a file.
* @param file A File object, which contains the instance document.
* @param saxParserClass fully qualified class name to identify a SAX parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.SAXParser</code> is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
* @param entityResolver EntityResolver object to provide customized handling for
* external entities.
* @param dtdHandler DtdHandler object to receive notification of notation
* declaration and unparsed entity declaration events.
* @param errorHandler ErrorHandler object to provide customized error handling.
*/
public static Ruleset unmarshal(java.io.File file, String saxParserClass,
boolean validation,
org.xml.sax.EntityResolver entityResolver,
org.xml.sax.DTDHandler dtdHandler,
org.xml.sax.ErrorHandler errorHandler)
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(file, saxParserClass,
validation, entityResolver,
dtdHandler, errorHandler);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from a file.
* @param file A File object, which contains the instance document.
* @param domParserClass fully qualified class name to identify a DOM parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.DOMParser#xerces</code>
* is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
*/
public static Ruleset unmarshal(java.io.File file, String domParserClass,
boolean validation)
throws com.borland.xml.toolkit.DOMAdapterNotFoundException
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(file, domParserClass,
validation);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from a file.
* @param file A File object, which contains the instance document.
*/
public static Ruleset unmarshal(java.io.File file)
{
return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(file));
}

/**
* Unmarshals an instance document back to a Ruleset object from a file.
* @param fileName File name of XML document.
* @param saxParserClass fully qualified class name to identify a SAX parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.SAXParser</code> is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
* @param entityResolver EntityResolver object to provide customized handling for
* external entities.
* @param dtdHandler DtdHandler object to receive notification of notation
* declaration and unparsed entity declaration events.
* @param errorHandler ErrorHandler object to provide customized error handling.
*/
public static Ruleset unmarshal(String fileName, String saxParserClass,
boolean validation,
org.xml.sax.EntityResolver entityResolver,
org.xml.sax.DTDHandler dtdHandler,
org.xml.sax.ErrorHandler errorHandler)
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(fileName, saxParserClass,
validation, entityResolver,
dtdHandler, errorHandler);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from a file.
* @param fileName File name of XML document.
* @param domParserClass fully qualified class name to identify a DOM parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.DOMParser#xerces</code>
* is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
*/
public static Ruleset unmarshal(String fileName, String domParserClass,
boolean validation)
throws com.borland.xml.toolkit.DOMAdapterNotFoundException
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(fileName, domParserClass,
validation);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from a file.
* @param fileName File name of XML document.
*/
public static Ruleset unmarshal(String fileName)
{
return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(fileName));
}

/**
* Unmarshals an instance document back to a Ruleset object from a URL.
* @param url the URL of the instance document.
* @param saxParserClass fully qualified class name to identify a SAX parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.SAXParser</code> is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
* @param entityResolver EntityResolver object to provide customized handling for
* external entities.
* @param dtdHandler DtdHandler object to receive notification of notation
* declaration and unparsed entity declaration events.
* @param errorHandler ErrorHandler object to provide customized error handling.
*/
public static Ruleset unmarshal(java.net.URL url, String saxParserClass,
boolean validation,
org.xml.sax.EntityResolver entityResolver,
org.xml.sax.DTDHandler dtdHandler,
org.xml.sax.ErrorHandler errorHandler)
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(url, saxParserClass,
validation, entityResolver,
dtdHandler, errorHandler);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from a URL.
* @param url the URL of the instance document.
* @param domParserClass fully qualified class name to identify a DOM parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.DOMParser#xerces</code>
* is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
*/
public static Ruleset unmarshal(java.net.URL url, String domParserClass,
boolean validation)
throws com.borland.xml.toolkit.DOMAdapterNotFoundException
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(url, domParserClass,
validation);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from a URL.
* @param url the URL of the instance document.
*/
public static Ruleset unmarshal(java.net.URL url)
{
return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(url));
}

/**
* Unmarshals an instance document back to a Ruleset object from a reader.
* @param reader The Reader object to read the instance document.
* @param saxParserClass fully qualified class name to identify a SAX parser.
* If this parameter is null, the default parser
* <code>org.apache.xerces.parsers.SAXParser</code> is used.
* @param validation <code>true</code> to turn on the validation feature;
* <code>false</code> to turn it off.
* @param entityResolver EntityResolver object to provide customized handling for
* external entities.
* @param dtdHandler DtdHandler object to receive notification of notation
* declaration and unparsed entity declaration events.
* @param errorHandler ErrorHandler object to provide customized error handling.
*/
public static Ruleset unmarshal(java.io.Reader reader, String saxParserClass,
boolean validation,
org.xml.sax.EntityResolver entityResolver,
org.xml.sax.DTDHandler dtdHandler,
org.xml.sax.ErrorHandler errorHandler)
{
com.borland.xml.toolkit.Element elem;
elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(reader, saxParserClass,
validation, entityResolver,
dtdHandler, errorHandler);
return Ruleset.unmarshal(elem);
}

/**
* Unmarshals an instance document back to a Ruleset object from a reader.
* @param reader The Reader object to read the instance document.
*/
public static Ruleset unmarshal(java.io.Reader reader)
{
return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(reader));
}

/**
* Sets the outputter to control the format of XML output.
*/
public void _setOutputter(com.borland.xml.toolkit.Outputter outputter)
{
_outputter = outputter;
}

/**
* Gets the outputter, which controls the format of XML output.
*/
public com.borland.xml.toolkit.Outputter _getOutputter()
{
return _outputter;
}

/**
* Sets the indent string that is used to indent XML output. By default, the
* indent is set to four white spaces. If you pass a null or "" to this method,
* no indentation occurs.
*/
public void _setIndent(String indent)
{
if( _outputter == null )
_outputter = new com.borland.xml.toolkit.Outputter();

_outputter.setIndent(indent);
}

/**
* Sets the number of white spaces used to indent XML output. By default,
* the indent is set to four white spaces.
*/
public void _setIndentSize(int indentSize)
{
if( _outputter == null )
_outputter = new com.borland.xml.toolkit.Outputter();

_outputter.setIndentSize(indentSize);
}

/**
* Declares whether you want to separate elements with carriage return and
* line feed ("\r\n") in the XML output.
* @param newlines <code>true</code> to print newlines; <code>false</code> otherwise.
*/
public void _setNewlines(boolean newlines)
{
if( _outputter == null )
_outputter = new com.borland.xml.toolkit.Outputter();

_outputter.setNewlines(newlines);
}

/**
* Replaces the existing encoding in use for XML output with a new encoding.
*/
public void _setEncoding(String encoding)
{
if( _outputter == null )
_outputter = new com.borland.xml.toolkit.Outputter();

_outputter.setEncoding(encoding);
}

/**
* Declares whether you to want to print the "encoding" attribute in the
* XML declaration.
*/
public void _setPrintEncoding(boolean printEncoding)
{
if( _outputter == null )
_outputter = new com.borland.xml.toolkit.Outputter();

_outputter.setPrintEncoding(printEncoding);
}

/**
* Declares whether you to want to print the XML declaration.
*/
public void _setPrintXMLDeclaration(boolean printXMLDeclaration)
{
if( _outputter == null )
_outputter = new com.borland.xml.toolkit.Outputter();

_outputter.setPrintXMLDeclaration(printXMLDeclaration);
}

/**
* Gets public identifier.
*/
public String getPublicId()
{
return publicId;
}

/**
* Sets public identifier.
*/
public void setPublicId(String publicId)
{
this.publicId = publicId;
}

/**
* Gets system identifier.
*/
public String getSystemId()
{
return systemId;
}

/**
* Sets system identifier.
*/
public void setSystemId(String systemId)
{
this.systemId = systemId;
}

/**
* Marshals this object to an element.
*/
public com.borland.xml.toolkit.Element marshal()
{
com.borland.xml.toolkit.Element elem = new com.borland.xml.toolkit.Element(get_TagName());
/** Marshals a list of Rule objects to elements */
Iterator it1 = _objRule.iterator();
while( it1.hasNext() )
{
Rule obj = (Rule)it1.next();
if( obj != null )
{
elem.addComment(obj._marshalCommentList());
elem.addContent(obj.marshal());
}
}
/** Marshals a list of Prcondition objects to elements */
Iterator it2 = _objPrcondition.iterator();
while( it2.hasNext() )
{
Prcondition obj = (Prcondition)it2.next();
if( obj != null )
{
elem.addComment(obj._marshalCommentList());
elem.addContent(obj.marshal());
}
}

elem.addComment(this._marshalBottomCommentList());
return elem;
}

/**
* Unmarshals the specified "ruleset" element back to a Ruleset object.
*/
public static Ruleset unmarshal(com.borland.xml.toolkit.Element elem)
{
if( elem == null )
return null;

Ruleset __objRuleset = new Ruleset();

ArrayList __comments = null;
Iterator it = elem.getChildObjects().iterator();
while( it.hasNext() )
{
Object __obj = it.next();
if( __obj instanceof com.borland.xml.toolkit.Comment )
{
if( __comments == null )
__comments = new ArrayList(2);

__comments.add(__obj);
}
else if( __obj instanceof com.borland.xml.toolkit.Element )
{
com.borland.xml.toolkit.Element __e = (com.borland.xml.toolkit.Element)__obj;
String __name = __e.getName();
if( __name.equals(Rule._tagName) )
{
/** Unmarshals the child element back to a Rule object */
Rule __objRule = Rule.unmarshal(__e);
__objRuleset.addRule(__objRule);
__objRule._unmarshalCommentList(__comments);
}
if( __name.equals(Prcondition._tagName) )
{
/** Unmarshals the child element back to a Prcondition object */
Prcondition __objPrcondition = Prcondition.unmarshal(__e);
__objRuleset.addPrcondition(__objPrcondition);
__objPrcondition._unmarshalCommentList(__comments);
}

__comments = null;
}
}
__objRuleset._unmarshalBottomCommentList(__comments);
return __objRuleset;
}

/**
* Validates this object. If you pass <code>true</code> to this method, it
* checks for the first error and stops. On the other hand, if you pass
* <code>false</code> to this method, it collects all the errors by
* visiting every available elements.
* @param firstError <code>true</code> to exit this method when the first error
* is found; <code>false</code> to collect all errors.
* @return com.borland.xml.toolkit.ErrorList A list that contains one or more errors.
* @see com.borland.xml.toolkit.XmlObject#validate()
* @see com.borland.xml.toolkit.XmlObject#isValid()
* @see com.borland.xml.toolkit.ErrorList
*/
public com.borland.xml.toolkit.ErrorList validate(boolean firstError)
{
com.borland.xml.toolkit.ErrorList errors = new com.borland.xml.toolkit.ErrorList();

/** Rule is zero or more */
Iterator it1 = _objRule.iterator();
while( it1.hasNext() )
{
Rule obj = (Rule)it1.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}
/** Prcondition is zero or more */
Iterator it2 = _objPrcondition.iterator();
while( it2.hasNext() )
{
Prcondition obj = (Prcondition)it2.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}

return errors.size()==0 ? null : errors;
}

/**
* Returns a list containing all child elements. Each element in the list is a subclass
* of XmlObject.
*/
public java.util.List _getChildren()
{
java.util.List children = new java.util.ArrayList();
/** adds _objRule */
if( _objRule != null && _objRule.size() > 0 )
children.add(_objRule);
/** adds _objPrcondition */
if( _objPrcondition != null && _objPrcondition.size() > 0 )
children.add(_objPrcondition);
return children;
}


/**
* Gets the element-type name.
*/
public String get_TagName()
{
return _tagName;
}
}更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 请教面向对象的设计问题:
    有这样一个xml文件:
    <ruleset>
    <precondition></precondition>
    <rule>
    <precondition></precondition>
    <condition></condition>
    </rule>
    </ruleset>

    对应几个对象:ruleset , rule, condition, 其中rule 是ruleset 的一个属性,condition 是rule/ruleset的一个属性。expression对象 为condition的属性。(在expression中,包括rule属性)

    现在我要利用这几个对象把xml文件中的值取出来。目前,可以在rule里面取得precondition,如何才能取出ruleset中的precondition。
    • rule 是ruleset的child element吧?ruleset是最上面的level?, 用XMLDoc.getElementsByTagName之类的。
      • rule不是ruleset的child,而是一个property。而且condition是有结构的
        <condition comparator = "">
        < expression> left </ expression>
        < expression> right</ expression>
        </condition>

        现在,rules对象已经可以取出condition(数组), 我就是想,是否可以简单的利用overload , ruleset用同样的办法取出condition呢。 不过很笨。
        • 因为一开始没有考虑到ruleset里面的precondition(其实也是Condition),所以开始的办法就没有这一部分。现在不知道是overload好,还是
          设一个temp为rule 类型,利用他取出precondition然后负值给ruleset的precondition好。这样好像和sequence图相去甚远。
        • 说实话,不太明白你的问题。难道ruleset里面不是多个rule吗?你可以用一个function取出rule的attributes,当然也可以用在ruleset上啊。
          • 我也觉得很绕口,取出来的ruleset应该是这样一个结构:
            ruleset
            {
            precondition(arraylist)
            rule(arraylist)
            {
            precondition(arraylist)
            condition(arraylist)
            }
            }


            precondition of ruleset has nothing to do with precondition of rules, precondition and condition are objects of condition (class)

            rule has property of precondition, method:addprecondtion(rule, precondition)
            condition has property of rule, method: create precondition(rule, xmlnode)

            then what should i do. overload create precondition, and add addprecondition method in ruleset?
            • 给个例子好不好,你到底在说什么?到底要干什么?
            • 我明白你得意思了,收信。
    • 这个和面向对象有什么关系?
    • 这么难的工作还是不作了吧!
      • D, 还是给点Positive的建议好.
    • 你是不是在讨论serilization/deseriliztion的问题? 不过无论如何, 实在不知道你的问题是什么?
    • Too easy
      The question is too simple. Find an IDE(such as JBuilder, WSAP) or directly use JAXP, they provide the tools to directly translate the XML schema to Java bean, then use these beans directly. If you use MS stuff, there are also tons of tools. The latest version xml spy has the same functions. :_^
      • This is your schema:
        <?xml version="1.0" encoding="UTF-8"?>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
        <xs:element name="ruleset">
        <xs:annotation>
        <xs:documentation>Comment describing your root element</xs:documentation>
        </xs:annotation>
        <xs:complexType>
        <xs:sequence>
        <xs:element name="rule" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
        <xs:sequence>
        <xs:element ref="prcondition" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="condition" maxOccurs="unbounded"/>
        </xs:sequence>
        </xs:complexType>
        </xs:element>
        <xs:element ref="prcondition" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        </xs:complexType>
        </xs:element>
        <xs:element name="prcondition"/>
        </xs:schema>
        • This is the ruleset bean. Use this bean you can marshal and unmarshal XML file. Use getPrcondition to get all precondition or one index precondition. Use setPrecondition to set precondition.
          本文发表在 rolia.net 枫下论坛/**
          * This file is generated by BorlandXML.
          */

          package tmp;

          import java.util.*;

          /**
          * The Ruleset class represents the element "ruleset" with the content
          * model defined as follows:
          * <p>
          * &lt;!ELEMENT ruleset (rule*,prcondition*)&gt;<br>
          */
          public class Ruleset extends com.borland.xml.toolkit.XmlObject
          {
          /** element-type name of this element. */
          public static String _tagName = "ruleset";
          /** Defines a list of Rule objects. */
          protected ArrayList _objRule = new ArrayList();
          /** Defines a list of Prcondition objects. */
          protected ArrayList _objPrcondition = new ArrayList();
          /** Public identifier. */
          protected String publicId = "";
          /** System identifier. */
          protected String systemId = "";
          /** Outputter object to control the format of XML output. */
          protected com.borland.xml.toolkit.Outputter _outputter = null;

          /**
          * Creates an empty Ruleset object
          */
          public Ruleset()
          {
          super();
          }

          /**
          * Returns an array of Rule objects. The length of the returned
          * array is zero if the list of Rule object is empty.
          */
          public Rule[] getRule()
          {
          return (Rule[])_objRule.toArray(new Rule[0]);
          }

          /**
          * Replaces all existing Rule objects with a new array of
          * Rule objects.
          * @param objArray an array of Rule objects.
          */
          public void setRule(Rule[] objArray)
          {
          if( objArray == null || objArray.length == 0 )
          this._objRule.clear();
          else
          {
          this._objRule = new ArrayList(Arrays.asList(objArray));
          for( int i=0; i<objArray.length; i++ )
          {
          if( objArray[i] != null )
          objArray[i]._setParent(this);
          }
          }
          }

          /**
          * Gets the Rule object at the specified index.
          * @param index index of the returned object.
          * @throws IndexOutOfBoundsException if index is out of range.
          */
          public Rule getRule(int index)
          {
          return (Rule)_objRule.get(index);
          }

          /**
          * Replaces an existing Rule object at the specified index with
          * a new Rule object.
          * @param index index of replaced object.
          * @throws IndexOutOfBoundsException if index is out of range.
          */
          public void setRule(int index, Rule obj)
          {
          if( obj == null )
          removeRule(index);
          else
          {
          _objRule.set(index, obj);
          obj._setParent(this);
          }
          }

          /**
          * Returns the number of Rule objects in the list.
          */
          public int getRuleCount()
          {
          return _objRule.size();
          }

          /**
          * Returns <code>true</code> if there is no Rule object in the list; otherwise,
          * the method returns <code>false</code>.
          */
          public boolean isNoRule()
          {
          return _objRule.size() == 0;
          }

          /**
          * Returns a read-only list of Rule objects.
          */
          public List getRuleList()
          {
          return Collections.unmodifiableList(_objRule);
          }

          /**
          * Adds a new Rule object at the end of the list.
          * @return <code>true</code> if the new object is added to the list; otherwise,
          * the method returns <code>false</code>.
          */
          public boolean addRule(Rule obj)
          {
          if( obj==null )
          return false;

          obj._setParent(this);
          return _objRule.add(obj);
          }

          /**
          * Adds a list of new Rule objects at the end of the list.
          * @return <code>true</code> if the list was changed; otherwise, the method
          * returns <code>false</code>.
          */
          public boolean addRule(Collection coRule)
          {
          if( coRule==null )
          return false;

          java.util.Iterator it = coRule.iterator();
          while( it.hasNext() )
          {
          Object obj = it.next();
          if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
          ((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
          }
          return _objRule.addAll(coRule);
          }

          /**
          * Removes an existing Rule object at the specified index.
          * @return The removed object.
          */
          public Rule removeRule(int index)
          {
          return (Rule)_objRule.remove(index);
          }

          /**
          * Removes the specified Rule object.
          * @return <code>true</code> if this list contains the object; otherwise,
          * the method returns <code>false</code>.
          */
          public boolean removeRule(Rule obj)
          {
          return _objRule.remove(obj);
          }

          /**
          * Clears all Rule objects from the list.
          */
          public void clearRuleList()
          {
          _objRule.clear();
          }
          /**
          * Returns an array of Prcondition objects. The length of the returned
          * array is zero if the list of Prcondition object is empty.
          */
          public Prcondition[] getPrcondition()
          {
          return (Prcondition[])_objPrcondition.toArray(new Prcondition[0]);
          }

          /**
          * Replaces all existing Prcondition objects with a new array of
          * Prcondition objects.
          * @param objArray an array of Prcondition objects.
          */
          public void setPrcondition(Prcondition[] objArray)
          {
          if( objArray == null || objArray.length == 0 )
          this._objPrcondition.clear();
          else
          {
          this._objPrcondition = new ArrayList(Arrays.asList(objArray));
          for( int i=0; i<objArray.length; i++ )
          {
          if( objArray[i] != null )
          objArray[i]._setParent(this);
          }
          }
          }

          /**
          * Gets the Prcondition object at the specified index.
          * @param index index of the returned object.
          * @throws IndexOutOfBoundsException if index is out of range.
          */
          public Prcondition getPrcondition(int index)
          {
          return (Prcondition)_objPrcondition.get(index);
          }

          /**
          * Replaces an existing Prcondition object at the specified index with
          * a new Prcondition object.
          * @param index index of replaced object.
          * @throws IndexOutOfBoundsException if index is out of range.
          */
          public void setPrcondition(int index, Prcondition obj)
          {
          if( obj == null )
          removePrcondition(index);
          else
          {
          _objPrcondition.set(index, obj);
          obj._setParent(this);
          }
          }

          /**
          * Returns the number of Prcondition objects in the list.
          */
          public int getPrconditionCount()
          {
          return _objPrcondition.size();
          }

          /**
          * Returns <code>true</code> if there is no Prcondition object in the list; otherwise,
          * the method returns <code>false</code>.
          */
          public boolean isNoPrcondition()
          {
          return _objPrcondition.size() == 0;
          }

          /**
          * Returns a read-only list of Prcondition objects.
          */
          public List getPrconditionList()
          {
          return Collections.unmodifiableList(_objPrcondition);
          }

          /**
          * Adds a new Prcondition object at the end of the list.
          * @return <code>true</code> if the new object is added to the list; otherwise,
          * the method returns <code>false</code>.
          */
          public boolean addPrcondition(Prcondition obj)
          {
          if( obj==null )
          return false;

          obj._setParent(this);
          return _objPrcondition.add(obj);
          }

          /**
          * Adds a list of new Prcondition objects at the end of the list.
          * @return <code>true</code> if the list was changed; otherwise, the method
          * returns <code>false</code>.
          */
          public boolean addPrcondition(Collection coPrcondition)
          {
          if( coPrcondition==null )
          return false;

          java.util.Iterator it = coPrcondition.iterator();
          while( it.hasNext() )
          {
          Object obj = it.next();
          if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
          ((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
          }
          return _objPrcondition.addAll(coPrcondition);
          }

          /**
          * Removes an existing Prcondition object at the specified index.
          * @return The removed object.
          */
          public Prcondition removePrcondition(int index)
          {
          return (Prcondition)_objPrcondition.remove(index);
          }

          /**
          * Removes the specified Prcondition object.
          * @return <code>true</code> if this list contains the object; otherwise,
          * the method returns <code>false</code>.
          */
          public boolean removePrcondition(Prcondition obj)
          {
          return _objPrcondition.remove(obj);
          }

          /**
          * Clears all Prcondition objects from the list.
          */
          public void clearPrconditionList()
          {
          _objPrcondition.clear();
          }
          /**
          * Marshals this object to an instance document and outputs it to the specified output stream.
          * @param out OutputStream object to receive the instance document.
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.OutputStream out)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(), _outputter );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified output stream.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the default encoding specified in XmlUtil class </li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param out OutputStream object to receive the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
          * @see com.borland.xml.toolkit.XmlUtil
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.OutputStream out, String indent)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent) );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified output stream.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param out OutputStream object to receive the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param encoding an encoding format, such as UTF-8.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.OutputStream out, String indent, String encoding)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, encoding) );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified output stream.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>newlines</code> is <code>true</code>, elements
          * are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration if
          * <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
          * <li>printing the XML declaration if <code>printDeclaration</code> is
          * <code>true</code>; no printing, otherwise.</li><br>
          * @param out OutputStream object to receive the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param newlines boolean value to specify whether you want to separate
          * elements with carriage return and line feed ("\r\n").
          * @param encoding an encoding format, such as UTF-8.
          * @param printEncoding <code>true</code> to print the "encoding" attribute;
          * <code>false</code>, otherwise.
          * @param printDeclaration <code>true</code> to print the XML declaration;
          * <code>false</code>, otherwise.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
          * boolean printEncoding, boolean printDeclaration)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.OutputStream out, String indent, boolean newlines,
          String encoding, boolean printEncoding, boolean printDeclaration)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
          printEncoding,
          printDeclaration) );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified output stream.
          * The format of XML output is controlled by the specified outputter.
          * @param out OutputStream object to receive the instance document.
          * @param outputter Outputter object to control the format of XML output.
          * @see com.borland.xml.toolkit.Outputter
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.OutputStream out, com.borland.xml.toolkit.Outputter outputter)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( out, elem, getPublicId(), getSystemId(),
          outputter );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * @param fileName file to store the instance document.
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(String fileName)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(),
          getSystemId(), _outputter );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the default encoding specified in XmlUtil class </li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param fileName file to store the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
          * @see com.borland.xml.toolkit.XmlUtil
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(String fileName, String indent)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent) );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param fileName file to store the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param encoding an encoding format, such as UTF-8.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(String fileName, String indent, String encoding)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, encoding) );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>newlines</code> is <code>true</code>, elements
          * are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration if
          * <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
          * <li>printing the XML declaration if <code>printDeclaration</code> is
          * <code>true</code>; no printing, otherwise.</li><br>
          * @param fileName file to store the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param newlines boolean value to specify whether you want to separate
          * elements with carriage return and line feed ("\r\n").
          * @param encoding an encoding format, such as UTF-8.
          * @param printEncoding <code>true</code> to print the "encoding" attribute;
          * <code>false</code>, otherwise.
          * @param printDeclaration <code>true</code> to print the XML declaration;
          * <code>false</code>, otherwise.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
          * boolean printEncoding, boolean printDeclaration)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(String fileName, String indent, boolean newlines,
          String encoding, boolean printEncoding, boolean printDeclaration)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
          printEncoding,
          printDeclaration) );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The format of XML output is controlled by the specified outputter.
          * @param fileName file to store the instance document.
          * @param outputter Outputter object to control the format of XML output.
          * @see com.borland.xml.toolkit.Outputter
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(String fileName, com.borland.xml.toolkit.Outputter outputter)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( fileName, elem, getPublicId(),
          getSystemId(), outputter );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * @param file File to store the instance document.
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.File file)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(),
          getSystemId(), _outputter );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the default encoding specified in XmlUtil class </li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param file File to store the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
          * @see com.borland.xml.toolkit.XmlUtil
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.File file, String indent)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent) );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param file File to store the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param encoding an encoding format, such as UTF-8.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.File file, String indent, String encoding)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, encoding) );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>newlines</code> is <code>true</code>, elements
          * are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration if
          * <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
          * <li>printing the XML declaration if <code>printDeclaration</code> is
          * <code>true</code>; no printing, otherwise.</li><br>
          * @param file File to store the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param newlines boolean value to specify whether you want to separate
          * elements with carriage return and line feed ("\r\n").
          * @param encoding an encoding format, such as UTF-8.
          * @param printEncoding <code>true</code> to print the "encoding" attribute;
          * <code>false</code>, otherwise.
          * @param printDeclaration <code>true</code> to print the XML declaration;
          * <code>false</code>, otherwise.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
          * boolean printEncoding, boolean printDeclaration)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.File file, String indent, boolean newlines,
          String encoding, boolean printEncoding, boolean printDeclaration)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
          printEncoding,
          printDeclaration) );
          }

          /**
          * Marshals this object to an instance document and stores it in the specified file.
          * The format of XML output is controlled by the specified outputter.
          * @param file File to store the instance document.
          * @param outputter Outputter object to control the format of XML output.
          * @see com.borland.xml.toolkit.Outputter
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.File file, com.borland.xml.toolkit.Outputter outputter)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( file, elem, getPublicId(), getSystemId(),
          outputter );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified writer.
          * @param writer Writer object to receive the instance document.
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.Writer writer)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(),
          getSystemId(), _outputter );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified writer.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the default encoding specified in XmlUtil class </li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param writer Writer object to receive the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent)
          * @see com.borland.xml.toolkit.XmlUtil
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.Writer writer, String indent)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent) );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified writer.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>indent</code> is not <code>null</code>, elements
          * are separated by newlines ("\r\n"). If <code>indent</code> is <code>null</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration</li><br>
          * <li>printing the XML declaration</li><br>
          * @param writer Writer object to receive the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param encoding an encoding format, such as UTF-8.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, String encoding)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.Writer writer, String indent, String encoding)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, encoding) );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified writer.
          * The XML output has the following attributes:<br>
          * <li>using the specified indent</li><br>
          * <li>If the parameter <code>newlines</code> is <code>true</code>, elements
          * are separated by newlines ("\r\n"). If <code>newlines</code> is <code>false</code>,
          * no newline is generated between elements.</li><br>
          * <li>using the specified encoding</li><br>
          * <li>printing the "encoding" attribute in the XML declaration if
          * <code>printEncoding</code> is <code>true</code>; no printing, otherwise.</li><br>
          * <li>printing the XML declaration if <code>printDeclaration</code> is
          * <code>true</code>; no printing, otherwise.</li><br>
          * @param writer Writer object to receive the instance document.
          * @param indent the string (usually white spaces) used to indent elements.
          * @param newlines boolean value to specify whether you want to separate
          * elements with carriage return and line feed ("\r\n").
          * @param encoding an encoding format, such as UTF-8.
          * @param printEncoding <code>true</code> to print the "encoding" attribute;
          * <code>false</code>, otherwise.
          * @param printDeclaration <code>true</code> to print the XML declaration;
          * <code>false</code>, otherwise.
          * @see com.borland.xml.toolkit.Outputter#Outputter(String indent, boolean newlines, String encoding,
          * boolean printEncoding, boolean printDeclaration)
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.Writer writer, String indent, boolean newlines,
          String encoding, boolean printEncoding, boolean printDeclaration)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
          new com.borland.xml.toolkit.Outputter(indent, newlines, encoding,
          printEncoding,
          printDeclaration) );
          }

          /**
          * Marshals this object to an instance document and outputs it to the specified writer.
          * The format of XML output is controlled by the specified outputter.
          * @param writer Writer object to receive the instance document.
          * @param outputter Outputter object to control the format of XML output.
          * @see com.borland.xml.toolkit.Outputter
          * @throws java.io.IOException An IO error occurs when writing out the instance document.
          */
          public void marshal(java.io.Writer writer, com.borland.xml.toolkit.Outputter outputter)
          throws java.io.IOException
          {
          com.borland.xml.toolkit.Element elem = marshal();
          com.borland.xml.toolkit.XmlUtil.writeDocument( writer, elem, getPublicId(), getSystemId(),
          outputter );
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from an input stream.
          * @param in The InputStream object to read the instance document.
          * @param saxParserClass fully qualified class name to identify a SAX parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.SAXParser</code> is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          * @param entityResolver EntityResolver object to provide customized handling for
          * external entities.
          * @param dtdHandler DtdHandler object to receive notification of notation
          * declaration and unparsed entity declaration events.
          * @param errorHandler ErrorHandler object to provide customized error handling.
          */
          public static Ruleset unmarshal(java.io.InputStream in, String saxParserClass,
          boolean validation,
          org.xml.sax.EntityResolver entityResolver,
          org.xml.sax.DTDHandler dtdHandler,
          org.xml.sax.ErrorHandler errorHandler)
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(in, saxParserClass,
          validation, entityResolver,
          dtdHandler, errorHandler);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from an input stream.
          * @param in The InputStream object to read the instance document.
          * @param domParserClass fully qualified class name to identify a DOM parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.DOMParser#xerces</code>
          * is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          */
          public static Ruleset unmarshal(java.io.InputStream in, String domParserClass,
          boolean validation)
          throws com.borland.xml.toolkit.DOMAdapterNotFoundException
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(in, domParserClass,
          validation);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from an input stream.
          * @param in The InputStream object to read the instance document.
          */
          public static Ruleset unmarshal(java.io.InputStream in)
          {
          return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(in));
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a file.
          * @param file A File object, which contains the instance document.
          * @param saxParserClass fully qualified class name to identify a SAX parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.SAXParser</code> is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          * @param entityResolver EntityResolver object to provide customized handling for
          * external entities.
          * @param dtdHandler DtdHandler object to receive notification of notation
          * declaration and unparsed entity declaration events.
          * @param errorHandler ErrorHandler object to provide customized error handling.
          */
          public static Ruleset unmarshal(java.io.File file, String saxParserClass,
          boolean validation,
          org.xml.sax.EntityResolver entityResolver,
          org.xml.sax.DTDHandler dtdHandler,
          org.xml.sax.ErrorHandler errorHandler)
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(file, saxParserClass,
          validation, entityResolver,
          dtdHandler, errorHandler);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a file.
          * @param file A File object, which contains the instance document.
          * @param domParserClass fully qualified class name to identify a DOM parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.DOMParser#xerces</code>
          * is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          */
          public static Ruleset unmarshal(java.io.File file, String domParserClass,
          boolean validation)
          throws com.borland.xml.toolkit.DOMAdapterNotFoundException
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(file, domParserClass,
          validation);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a file.
          * @param file A File object, which contains the instance document.
          */
          public static Ruleset unmarshal(java.io.File file)
          {
          return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(file));
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a file.
          * @param fileName File name of XML document.
          * @param saxParserClass fully qualified class name to identify a SAX parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.SAXParser</code> is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          * @param entityResolver EntityResolver object to provide customized handling for
          * external entities.
          * @param dtdHandler DtdHandler object to receive notification of notation
          * declaration and unparsed entity declaration events.
          * @param errorHandler ErrorHandler object to provide customized error handling.
          */
          public static Ruleset unmarshal(String fileName, String saxParserClass,
          boolean validation,
          org.xml.sax.EntityResolver entityResolver,
          org.xml.sax.DTDHandler dtdHandler,
          org.xml.sax.ErrorHandler errorHandler)
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(fileName, saxParserClass,
          validation, entityResolver,
          dtdHandler, errorHandler);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a file.
          * @param fileName File name of XML document.
          * @param domParserClass fully qualified class name to identify a DOM parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.DOMParser#xerces</code>
          * is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          */
          public static Ruleset unmarshal(String fileName, String domParserClass,
          boolean validation)
          throws com.borland.xml.toolkit.DOMAdapterNotFoundException
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(fileName, domParserClass,
          validation);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a file.
          * @param fileName File name of XML document.
          */
          public static Ruleset unmarshal(String fileName)
          {
          return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(fileName));
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a URL.
          * @param url the URL of the instance document.
          * @param saxParserClass fully qualified class name to identify a SAX parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.SAXParser</code> is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          * @param entityResolver EntityResolver object to provide customized handling for
          * external entities.
          * @param dtdHandler DtdHandler object to receive notification of notation
          * declaration and unparsed entity declaration events.
          * @param errorHandler ErrorHandler object to provide customized error handling.
          */
          public static Ruleset unmarshal(java.net.URL url, String saxParserClass,
          boolean validation,
          org.xml.sax.EntityResolver entityResolver,
          org.xml.sax.DTDHandler dtdHandler,
          org.xml.sax.ErrorHandler errorHandler)
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(url, saxParserClass,
          validation, entityResolver,
          dtdHandler, errorHandler);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a URL.
          * @param url the URL of the instance document.
          * @param domParserClass fully qualified class name to identify a DOM parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.DOMParser#xerces</code>
          * is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          */
          public static Ruleset unmarshal(java.net.URL url, String domParserClass,
          boolean validation)
          throws com.borland.xml.toolkit.DOMAdapterNotFoundException
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(url, domParserClass,
          validation);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a URL.
          * @param url the URL of the instance document.
          */
          public static Ruleset unmarshal(java.net.URL url)
          {
          return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(url));
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a reader.
          * @param reader The Reader object to read the instance document.
          * @param saxParserClass fully qualified class name to identify a SAX parser.
          * If this parameter is null, the default parser
          * <code>org.apache.xerces.parsers.SAXParser</code> is used.
          * @param validation <code>true</code> to turn on the validation feature;
          * <code>false</code> to turn it off.
          * @param entityResolver EntityResolver object to provide customized handling for
          * external entities.
          * @param dtdHandler DtdHandler object to receive notification of notation
          * declaration and unparsed entity declaration events.
          * @param errorHandler ErrorHandler object to provide customized error handling.
          */
          public static Ruleset unmarshal(java.io.Reader reader, String saxParserClass,
          boolean validation,
          org.xml.sax.EntityResolver entityResolver,
          org.xml.sax.DTDHandler dtdHandler,
          org.xml.sax.ErrorHandler errorHandler)
          {
          com.borland.xml.toolkit.Element elem;
          elem = com.borland.xml.toolkit.XmlUtil.getDocRootElement(reader, saxParserClass,
          validation, entityResolver,
          dtdHandler, errorHandler);
          return Ruleset.unmarshal(elem);
          }

          /**
          * Unmarshals an instance document back to a Ruleset object from a reader.
          * @param reader The Reader object to read the instance document.
          */
          public static Ruleset unmarshal(java.io.Reader reader)
          {
          return Ruleset.unmarshal(com.borland.xml.toolkit.XmlUtil.getDocRootElement(reader));
          }

          /**
          * Sets the outputter to control the format of XML output.
          */
          public void _setOutputter(com.borland.xml.toolkit.Outputter outputter)
          {
          _outputter = outputter;
          }

          /**
          * Gets the outputter, which controls the format of XML output.
          */
          public com.borland.xml.toolkit.Outputter _getOutputter()
          {
          return _outputter;
          }

          /**
          * Sets the indent string that is used to indent XML output. By default, the
          * indent is set to four white spaces. If you pass a null or "" to this method,
          * no indentation occurs.
          */
          public void _setIndent(String indent)
          {
          if( _outputter == null )
          _outputter = new com.borland.xml.toolkit.Outputter();

          _outputter.setIndent(indent);
          }

          /**
          * Sets the number of white spaces used to indent XML output. By default,
          * the indent is set to four white spaces.
          */
          public void _setIndentSize(int indentSize)
          {
          if( _outputter == null )
          _outputter = new com.borland.xml.toolkit.Outputter();

          _outputter.setIndentSize(indentSize);
          }

          /**
          * Declares whether you want to separate elements with carriage return and
          * line feed ("\r\n") in the XML output.
          * @param newlines <code>true</code> to print newlines; <code>false</code> otherwise.
          */
          public void _setNewlines(boolean newlines)
          {
          if( _outputter == null )
          _outputter = new com.borland.xml.toolkit.Outputter();

          _outputter.setNewlines(newlines);
          }

          /**
          * Replaces the existing encoding in use for XML output with a new encoding.
          */
          public void _setEncoding(String encoding)
          {
          if( _outputter == null )
          _outputter = new com.borland.xml.toolkit.Outputter();

          _outputter.setEncoding(encoding);
          }

          /**
          * Declares whether you to want to print the "encoding" attribute in the
          * XML declaration.
          */
          public void _setPrintEncoding(boolean printEncoding)
          {
          if( _outputter == null )
          _outputter = new com.borland.xml.toolkit.Outputter();

          _outputter.setPrintEncoding(printEncoding);
          }

          /**
          * Declares whether you to want to print the XML declaration.
          */
          public void _setPrintXMLDeclaration(boolean printXMLDeclaration)
          {
          if( _outputter == null )
          _outputter = new com.borland.xml.toolkit.Outputter();

          _outputter.setPrintXMLDeclaration(printXMLDeclaration);
          }

          /**
          * Gets public identifier.
          */
          public String getPublicId()
          {
          return publicId;
          }

          /**
          * Sets public identifier.
          */
          public void setPublicId(String publicId)
          {
          this.publicId = publicId;
          }

          /**
          * Gets system identifier.
          */
          public String getSystemId()
          {
          return systemId;
          }

          /**
          * Sets system identifier.
          */
          public void setSystemId(String systemId)
          {
          this.systemId = systemId;
          }

          /**
          * Marshals this object to an element.
          */
          public com.borland.xml.toolkit.Element marshal()
          {
          com.borland.xml.toolkit.Element elem = new com.borland.xml.toolkit.Element(get_TagName());
          /** Marshals a list of Rule objects to elements */
          Iterator it1 = _objRule.iterator();
          while( it1.hasNext() )
          {
          Rule obj = (Rule)it1.next();
          if( obj != null )
          {
          elem.addComment(obj._marshalCommentList());
          elem.addContent(obj.marshal());
          }
          }
          /** Marshals a list of Prcondition objects to elements */
          Iterator it2 = _objPrcondition.iterator();
          while( it2.hasNext() )
          {
          Prcondition obj = (Prcondition)it2.next();
          if( obj != null )
          {
          elem.addComment(obj._marshalCommentList());
          elem.addContent(obj.marshal());
          }
          }

          elem.addComment(this._marshalBottomCommentList());
          return elem;
          }

          /**
          * Unmarshals the specified "ruleset" element back to a Ruleset object.
          */
          public static Ruleset unmarshal(com.borland.xml.toolkit.Element elem)
          {
          if( elem == null )
          return null;

          Ruleset __objRuleset = new Ruleset();

          ArrayList __comments = null;
          Iterator it = elem.getChildObjects().iterator();
          while( it.hasNext() )
          {
          Object __obj = it.next();
          if( __obj instanceof com.borland.xml.toolkit.Comment )
          {
          if( __comments == null )
          __comments = new ArrayList(2);

          __comments.add(__obj);
          }
          else if( __obj instanceof com.borland.xml.toolkit.Element )
          {
          com.borland.xml.toolkit.Element __e = (com.borland.xml.toolkit.Element)__obj;
          String __name = __e.getName();
          if( __name.equals(Rule._tagName) )
          {
          /** Unmarshals the child element back to a Rule object */
          Rule __objRule = Rule.unmarshal(__e);
          __objRuleset.addRule(__objRule);
          __objRule._unmarshalCommentList(__comments);
          }
          if( __name.equals(Prcondition._tagName) )
          {
          /** Unmarshals the child element back to a Prcondition object */
          Prcondition __objPrcondition = Prcondition.unmarshal(__e);
          __objRuleset.addPrcondition(__objPrcondition);
          __objPrcondition._unmarshalCommentList(__comments);
          }

          __comments = null;
          }
          }
          __objRuleset._unmarshalBottomCommentList(__comments);
          return __objRuleset;
          }

          /**
          * Validates this object. If you pass <code>true</code> to this method, it
          * checks for the first error and stops. On the other hand, if you pass
          * <code>false</code> to this method, it collects all the errors by
          * visiting every available elements.
          * @param firstError <code>true</code> to exit this method when the first error
          * is found; <code>false</code> to collect all errors.
          * @return com.borland.xml.toolkit.ErrorList A list that contains one or more errors.
          * @see com.borland.xml.toolkit.XmlObject#validate()
          * @see com.borland.xml.toolkit.XmlObject#isValid()
          * @see com.borland.xml.toolkit.ErrorList
          */
          public com.borland.xml.toolkit.ErrorList validate(boolean firstError)
          {
          com.borland.xml.toolkit.ErrorList errors = new com.borland.xml.toolkit.ErrorList();

          /** Rule is zero or more */
          Iterator it1 = _objRule.iterator();
          while( it1.hasNext() )
          {
          Rule obj = (Rule)it1.next();
          if( obj != null )
          {
          errors.add(obj.validate(firstError));
          if( firstError && errors.size() > 0 )
          return errors;
          }
          }
          /** Prcondition is zero or more */
          Iterator it2 = _objPrcondition.iterator();
          while( it2.hasNext() )
          {
          Prcondition obj = (Prcondition)it2.next();
          if( obj != null )
          {
          errors.add(obj.validate(firstError));
          if( firstError && errors.size() > 0 )
          return errors;
          }
          }

          return errors.size()==0 ? null : errors;
          }

          /**
          * Returns a list containing all child elements. Each element in the list is a subclass
          * of XmlObject.
          */
          public java.util.List _getChildren()
          {
          java.util.List children = new java.util.ArrayList();
          /** adds _objRule */
          if( _objRule != null && _objRule.size() > 0 )
          children.add(_objRule);
          /** adds _objPrcondition */
          if( _objPrcondition != null && _objPrcondition.size() > 0 )
          children.add(_objPrcondition);
          return children;
          }


          /**
          * Gets the element-type name.
          */
          public String get_TagName()
          {
          return _tagName;
          }
          }更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • 都睡了么,睡了我就不问了。
      • 没有睡啊, 还刷网呢.........
        可惜我不懂软件, 没法帮你, 算替你UP一下了.
      • 不行了,我真的下了,明天上班我给你回信。(还没收到),反正我比你早两个小时。一个小时?:)
        • 你只看一眼阿。:(我给你的信。我觉得方法还挺好的。