本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}