当前位置: 首页>>代码示例>>Java>>正文


Java AttributesImpl.addAttribute方法代码示例

本文整理汇总了Java中org.xml.sax.helpers.AttributesImpl.addAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java AttributesImpl.addAttribute方法的具体用法?Java AttributesImpl.addAttribute怎么用?Java AttributesImpl.addAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xml.sax.helpers.AttributesImpl的用法示例。


在下文中一共展示了AttributesImpl.addAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addInclude

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
private void addInclude(Node parent, List files) throws SAXException {
    if (files != null) {
        Iterator iter = files.iterator();
        while (iter.hasNext()) {
            String file = (String)iter.next();
            AttributesImpl attrs = new AttributesImpl();
            attrs.addAttribute("", "file", "file", "CDATA", file);

            // Create a dummy Include directive node
                Node includeDir =
                    new Node.IncludeDirective(attrs, null, // XXX
parent);
            processIncludeDirective(file, includeDir);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:JspDocumentParser.java

示例2: visitInnerClass

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
@Override
public final void visitInnerClass(final String name,
        final String outerName, final String innerName, final int access) {
    StringBuilder sb = new StringBuilder();
    appendAccess(access | ACCESS_INNER, sb);

    AttributesImpl att = new AttributesImpl();
    att.addAttribute("", "access", "access", "", sb.toString());
    if (name != null) {
        att.addAttribute("", "name", "name", "", name);
    }
    if (outerName != null) {
        att.addAttribute("", "outerName", "outerName", "", outerName);
    }
    if (innerName != null) {
        att.addAttribute("", "innerName", "innerName", "", innerName);
    }
    sa.addElement("innerclass", att);
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:20,代码来源:SAXClassAdapter.java

示例3: testcase07

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
/**
 * Basic test for setLocalName(int, String), setQName(int, String),
 * setType(int, String), setValue(int, String) and setURI(int, String).
 */
@Test
public void testcase07() {
    AttributesImpl attr = new AttributesImpl();
    attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
    attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
            JEEP_VALUE);
    attr.setLocalName(1, "speclead");
    attr.setQName(1, "megi");
    attr.setType(1, "sax");
    attr.setValue(1, "SAX01");
    attr.setURI(1, "www.megginson.com/sax/sax01");

    assertEquals(attr.getLocalName(1), "speclead");
    assertEquals(attr.getQName(1), "megi");
    assertEquals(attr.getType(1), "sax");
    assertEquals(attr.getType("megi"), "sax");
    assertEquals(attr.getURI(1), "www.megginson.com/sax/sax01");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:AttrImplTest.java

示例4: addInclude

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
/**
 * Add a list of files. This is used for implementing include-prelude and
 * include-coda of jsp-config element in web.xml
 */
private void addInclude(Node parent, List<String> files) throws JasperException {
    if (files != null) {
        Iterator<String> iter = files.iterator();
        while (iter.hasNext()) {
            String file = iter.next();
            AttributesImpl attrs = new AttributesImpl();
            attrs.addAttribute("", "file", "file", "CDATA", file);

            // Create a dummy Include directive node
            Node includeNode = new Node.IncludeDirective(attrs, reader
                    .mark(), parent);
            processIncludeDirective(file, includeNode);
        }
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:20,代码来源:Parser.java

示例5: writeCategory

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void writeCategory (NodeRef nodeRef, ManifestCategory value) throws SAXException
{
    
    AttributesImpl attributes = new AttributesImpl();
    attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "path", "path", "String",
                    value.getPath());
    writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                    ManifestModel.LOCALNAME_ELEMENT_CATEGORY, PREFIX + ":"
                                + ManifestModel.LOCALNAME_ELEMENT_CATEGORY, attributes);
    writeValue(nodeRef);
        
    writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                ManifestModel.LOCALNAME_ELEMENT_CATEGORY, PREFIX + ":"
                            + ManifestModel.LOCALNAME_ELEMENT_CATEGORY);    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:XMLTransferManifestWriter.java

示例6: writeMLValue

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
private void writeMLValue(Locale locale, Serializable value) throws SAXException
{
    AttributesImpl attributes = new AttributesImpl();
    attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "locale", "locale", "String",
                locale.toString());
    writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                ManifestModel.LOCALNAME_ELEMENT_MLVALUE, PREFIX + ":"
                            + ManifestModel.LOCALNAME_ELEMENT_MLVALUE, attributes);
    if (value != null)
    {
        String strValue = (String) DefaultTypeConverter.INSTANCE.convert(String.class, value);
        
        boolean oldValue = format.isTrimText();
        format.setTrimText(false);
        try
        {
           writer.characters(strValue.toCharArray(), 0, strValue.length());
        }
        finally
        {
           format.setTrimText(oldValue);
        }
    }
    writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                ManifestModel.LOCALNAME_ELEMENT_MLVALUE, PREFIX + ":"
                            + ManifestModel.LOCALNAME_ELEMENT_MLVALUE);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:XMLTransferManifestWriter.java

示例7: visitMaxs

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
@Override
public final void visitMaxs(final int maxStack, final int maxLocals) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "maxStack", "maxStack", "",
            Integer.toString(maxStack));
    attrs.addAttribute("", "maxLocals", "maxLocals", "",
            Integer.toString(maxLocals));
    sa.addElement("Max", attrs);

    sa.addEnd("code");
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:12,代码来源:SAXCodeAdapter.java

示例8: visitTryCatchBlock

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
@Override
public final void visitTryCatchBlock(final Label start, final Label end,
        final Label handler, final String type) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "start", "start", "", getLabel(start));
    attrs.addAttribute("", "end", "end", "", getLabel(end));
    attrs.addAttribute("", "handler", "handler", "", getLabel(handler));
    if (type != null) {
        attrs.addAttribute("", "type", "type", "", type);
    }
    sa.addElement("TryCatch", attrs);
}
 
