Java 类org.xml.sax.helpers.AttributesImpl 实例源码

项目:DirectLeaks-AntiReleak-Remover    文件:SAXAnnotationAdapter.java   
private void addValueElement(final String element, final String name,
        final String desc, final String value) {
    AttributesImpl att = new AttributesImpl();
    if (name != null) {
        att.addAttribute("", "name", "name", "", name);
    }
    if (desc != null) {
        att.addAttribute("", "desc", "desc", "", desc);
    }
    if (value != null) {
        att.addAttribute("", "value", "value", "",
                SAXClassAdapter.encode(value));
    }

    sa.addElement(element, att);
}
项目:monarch    文件:XmlGeneratorUtilsJUnitTest.java   
/**
 * Test method for {@link XmlGeneratorUtils#addAttribute(AttributesImpl, String, String, Object)}.
 */
@Test
public void testAddAttributeAttributesImplStringStringObject() {
  final AttributesImpl attributes = new AttributesImpl();
  assertEquals(0, attributes.getLength());

  XmlGeneratorUtils.addAttribute(attributes, "prefix", "localname", null);
  assertEquals(0, attributes.getLength());

  XmlGeneratorUtils.addAttribute(attributes, "prefix", "localname", "value");
  assertEquals(1, attributes.getLength());
  assertEquals("localname", attributes.getLocalName(0));
  assertEquals("prefix:localname", attributes.getQName(0));
  assertEquals(NULL_NS_URI, attributes.getURI(0));
  assertEquals("value", attributes.getValue(0));
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXClassAdapter.java   
@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);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXCodeAdapter.java   
private void appendFrameTypes(final boolean local, final int n,
        final Object[] types) {
    for (int i = 0; i < n; ++i) {
        Object type = types[i];
        AttributesImpl attrs = new AttributesImpl();
        if (type instanceof String) {
            attrs.addAttribute("", "type", "type", "", (String) type);
        } else if (type instanceof Integer) {
            attrs.addAttribute("", "type", "type", "",
                    TYPES[((Integer) type).intValue()]);
        } else {
            attrs.addAttribute("", "type", "type", "", "uninitialized");
            attrs.addAttribute("", "label", "label", "",
                    getLabel((Label) type));
        }
        sa.addElement(local ? "local" : "stack", attrs);
    }
}
项目:fastAOP    文件:SAXAnnotationAdapter.java   
private void addValueElement(final String element, final String name,
        final String desc, final String value) {
    AttributesImpl att = new AttributesImpl();
    if (name != null) {
        att.addAttribute("", "name", "name", "", name);
    }
    if (desc != null) {
        att.addAttribute("", "desc", "desc", "", desc);
    }
    if (value != null) {
        att.addAttribute("", "value", "value", "",
                SAXClassAdapter.encode(value));
    }

    sa.addElement(element, att);
}
项目:morf    文件:XmlDataSetConsumer.java   
/**
 * Serialise the meta data for a table.
 *
 * @param table The meta data to serialise.
 * @param contentHandler Content handler to receive the meta data xml.
 * @throws SAXException Propagates from SAX API calls.
 */
