當前位置: 首頁>>代碼示例>>Java>>正文


Java AttributesImpl類代碼示例

本文整理匯總了Java中org.xml.sax.helpers.AttributesImpl的典型用法代碼示例。如果您正苦於以下問題:Java AttributesImpl類的具體用法?Java AttributesImpl怎麽用?Java AttributesImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AttributesImpl類屬於org.xml.sax.helpers包,在下文中一共展示了AttributesImpl類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addValueElement

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:17,代碼來源:SAXAnnotationAdapter.java

示例2: testAddAttributeAttributesImplStringStringObject

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
/**
 * 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));
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:19,代碼來源:XmlGeneratorUtilsJUnitTest.java

示例3: 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

示例4: appendFrameTypes

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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);
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:19,代碼來源:SAXCodeAdapter.java

示例5: outputTableMetaData

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:alfasoftware,項目名稱:morf,代碼行數:33,代碼來源:XmlDataSetConsumer.java

示例6: visitLocalVariable

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
@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);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:17,代碼來源:SAXCodeAdapter.java

示例7: exportDatabase

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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");
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:22,代碼來源:XMLModelExporter.java

示例8: exportFk

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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");
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:27,代碼來源:XMLModelExporter.java

示例9: delegationTokenToXml

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:21,代碼來源:FSEditLogOp.java

示例10: exportTrigger

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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");
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:18,代碼來源:XMLModelExporter.java

示例11: writeLockTypes

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:25,代碼來源:PropFindMethod.java

示例12: startACL

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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());
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ViewXMLExporter.java

示例13: startValueMLText

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ViewXMLExporter.java

示例14: missingContent

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
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);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:26,代碼來源:XMLTransferRequsiteWriter.java

示例15: writeUpdated

import org.xml.sax.helpers.AttributesImpl; //導入依賴的package包/類
@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();
    } 
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:21,代碼來源:XMLTransferDestinationReportWriter.java


注:本文中的org.xml.sax.helpers.AttributesImpl類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。