开发者ID:acmerli,项目名称:fastAOP,代码行数:13,代码来源:SAXCodeAdapter.java

示例9: writeTarget

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
/**
 * Write the target to the report
 */
public void writeTarget(TransferTarget target) throws SAXException
{
    AttributesImpl attributes = new AttributesImpl();
    attributes.addAttribute(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, "name", "name", "String", target.getName());
    attributes.addAttribute(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, "endpointHost", "endpointHost", "String",  target.getEndpointHost());
    attributes.addAttribute(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, "endpointPort", "endpointPort", "int",  String.valueOf(target.getEndpointPort()));
 
    writer.startElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_TARGET, PREFIX + ":" + TransferReportModel.LOCALNAME_TRANSFER_TARGET, attributes);        
    writer.endElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, TransferReportModel.LOCALNAME_TRANSFER_TARGET, PREFIX + ":" + TransferReportModel.LOCALNAME_TRANSFER_TARGET);

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:XMLTransferReportWriter.java

示例10: getAttributes

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
@Override
public AttributesImpl getAttributes(TransferEvent event)
{
    TransferEventEndState s = (TransferEventEndState)event;
    AttributesImpl attributes = new AttributesImpl();
    attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "date", "date", "dateTime", ISO8601DateFormat.format(event.getTime()));
    attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "state", "state", "string", s.getTransferState().toString());
    return attributes;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:XMLTransferEventFormatterFactory.java

示例11: getAttributes

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
/**
 * Gets the Attributes that are not namesapce declarations
 * @param attrs
 * @return
 */
private AttributesImpl getAttributes(NamedNodeMap attrs) {
    AttributesImpl atts = new AttributesImpl();
    if(attrs == null)
        return EMPTY_ATTS;
    for(int i=0; i < attrs.getLength();i++) {
        Attr a = (Attr)attrs.item(i);
        //check if attr is ns declaration
        if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) {
          continue;
        }
        atts.addAttribute(fixNull(a.getNamespaceURI()),a.getLocalName(),a.getName(),a.getSchemaTypeInfo().getTypeName(),a.getValue());
    }
    return atts;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SAAJMessage.java

示例12: testcase06

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
/**
 * Basic test for getLocalName(int), getQName(int), getType(int),
 * getType(String) and getURI(int).
 */
@Test
public void testcase06() {
    AttributesImpl attr = new AttributesImpl();
    attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
    attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
            JEEP_VALUE);
    attr.setAttribute(1, "www.megginson.com", "author", "meg", "s", "SAX2");
    assertEquals(attr.getLocalName(1), "author");
    assertEquals(attr.getQName(1), "meg");
    assertEquals(attr.getType(1), "s");
    assertEquals(attr.getType("meg"), "s");
    assertEquals(attr.getURI(1), "www.megginson.com");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:AttrImplTest.java

示例13: getConstantAttribute

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
private static AttributesImpl getConstantAttribute(final Object cst) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "cst", "cst", "",
            SAXClassAdapter.encode(cst.toString()));
    attrs.addAttribute("", "desc", "desc", "",
            Type.getDescriptor(cst.getClass()));
    return attrs;
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:9,代码来源:SAXCodeAdapter.java