private void outputTableMetaData(Table table, ContentHandler contentHandler) throws SAXException {
  AttributesImpl tableAttributes = new AttributesImpl();
  tableAttributes.addAttribute(XmlDataSetNode.URI, XmlDataSetNode.NAME_ATTRIBUTE, XmlDataSetNode.NAME_ATTRIBUTE,
    XmlDataSetNode.STRING_TYPE, table.getName());
  contentHandler.startElement(XmlDataSetNode.URI, XmlDataSetNode.METADATA_NODE, XmlDataSetNode.METADATA_NODE, tableAttributes);

  for (Column column : table.columns()) {
    emptyElement(contentHandler, XmlDataSetNode.COLUMN_NODE, buildColumnAttributes(column));
  }

  // we need to sort the indexes by name to ensure consistency, since indexes don't have an explicit "sequence" in databases.
  List<Index> indexes = new ArrayList<>(table.indexes());
  Collections.sort(indexes, new Comparator<Index>() {
    @Override
    public int compare(Index o1, Index o2) {
      return o1.getName().compareTo(o2.getName());
    }
  });

  for (Index index : indexes) {
    emptyElement(contentHandler, XmlDataSetNode.INDEX_NODE, buildIndexAttributes(index));
  }

  contentHandler.endElement(XmlDataSetNode.URI, XmlDataSetNode.METADATA_NODE, XmlDataSetNode.METADATA_NODE);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXCodeAdapter.java   
@Override
public void visitLocalVariable(final String name, final String desc,
        final String signature, final Label start, final Label end,
        final int index) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "name", "name", "", name);
    attrs.addAttribute("", "desc", "desc", "", desc);
    if (signature != null) {
        attrs.addAttribute("", "signature", "signature", "",
                SAXClassAdapter.encode(signature));
    }
    attrs.addAttribute("", "start", "start", "", getLabel(start));
    attrs.addAttribute("", "end", "end", "", getLabel(end));
    attrs.addAttribute("", "var", "var", "", Integer.toString(index));
    sa.addElement("LocalVar", attrs);
}
项目:jdbacl    文件:XMLModelExporter.java   
private void exportDatabase(Database database, SimpleXMLWriter writer)
        throws SAXException {
    AttributesImpl attribs = createAttributes("environment", database.getName());
    if (database.getDatabaseProductName() != null)
        addAttribute("databaseProductName", database.getDatabaseProductName(), attribs);
    if (database.getDatabaseProductVersion() != null)
        addAttribute("databaseProductVersion", database.getDatabaseProductVersion().toString(), attribs);
    if (database.getImportDate() != null)
        addAttribute("importDate", sdf.format(database.getImportDate()), attribs);
    addAttribute("user", database.getUser(), attribs);
    addAttribute("tableInclusionPattern", database.getTableInclusionPattern(), attribs);
    addAttribute("tableExclusionPattern", database.getTableExclusionPattern(), attribs);
    addAttribute("checksImported", String.valueOf(database.isChecksImported()), attribs);
    addAttribute("sequencesImported", String.valueOf(database.isSequencesImported()), attribs);
    addAttribute("triggersImported", String.valueOf(database.isTriggersImported()), attribs);
    addAttribute("packagesImported", String.valueOf(database.isSequencesImported()), attribs);
    writer.startElement("database", attribs);
    for (DBCatalog catalog : database.getCatalogs())
        exportCatalog(catalog, writer);
    writer.endElement("database");
}
项目:jdbacl    文件:XMLModelExporter.java   
private static void exportFk(DBForeignKeyConstraint fk, SimpleXMLWriter writer) throws SAXException {
    AttributesImpl atts = createAttributes("name", fk.getName());
    String[] columnNames = fk.getColumnNames();
    if (columnNames.length == 1)
        addAttribute("column", columnNames[0], atts);
    addAttribute("refereeTable", fk.getRefereeTable().getName(), atts);
    String[] refereeColumns = fk.getRefereeColumnNames();
    if (refereeColumns.length == 1)
        addAttribute("refereeColumn", refereeColumns[0], atts);
    if (fk.getUpdateRule() != FKChangeRule.NO_ACTION)
        addAttribute("updateRule", fk.getUpdateRule().name(), atts);
    if (fk.getDeleteRule() != FKChangeRule.NO_ACTION)
        addAttribute("deleteRule", fk.getDeleteRule().name(), atts);
    writer.startElement("fk", atts);
    if (columnNames.length > 1) {
        writer.startElement("columns");
        for (String columnName : columnNames) {
            AttributesImpl colAtts = createAttributes("name", columnName);
            addAttribute("refereeColumn", fk.columnReferencedBy(columnName), colAtts);
            writer.startElement("column", colAtts);
            writer.endElement("column");
        }
        writer.endElement("columns");
    }
    writer.endElement("fk");
}
项目:hadoop    文件:FSEditLogOp.java   
public static void delegationTokenToXml(ContentHandler contentHandler,
    DelegationTokenIdentifier token) throws SAXException {
  contentHandler.startElement("", "", "DELEGATION_TOKEN_IDENTIFIER", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "KIND", token.getKind().toString());
  XMLUtils.addSaxString(contentHandler, "SEQUENCE_NUMBER",
      Integer.toString(token.getSequenceNumber()));
  XMLUtils.addSaxString(contentHandler, "OWNER",
      token.getOwner().toString());
  XMLUtils.addSaxString(contentHandler, "RENEWER",
      token.getRenewer().toString());
  XMLUtils.addSaxString(contentHandler, "REALUSER",
      token.getRealUser().toString());
  XMLUtils.addSaxString(contentHandler, "ISSUE_DATE",
      Long.toString(token.getIssueDate()));
  XMLUtils.addSaxString(contentHandler, "MAX_DATE",
      Long.toString(token.getMaxDate()));
  XMLUtils.addSaxString(contentHandler, "MASTER_KEY_ID",
      Integer.toString(token.getMasterKeyId()));
  contentHandler.endElement("", "", "DELEGATION_TOKEN_IDENTIFIER");
}
项目:jdbacl    文件:XMLModelExporter.java   
private static void exportTrigger(DBTrigger trigger, SimpleXMLWriter writer) throws SAXException {
    AttributesImpl atts = createAttributes("name", trigger.getName());
    addIfNotNull("triggerType", trigger.getTriggerType(), atts);
    addIfNotNull("triggeringEvent", trigger.getTriggeringEvent(), atts);
    addIfNotNull("tableOwner", trigger.getTableOwner(), atts);
    addIfNotNull("baseObjectType", trigger.getBaseObjectType(), atts);
    addIfNotNull("tableName", trigger.getTableName(), atts);
    addIfNotNull("columnName", trigger.getColumnName(), atts);
    addIfNotNull("referencingNames", trigger.getReferencingNames(), atts);
    addIfNotNull("whenClause", trigger.getWhenClause(), atts);
    addIfNotNull("status", trigger.getStatus(), atts);
    addIfNotNull("description", trigger.getDescription(), atts);
    addIfNotNull("actionType", trigger.getActionType(), atts);
    addIfNotNull("triggerBody", trigger.getTriggerBody(), atts);
    writer.startElement("trigger", atts);
    writer.endElement("trigger");
}
项目:alfresco-remote-api    文件:PropFindMethod.java   
/**
 * Output the supported lock types XML element
 * 
 * @param xml XMLWriter
 */
