📄 simpleelementhandler.java
字号:
* @param value3 Value of third attribute. * @return Resulting attribute-value list. */ public static final Attributes createAttributes(String attribute1, String value1, String attribute2, String value2, String attribute3, String value3) { AttributesImpl atts = new AttributesImpl(); addSimpleAttribute(atts,attribute1,value1); addSimpleAttribute(atts,attribute2,value2); addSimpleAttribute(atts,attribute3,value3); return atts; } /** * Create an attributes list with the specified four attributes and values. * * @param attribute1 Name of first attribute. * @param value1 Value of first attribute. * @param attribute2 Name of second attribute. * @param value2 Value of second attribute. * @param attribute3 Name of third attribute. * @param value3 Value of third attribute. * @param attribute4 Name of fourth attribute. * @param value4 Value of fourth attribute. * @return Resulting attribute-value list. */ public static final Attributes createAttributes(String attribute1, String value1, String attribute2, String value2, String attribute3, String value3, String attribute4, String value4) { AttributesImpl atts = new AttributesImpl(); addSimpleAttribute(atts,attribute1,value1); addSimpleAttribute(atts,attribute2,value2); addSimpleAttribute(atts,attribute3,value3); addSimpleAttribute(atts,attribute4,value4); return atts; } /** * Create an attributes list with the specified five attributes * and values. * * @param attribute1 Name of first attribute. * @param value1 Value of first attribute. * @param attribute2 Name of second attribute. * @param value2 Value of second attribute. * @param attribute3 Name of third attribute. * @param value3 Value of third attribute. * @param attribute4 Name of fourth attribute. * @param value4 Value of fourth attribute. * @param attribute5 Name of fifth attribute. * @param value5 Value of fifth attribute. * @return Resulting attribute-value list. */ public static final Attributes createAttributes(String attribute1, String value1, String attribute2, String value2, String attribute3, String value3, String attribute4, String value4, String attribute5, String value5) { AttributesImpl atts = new AttributesImpl(); addSimpleAttribute(atts,attribute1,value1); addSimpleAttribute(atts,attribute2,value2); addSimpleAttribute(atts,attribute3,value3); addSimpleAttribute(atts,attribute4,value4); addSimpleAttribute(atts,attribute5,value5); return atts; } /** * Create an attributes list with the specified six attributes * and values. * * @param attribute1 Name of first attribute. * @param value1 Value of first attribute. * @param attribute2 Name of second attribute. * @param value2 Value of second attribute. * @param attribute3 Name of third attribute. * @param value3 Value of third attribute. * @param attribute4 Name of fourth attribute. * @param value4 Value of fourth attribute. * @param attribute5 Name of fifth attribute. * @param value5 Value of fifth attribute. * @param attribute6 Name of sixth attribute. * @param value6 Value of sixth attribute. * @return Resulting attribute-value list. */ public static final Attributes createAttributes(String attribute1, String value1, String attribute2, String value2, String attribute3, String value3, String attribute4, String value4, String attribute5, String value5, String attribute6, String value6) { AttributesImpl atts = new AttributesImpl(); addSimpleAttribute(atts,attribute1,value1); addSimpleAttribute(atts,attribute2,value2); addSimpleAttribute(atts,attribute3,value3); addSimpleAttribute(atts,attribute4,value4); addSimpleAttribute(atts,attribute5,value5); addSimpleAttribute(atts,attribute6,value6); return atts; } /** * Converts the string to a character array in order to * call {@link #characters(char[],int,int)} to handle the * characters. * * @param handler Handler for resulting event. * @param s String whose characters are to be handled. * * @throws SAXException if the handler throws a SAX exception. */ public static void characters(DefaultHandler handler, String s) throws SAXException { handler.characters(s.toCharArray(),0,s.length()); } /** * Handls the specified character array by delegation to * {@link #characters(char[],int,int)}. * * @param handler Handler for resulting event. * @param cs Character array to be handled. * * @throws SAXException if the handler throws a SAX exception. */ public static void characters(DefaultHandler handler, char[] cs) throws SAXException { handler.characters(cs,0,cs.length); } /** * Starts an element with a <code>null</code> namespace * and no attributes. * * @param handler Handler for resulting event. * @param name Name of element to start. * * @throws SAXException if the contained hanlder throws a SAX * exception. */ public static void startSimpleElement(DefaultHandler handler, String name) throws SAXException { startSimpleElement(handler,name,EMPTY_ATTS); } /** * Starts an element with a <code>null</code> namespace and a * single attribute and value. * * @param handler Handler for resulting event. * @param name Name of element to start. * @param att Name of single attribute. * @param value The attribute's value. * * @throws SAXException if the contained hanlder throws a SAX * exception. * * @see #startSimpleElement(String,Attributes) */ public static void startSimpleElement(DefaultHandler handler, String name, String att, String value) throws SAXException { startSimpleElement(handler,name,createAttributes(att,value)); } /** * Starts an element with a <code>null</code> namespace and the * specified local name, which is also provided as the qualified * name. * * @param handler Handler for resulting event. * @param localName Local name of element to start. * @param atts Attributes for this element. * * @throws SAXException if the contained hanlder throws a SAX * exception. */ public static void startSimpleElement(DefaultHandler handler, String localName, Attributes atts) throws SAXException { handler.startElement(null,localName,localName,atts); } /** * End an element for the specified handler with a * <code>null</code> namespace, using the local name for both * local and qualified names. * * @param handler Handler for resulting event. * @param localName Local name of element to end. * @throws SAXException if the contained hanlder throws a SAX * exception. */ public static void endSimpleElement(DefaultHandler handler, String localName) throws SAXException { handler.endElement(null,localName,localName); } /** * A default handler which performs no operation for any method * calls. */ public static final DefaultHandler NO_OP_DEFAULT_HANDLER = new DefaultHandler(); /** * The type of character data attributes. */ protected static final String CDATA_ATTS_TYPE = "CDATA";}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -