List of usage examples for org.dom4j DocumentHelper createElement
public static Element createElement(String name)
From source file:com.ah.be.ls.stat.StatManager.java
private Element createCvgElement(int number) { Element ele = DocumentHelper.createElement("CVG"); return ele.addAttribute("count", String.valueOf(number)); }
From source file:com.ah.be.ls.stat.StatManager.java
private Element createCvgsElement(int number) { Element ele = DocumentHelper.createElement("CVGS"); return ele.addAttribute("count", String.valueOf(number)); }
From source file:com.ah.be.ls.stat.StatManager.java
private Element createCvgsTunnelElement(String mac, int number, boolean isL2) { Element ele = DocumentHelper.createElement("CVG"); ele.addAttribute("mac", mac); ele.addAttribute("tunnel-type", isL2 ? "L2" : "L3"); return ele.addAttribute("tunnel-count", String.valueOf(number)); }
From source file:com.ah.be.ls.stat.StatManager.java
private Element createPlatformElement(String apModel, int total, int number) { Element ele = DocumentHelper.createElement("platform"); ele.addAttribute("type", apModel); ele.addAttribute("count", String.valueOf(number)); ele.addAttribute("total-count", String.valueOf(total)); return ele;// ww w.j av a 2s . c o m }
From source file:com.alibaba.citrus.springext.support.SchemaUtil.java
License:Open Source License
/** schema?includes */ public static Transformer getTransformerWhoAddsIndirectIncludes(final Map<String, Schema> includes) { return new Transformer() { public void transform(Document document, String systemId) { Element root = document.getRootElement(); root.addNamespace("xsd", W3C_XML_SCHEMA_NS_URI); // <xsd:schema> if (W3C_XML_SCHEMA_NS_URI.equals(root.getNamespaceURI()) && "schema".equals(root.getName())) { Namespace xsd = DocumentHelper.createNamespace("xsd", W3C_XML_SCHEMA_NS_URI); QName includeName = DocumentHelper.createQName("include", xsd); // for each <xsd:include> for (Iterator<?> i = root.elementIterator(includeName); i.hasNext();) { i.next();/*from www . j a v a2 s . c o m*/ i.remove(); } // includes @SuppressWarnings("unchecked") List<Node> nodes = root.elements(); int i = 0; for (Schema includedSchema : includes.values()) { Element includeElement = DocumentHelper.createElement(includeName); nodes.add(i++, includeElement); includeElement.addAttribute("schemaLocation", includedSchema.getName()); } } } }; }
From source file:com.anite.maven.plugin.hivedoc.Dom4JRegistrySerializer.java
License:Apache License
public Document createRegistryDocument() { _document = DocumentHelper.createDocument(); Element registry = DocumentHelper.createElement("registry"); _document.add(registry);//from www.ja v a2 s . c o m for (Iterator i = _providers.iterator(); i.hasNext();) { ModuleDescriptorProvider provider = (ModuleDescriptorProvider) i.next(); processModuleDescriptorProvider(registry, provider); } return _document; }
From source file:com.anite.maven.plugin.hivedoc.Dom4JRegistrySerializer.java
License:Apache License
private Element getModuleElement(ModuleDescriptor md) { Element module = DocumentHelper.createElement("module"); module.addAttribute("id", md.getModuleId()); module.addAttribute("version", md.getVersion()); module.addAttribute("package", md.getPackageName()); if (md.getAnnotation() != null) { module.addText(md.getAnnotation()); }/*from w ww. j av a2 s. c o m*/ addDependencies(module); addServicePoints(module); addConfigurationPoints(module); addContributions(module); addImplementations(module); addSchemas(module); addSubModules(module); return module; }
From source file:com.anite.maven.plugin.hivedoc.Dom4JRegistrySerializer.java
License:Apache License
private Element getDependencyElement(DependencyDescriptor dd) { Element dependency = DocumentHelper.createElement("dependency"); dependency.addAttribute("module-id", dd.getModuleId()); dependency.addAttribute("version", dd.getVersion()); return dependency; }
From source file:com.anite.maven.plugin.hivedoc.Dom4JRegistrySerializer.java
License:Apache License
private Element getServicePointElement(ServicePointDescriptor spd) { Element servicePoint = DocumentHelper.createElement("service-point"); servicePoint.addAttribute("id", qualify(spd.getId())); servicePoint.addAttribute("interface", spd.getInterfaceClassName()); if (spd.getVisibility() == Visibility.PRIVATE) servicePoint.addAttribute("visibility", "private"); if (spd.getParametersCount() != Occurances.REQUIRED) servicePoint.addAttribute("parameters-occurs", spd.getParametersCount().getName().toLowerCase()); if (spd.getAnnotation() != null) { servicePoint.addText(spd.getAnnotation()); }/*from ww w.j a v a 2s . c o m*/ if (spd.getParametersSchema() != null) addSchema(servicePoint, (SchemaImpl) spd.getParametersSchema(), "parameters-schema"); else if (spd.getParametersSchemaId() != null) servicePoint.addAttribute("parameters-schema-id", qualify(spd.getParametersSchemaId())); InstanceBuilder ib = spd.getInstanceBuilder(); if (ib != null) { Element instanceBuilder = getInstanceBuilderElement(ib); servicePoint.add(instanceBuilder); } List interceptors = spd.getInterceptors(); if (interceptors != null) { for (Iterator i = interceptors.iterator(); i.hasNext();) { InterceptorDescriptor icd = (InterceptorDescriptor) i.next(); Element interceptor = getInterceptorElement(icd); servicePoint.add(interceptor); } } return servicePoint; }
From source file:com.anite.maven.plugin.hivedoc.Dom4JRegistrySerializer.java
License:Apache License
private Element getConfigurationPointElement(ConfigurationPointDescriptor cpd) { Element configurationPoint = DocumentHelper.createElement("configuration-point"); configurationPoint.addAttribute("id", qualify(cpd.getId())); if (cpd.getVisibility() == Visibility.PRIVATE) configurationPoint.addAttribute("visibility", "private"); if (cpd.getAnnotation() != null) { configurationPoint.addText(cpd.getAnnotation()); }/*w ww . j av a 2 s.c om*/ if (cpd.getContributionsSchema() != null) addSchema(configurationPoint, (SchemaImpl) cpd.getContributionsSchema(), "schema"); else if (cpd.getContributionsSchemaId() != null) configurationPoint.addAttribute("schema-id", qualify(cpd.getContributionsSchemaId())); return configurationPoint; }