protected void writeLockTypes(XMLWriter xml)
{
    try
    {
        AttributesImpl nullAttr = getDAVHelper().getNullAttributes();

        xml.startElement(WebDAV.DAV_NS, WebDAV.XML_SUPPORTED_LOCK, WebDAV.XML_NS_SUPPORTED_LOCK, nullAttr);

        // Output exclusive lock
        // Shared locks are not supported, as they cannot be supported by the LockService (relevant to ALF-16449).
        writeLock(xml, WebDAV.XML_NS_EXCLUSIVE);

        xml.endElement(WebDAV.DAV_NS, WebDAV.XML_SUPPORTED_LOCK, WebDAV.XML_NS_SUPPORTED_LOCK);
    }
    catch (Exception ex)
    {
        throw new AlfrescoRuntimeException("XML write error", ex);
    }
}
项目:alfresco-repository    文件:ViewXMLExporter.java   
public void startACL(NodeRef nodeRef)
{
    try
    {
        AttributesImpl attrs = new AttributesImpl(); 
        boolean inherit = permissionService.getInheritParentPermissions(nodeRef);
        if (!inherit)
        {
            attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_1_0_URI, INHERITPERMISSIONS_LOCALNAME, INHERITPERMISSIONS_QNAME.toPrefixString(), null, "false");
        }
        contentHandler.startElement(ACL_QNAME.getNamespaceURI(), ACL_QNAME.getLocalName(), toPrefixString(ACL_QNAME), attrs);
    }
    catch (SAXException e)
    {
        throw new ExporterException("Failed to process start ACL event - node ref " + nodeRef.toString());
    }
}
项目:alfresco-repository    文件:ViewXMLExporter.java   
public void startValueMLText(NodeRef nodeRef, Locale locale, boolean isNull)
{
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_PREFIX, LOCALE_LOCALNAME, LOCALE_QNAME.toPrefixString(), null, locale.toString());
    if(isNull)
    {
        attrs.addAttribute(NamespaceService.REPOSITORY_VIEW_PREFIX, ISNULL_LOCALNAME, ISNULL_QNAME.toPrefixString(), null, "true");
    }
    try
    {
        contentHandler.startElement(NamespaceService.REPOSITORY_VIEW_PREFIX, MLVALUE_LOCALNAME, MLVALUE_QNAME.toPrefixString(), attrs);
    }
    catch (SAXException e)
    {
        throw new ExporterException("Failed to process start mlvalue", e);
    }
}
项目:alfresco-repository    文件:XMLTransferRequsiteWriter.java   
public void missingContent(NodeRef node, QName qname, String name)
{
    log.debug("write missing content");
    try
    {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("uri", "nodeRef", "nodeRef", "String", node.toString());
        attributes.addAttribute("uri", "qname", "qname", "String", qname.toString());
        attributes.addAttribute("uri", "name", "name", "String", name.toString());

        // Start Missing Content
        this.writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
            RequsiteModel.LOCALNAME_ELEMENT_CONTENT, PREFIX + ":"
                        + RequsiteModel.LOCALNAME_ELEMENT_CONTENT, attributes);

        // Missing Content
        writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
            RequsiteModel.LOCALNAME_ELEMENT_CONTENT, PREFIX + ":"
                        + RequsiteModel.LOCALNAME_ELEMENT_CONTENT);
    }
    catch (SAXException se)
    {
        log.debug("error", se);
    }
}
项目:alfresco-repository    文件:XMLTransferDestinationReportWriter.java   
@Override
public void writeUpdated(NodeRef sourceNodeRef, NodeRef updatedNode, String updatedPath)
{
    try
    {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "date", "date", "dateTime", ISO8601DateFormat.format(new Date()));
        attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "sourceNodeRef", "sourceNodeRef", "string", sourceNodeRef.toString());
        attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "destinationNodeRef", "destinationNodeRef", "string", updatedNode.toString());

        writer.startElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_UPDATED, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_UPDATED, attributes);        
        writeDestinationPath(updatedPath);
        writer.endElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_UPDATED, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_UPDATED);        
    }
    catch (SAXException se)
    {
        // TODO Auto-generated catch block
        se.printStackTrace();
    } 
}
项目:alfresco-repository    文件:XMLTransferManifestWriter.java   
@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);    
}
项目:openjdk-jdk10    文件:AttrImplTest.java   
/**
 * 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");
}
项目:apache-tomcat-7.0.73-with-comment    文件:JspDocumentParser.java   
private void addInclude(Node parent, List<String> files) throws SAXException {
    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 includeDir =
                    new Node.IncludeDirective(attrs, null, // XXX
parent);
            processIncludeDirective(file, includeDir);
        }
    }
}
项目:openjdk-jdk10    文件:Bug6451633.java   
@Test
public void test() throws Exception {
    TransformerHandler th = ((SAXTransformerFactory) TransformerFactory.newInstance()).newTransformerHandler();

    DOMResult result = new DOMResult();
    th.setResult(result);

    th.startDocument();
    th.startElement("", "root", "root", new AttributesImpl());
    th.characters(new char[0], 0, 0);
    th.endElement("", "root", "root");
    th.endDocument();

    // there's no point in having empty text --- we should remove it
    Assert.assertEquals(0, ((Document) result.getNode()).getDocumentElement().getChildNodes().getLength());
}
项目:fastAOP    文件:SAXCodeAdapter.java   
@Override
public final void visitTableSwitchInsn(final int min, final int max,
        final Label dflt, final Label... labels) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "min", "min", "", Integer.toString(min));
    attrs.addAttribute("", "max", "max", "", Integer.toString(max));
    attrs.addAttribute("", "dflt", "dflt", "", getLabel(dflt));
    String o = Printer.OPCODES[Opcodes.TABLESWITCH];
    sa.addStart(o, attrs);
    for (int i = 0; i < labels.length; i++) {
        AttributesImpl att2 = new AttributesImpl();
        att2.addAttribute("", "name", "name", "", getLabel(labels[i]));
        sa.addElement("label", att2);
    }
    sa.addEnd(o);
}
项目:alfresco-repository    文件:XMLTransferManifestWriter.java   
private void writePermission(ManifestPermission permission) throws SAXException
{
    AttributesImpl attributes = new AttributesImpl();
    attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "status", "status", "String",
                permission.getStatus());
    attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "authority", "authority", "String",
            permission.getAuthority());
    attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "permission", "permission", "String",
            permission.getPermission());

    writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
            ManifestModel.LOCALNAME_ELEMENT_ACL_PERMISSION, PREFIX + ":"
                        + ManifestModel.LOCALNAME_ELEMENT_ACL_PERMISSION, attributes);

    writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
            ManifestModel.LOCALNAME_ELEMENT_ACL_PERMISSION, PREFIX + ":"
                        + ManifestModel.LOCALNAME_ELEMENT_ACL_PERMISSION);
}
项目:apache-tomcat-7.0.73-with-comment    文件:Parser.java   
/**
 * 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);
        }
    }
}
项目:UaicNlpToolkit    文件:IndexedLuceneCorpus.java   
@Override
public void startElement(String u, String l, String qName, Attributes attributes) throws SAXException {
    if (qName.equals("GGS:SpanAnnotation") || qName.equals("GGS:Annotation")) {
        Document doc = new Document();
        for (int i = 0; i < attributes.getLength(); i++) {
            doc.add(new StringField(attributes.getLocalName(i), attributes.getValue(i), Field.Store.YES));
        }
        try {
            annotationsWriter.addDocument(doc);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return;
    }

    if (qName.equals(sent) || nodesStack.size() > 0) {
        nodesStack.push(qName);
        segmentStartsStack.push(totalWords);
        if (attributes != null && attributes.getLength() > 0) {
            attributesStack.push(new AttributesImpl(attributes));
        } else {
            attributesStack.push(new AttributesImpl());
        }
        sb = new StringBuilder();
    }
}
项目:fastAOP    文件:SAXCodeAdapter.java   
private void appendFrameTypes(final boolean local, final int n,
        final Object[] types) {
    for (int i = 0; i < n; ++i) {
        Object type = types[i];
        AttributesImpl attrs = new AttributesImpl();
        if (type instanceof String) {
            attrs.addAttribute("", "type", "type", "", (String) type);
        } else if (type instanceof Integer) {
            attrs.addAttribute("", "type", "type", "",
                    TYPES[((Integer) type).intValue()]);
        } else {
            attrs.addAttribute("", "type", "type", "", "uninitialized");
            attrs.addAttribute("", "label", "label", "",
                    getLabel((Label) type));
        }
        sa.addElement(local ? "local" : "stack", attrs);
    }
}
项目:alfresco-repository    文件:XMLTransferReportWriter.java   
private void writeParentAssoc(ChildAssociationRef assoc) throws SAXException
{
    if(assoc != null)
    {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "from", "from", "String", assoc.getParentRef().toString());     
        attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "type", "type", "String", formatQName(assoc.getTypeQName()));
        attributes.addAttribute(TransferModel.TRANSFER_MODEL_1_0_URI, "type", "isPrimary", "Boolean", assoc.isPrimary()?"true":"false");
        writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI, ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC, PREFIX + ":" + ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC,  attributes);
        String name= formatQName(assoc.getQName());
        writer.characters(name.toCharArray(), 0, name.length());            
        assoc.isPrimary();

        writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI, ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC, PREFIX + ":" + ManifestModel.LOCALNAME_ELEMENT_PARENT_ASSOC); 
    }
}
项目:alfresco-repository    文件:XMLTransferReportWriter.java   
/**
 * Write the transfer event
 */