示例14: writeProperty

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void writeProperty(QName propertyName, Serializable value) throws SAXException
{
    {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "name", "name", "String",
                    formatQName(propertyName));
        writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                    ManifestModel.LOCALNAME_ELEMENT_PROPERTY, PREFIX + ":"
                                + ManifestModel.LOCALNAME_ELEMENT_PROPERTY, attributes);
    }

    if (value == null)
    {
        writeNullValue();
    }
    else if (value instanceof ContentData)
    {
        ContentData data = (ContentData) value;
        AttributesImpl dataAttributes = new AttributesImpl();
        dataAttributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "contentURL",
                    "contentURL", "String", data.getContentUrl());
        dataAttributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "mimetype",
                    "mimetype", "String", data.getMimetype());
        dataAttributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "size", "size",
                    "String", Long.toString(data.getSize()));
        dataAttributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "encoding",
                    "encoding", "String", data.getEncoding());
        dataAttributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "locale", "locale",
                    "String", data.getLocale().toString());
        writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                    ManifestModel.LOCALNAME_ELEMENT_CONTENT_HEADER, PREFIX + ":"
                                + ManifestModel.LOCALNAME_ELEMENT_CONTENT_HEADER,
                    dataAttributes);
        writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                    ManifestModel.LOCALNAME_ELEMENT_CONTENT_HEADER, PREFIX + ":"
                                + ManifestModel.LOCALNAME_ELEMENT_CONTENT_HEADER);
    }
    else if (value instanceof Collection)
    {
        writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                    ManifestModel.LOCALNAME_ELEMENT_VALUES, PREFIX + ":"
                                + ManifestModel.LOCALNAME_ELEMENT_VALUES, EMPTY_ATTRIBUTES);
        int index = 0;
        for (Object valueInCollection : (Collection) value)
        {
            writeValue((Serializable) valueInCollection);
            index++;
        }
        writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                    ManifestModel.LOCALNAME_ELEMENT_VALUES, PREFIX + ":"
                                + ManifestModel.LOCALNAME_ELEMENT_VALUES);
    }
    else if (value instanceof MLText)
    {
        MLText mltext = (MLText) value;
        for (Entry<Locale, String> entry : mltext.entrySet())
        {
            writeMLValue(entry.getKey(), entry.getValue());
        }
    }
    else
    {
        writeValue(value);
    }
    writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
                ManifestModel.LOCALNAME_ELEMENT_PROPERTY, PREFIX + ":"
                            + ManifestModel.LOCALNAME_ELEMENT_PROPERTY);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:70,代码来源:XMLTransferManifestWriter.java

示例15: generateSSL

import org.xml.sax.helpers.AttributesImpl; //导入方法依赖的package包/类
/**
 * Generates XML for the SSL configuration of the distributed system.
 */
private void generateSSL() throws SAXException {
  DistributedSystemConfig config = this.system.getConfig();

  boolean sslEnabled = config.isSSLEnabled();
  if (!sslEnabled) {
    return;
  }

  AttributesImpl atts = new AttributesImpl();
  atts.addAttribute("", "", AUTHENTICATION_REQUIRED, "",
      String.valueOf(config.isSSLAuthenticationRequired()));

  handler.startElement("", SSL, SSL, atts);

  String protocols = config.getSSLProtocols();
  if (protocols != null) {
    handler.startElement("", PROTOCOLS, PROTOCOLS, EMPTY);
    handler.characters(protocols.toCharArray(), 0, protocols.length());
    handler.endElement("", PROTOCOLS, PROTOCOLS);
  }

  String ciphers = config.getSSLCiphers();
  if (ciphers != null) {
    handler.startElement("", CIPHERS, CIPHERS, EMPTY);
    handler.characters(ciphers.toCharArray(), 0, ciphers.length());
    handler.endElement("", CIPHERS, CIPHERS);
  }

  Properties sslProps = config.getSSLProperties();
  for (Iterator iter = sslProps.entrySet().iterator(); iter.hasNext();) {
    Map.Entry entry = (Map.Entry) iter.next();
    String key = (String) entry.getKey();
    String value = (String) entry.getValue();

    handler.startElement("", PROPERTY, PROPERTY, EMPTY);

    handler.startElement("", KEY, KEY, EMPTY);
    handler.characters(key.toCharArray(), 0, key.length());
    handler.endElement("", KEY, KEY);

    handler.startElement("", VALUE, VALUE, EMPTY);
    handler.characters(value.toCharArray(), 0, value.length());
    handler.endElement("", VALUE, VALUE);

    handler.endElement("", PROPERTY, PROPERTY);
  }

  handler.endElement("", SSL, SSL);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:53,代码来源:ManagedEntityConfigXmlGenerator.java


注:本文中的org.xml.sax.helpers.AttributesImpl.addAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。