public void writeTransferEvent(TransferEvent event) throws SAXException
{

    XMLTransferEventFormatter formatter = XMLTransferEventFormatterFactory.getFormatter(event);

    AttributesImpl attributes = formatter.getAttributes(event);
    String elementName = formatter.getElementName(event);
    String message = formatter.getMessage(event);

    writer.startElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, elementName, PREFIX + ":" + elementName, attributes);
    if(message != null)
    {
            writer.characters(message.toCharArray(), 0, message.length());
    }
    writer.endElement(TransferReportModel2.TRANSFER_REPORT_MODEL_2_0_URI, elementName, PREFIX + ":" + elementName);
}
项目:tomcat7    文件:Digester.java   
/**
 * Returns an attributes list which contains all the attributes
 * passed in, with any text of form "${xxx}" in an attribute value
 * replaced by the appropriate value from the system property.
 */
private Attributes updateAttributes(Attributes list) {

    if (list.getLength() == 0) {
        return list;
    }

    AttributesImpl newAttrs = new AttributesImpl(list);
    int nAttributes = newAttrs.getLength();
    for (int i = 0; i < nAttributes; ++i) {
        String value = newAttrs.getValue(i);
        try {
            String newValue = 
                IntrospectionUtils.replaceProperties(value, null, source);
            if (value != newValue) {
                newAttrs.setValue(i, newValue);
            }
        }
        catch (Exception e) {
            // ignore - let the attribute have its original value
        }
    }

    return newAttrs;

}
项目:tomcat7    文件:JspDocumentParser.java   
private void addInclude(Node parent, List<String> files) throws SAXException {
    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 includeDir =
                    new Node.IncludeDirective(attrs, null, // XXX
parent);
            processIncludeDirective(file, includeDir);
        }
    }
}
项目:monarch    文件:CacheXmlGenerator.java   
/**
 * Generates XML for the client-subscription tag
 * 
 * @param bridge instance of <code>CacheServer</code>
 * 
 * @since GemFire 5.7
 */

private void generateClientHaQueue(CacheServer bridge) throws SAXException {
  AttributesImpl atts = new AttributesImpl();
  ClientSubscriptionConfigImpl csc =
      (ClientSubscriptionConfigImpl) bridge.getClientSubscriptionConfig();
  try {
    atts.addAttribute("", "", CLIENT_SUBSCRIPTION_EVICTION_POLICY, "", csc.getEvictionPolicy());
    atts.addAttribute("", "", CLIENT_SUBSCRIPTION_CAPACITY, "",
        String.valueOf(csc.getCapacity()));
    if (this.version.compareTo(CacheXmlVersion.GEMFIRE_6_5) >= 0) {
      String dsVal = csc.getDiskStoreName();
      if (dsVal != null) {
        atts.addAttribute("", "", DISK_STORE_NAME, "", dsVal);
      }
    }
    if (csc.getDiskStoreName() == null && csc.hasOverflowDirectory()) {
      atts.addAttribute("", "", OVERFLOW_DIRECTORY, "", csc.getOverflowDirectory());
    }
    handler.startElement("", CLIENT_SUBSCRIPTION, CLIENT_SUBSCRIPTION, atts);
    handler.endElement("", CLIENT_SUBSCRIPTION, CLIENT_SUBSCRIPTION);

  } catch (Exception ex) {
    ex.printStackTrace();
  }
}
项目:fastAOP    文件:SAXCodeAdapter.java   
@Override
public final void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "owner", "owner", "", owner);
    attrs.addAttribute("", "name", "name", "", name);
    attrs.addAttribute("", "desc", "desc", "", desc);
    attrs.addAttribute("", "itf", "itf", "", itf ? "true" : "false");
    sa.addElement(Printer.OPCODES[opcode], attrs);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXClassAdapter.java   
@Override
public void visitSource(final String source, final String debug) {
    AttributesImpl att = new AttributesImpl();
    if (source != null) {
        att.addAttribute("", "file", "file", "", encode(source));
    }
    if (debug != null) {
        att.addAttribute("", "debug", "debug", "", encode(debug));
    }

    sa.addElement("source", att);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXClassAdapter.java   
@Override
public void visitOuterClass(final String owner, final String name,
        final String desc) {
    AttributesImpl att = new AttributesImpl();
    att.addAttribute("", "owner", "owner", "", owner);
    if (name != null) {
        att.addAttribute("", "name", "name", "", name);
    }
    if (desc != null) {
        att.addAttribute("", "desc", "desc", "", desc);
    }

    sa.addElement("outerclass", att);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXClassAdapter.java   
@Override
public void visit(final int version, final int access, final String name,
        final String signature, final String superName,
        final String[] interfaces) {
    StringBuilder sb = new StringBuilder();
    appendAccess(access | ACCESS_CLASS, sb);

    AttributesImpl att = new AttributesImpl();
    att.addAttribute("", "access", "access", "", sb.toString());
    if (name != null) {
        att.addAttribute("", "name", "name", "", name);
    }
    if (signature != null) {
        att.addAttribute("", "signature", "signature", "",
                encode(signature));
    }
    if (superName != null) {
        att.addAttribute("", "parent", "parent", "", superName);
    }
    att.addAttribute("", "major", "major", "",
            Integer.toString(version & 0xFFFF));
    att.addAttribute("", "minor", "minor", "",
            Integer.toString(version >>> 16));
    sa.addStart("class", att);

    sa.addStart("interfaces", new AttributesImpl());
    if (interfaces != null && interfaces.length > 0) {
        for (int i = 0; i < interfaces.length; i++) {
            AttributesImpl att2 = new AttributesImpl();
            att2.addAttribute("", "name", "name", "", interfaces[i]);
            sa.addElement("interface", att2);
        }
    }
    sa.addEnd("interfaces");
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXClassAdapter.java   
@Override
public MethodVisitor visitMethod(final int access, final String name,
        final String desc, final String signature, final String[] exceptions) {
    StringBuilder sb = new StringBuilder();
    appendAccess(access, sb);

    AttributesImpl att = new AttributesImpl();
    att.addAttribute("", "access", "access", "", sb.toString());
    att.addAttribute("", "name", "name", "", name);
    att.addAttribute("", "desc", "desc", "", desc);
    if (signature != null) {
        att.addAttribute("", "signature", "signature", "", signature);
    }
    sa.addStart("method", att);

    sa.addStart("exceptions", new AttributesImpl());
    if (exceptions != null && exceptions.length > 0) {
        for (int i = 0; i < exceptions.length; i++) {
            AttributesImpl att2 = new AttributesImpl();
            att2.addAttribute("", "name", "name", "", exceptions[i]);
            sa.addElement("exception", att2);
        }
    }
    sa.addEnd("exceptions");

    return new SAXCodeAdapter(sa, access);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXCodeAdapter.java   
@Override
public void visitParameter(String name, int access) {
    AttributesImpl attrs = new AttributesImpl();
    if (name != null) {
        attrs.addAttribute("", "name", "name", "", name);
    }
    StringBuilder sb = new StringBuilder();
    SAXClassAdapter.appendAccess(access, sb);
    attrs.addAttribute("", "access", "access", "", sb.toString());
    sa.addElement("parameter", attrs);
}
项目:fastAOP    文件:SAXCodeAdapter.java   
@Override
public final void visitLookupSwitchInsn(final Label dflt, final int[] keys,
        final Label[] labels) {
    AttributesImpl att = new AttributesImpl();
    att.addAttribute("", "dflt", "dflt", "", getLabel(dflt));
    String o = Printer.OPCODES[Opcodes.LOOKUPSWITCH];
    sa.addStart(o, att);
    for (int i = 0; i < labels.length; i++) {
        AttributesImpl att2 = new AttributesImpl();
        att2.addAttribute("", "name", "name", "", getLabel(labels[i]));
        att2.addAttribute("", "key", "key", "", Integer.toString(keys[i]));
        sa.addElement("label", att2);
    }
    sa.addEnd(o);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXCodeAdapter.java   
@Override
public final void visitFieldInsn(final int opcode, final String owner,
        final String name, final String desc) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "owner", "owner", "", owner);
    attrs.addAttribute("", "name", "name", "", name);
    attrs.addAttribute("", "desc", "desc", "", desc);
    sa.addElement(Printer.OPCODES[opcode], attrs);
}
项目:DirectLeaks-AntiReleak-Remover    文件:SAXCodeAdapter.java   
@Override
public final void visitMethodInsn(final int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    AttributesImpl attrs = new AttributesImpl();
    attrs.addAttribute("", "owner", "owner", "", owner);
    attrs.addAttribute("", "name", "name", "", name);
    attrs.addAttribute("", "desc", "desc", "", desc);
    attrs.addAttribute("", "itf", "itf", "", itf ? "true" : "false");
    sa.addElement(Printer.OPCODES[opcode], attrs);
}
项目:openjdk-jdk10    文件:AttrImplTest.java   
/**
 * Basic test for getValue(int), getValue(String) and getValue(String, String).
 */
@Test
public void testcase05() {
    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);
    assertEquals(attr.getValue(1), JEEP_VALUE);
    assertEquals(attr.getValue(attr.getQName(1)), JEEP_VALUE);
    assertEquals(attr.getValue(attr.getURI(1), attr.getLocalName(1)), JEEP_VALUE);
}