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


Java Element.asXML方法代码示例

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


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

示例1: getNcsItemStream

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Gets the ncsItemStream attribute of the CollectionAdopter object
 *
 * @param  nsdl_dc_stream  NOT YET DOCUMENTED
 * @return                 The ncsItemStream value
 * @exception  Exception   NOT YET DOCUMENTED
 */
public Element getNcsItemStream(Element nsdl_dc_stream) throws Exception {
	// return XSLTransformer.transformString (nsdl_dc, this.xslPath);
	String className = "net.sf.saxon.TransformerFactoryImpl";
	if (nsdl_dc_stream == null)
		return null;
	String nsdl_dc = nsdl_dc_stream.asXML();
	try {
		Transformer transformer =
			XSLTransformer.getTransformer(this.xslPath, className);
		String xml = XSLTransformer.transformString(nsdl_dc, transformer);
		if (xml != null && xml.trim().length() > 0)
			return DocumentHelper.parseText(xml).getRootElement();
	} catch (Throwable t) {
		prtln("transform problem: " + t.getMessage());
	}
	return null;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:25,代码来源:CollectionAdopter.java

示例2: processModelGroup

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Process a ModelGroup element
 *
 * @param  e              current schema Element to process
 * @param  parent         instanceDoc Element to which we attach new instanceElement
 * @exception  Exception  if this element cannot be processed
 */
private void processModelGroup(Element e, Element parent) throws Exception {
	// find the type Definition for this element's ref

	// Debugging
	prtln("\n processModelGroup()", 1);
	prtln("\t element: " + e.asXML(), 1);

	GlobalDef globalDef = getElementTypeDef(e);
	if (globalDef == null) {
		throw new Exception("processModelGroup received null globalDef for " + e.asXML());
	}

	if (!globalDef.isModelGroup()) {
		throw new Exception("processModelGroup did not get ModelGroup def for " + e.asXML());
	}

	// now we've got our model group, and we can process it just as we would a complexType?

	ModelGroup groupDef = (ModelGroup) globalDef;

	Namespace ns = groupDef.getNamespace();
	pushNS(ns);
	readerStack.push(groupDef.getSchemaReader());
	prtln("\n" + readerStack.toString(), 1);

	List children = groupDef.getChildren();
	for (Iterator i = children.iterator(); i.hasNext(); ) {
		Element childElement = (Element) i.next();
		prtln("\t...with " + childElement.getName(), 1);
		processSchemaElement(childElement, parent);
	}
	popNS();
	SchemaReader popped = readerStack.pop();
	prtln("\n readerStack (" + readerStack.size() + ") popped " + popped.getLocation().toString());
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:43,代码来源:StructureWalker.java

示例3: processAttributeGroup

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  NOT YET DOCUMENTED
 *
 * @param  e              current schema Element to process
 * @param  parent         instanceDoc Element to which we attach new instanceElement
 * @exception  Exception  if this element cannot be processed
 */
private void processAttributeGroup(Element e, Element parent) throws Exception {
	// find the type Definition for this element's ref

	// Debugging
	prtln("\n processAttributeGroup()", 1);
	prtln("\t element: " + e.asXML(), 1);

	GlobalDef globalDef = getElementTypeDef(e);
	if (globalDef == null) {
		throw new Exception("processAttributeGroup received null globalDef for " + e.asXML());
	}

	if (!globalDef.isAttributeGroup()) {
		throw new Exception("processAttributeGroup did not get attributeGroup def for " + e.asXML());
	}

	// now we've got our attributeGroup, and we can process it just as we would

	AttributeGroup groupDef = (AttributeGroup) globalDef;

	Namespace ns = groupDef.getNamespace();
	pushNS(ns);
	readerStack.push(groupDef.getSchemaReader());
	prtln("\n" + readerStack.toString(), 1);

	List attributes = groupDef.getAttributes();
	for (Iterator i = attributes.iterator(); i.hasNext(); ) {
		Element attrElement = (Element) i.next();
		prtln("\t...with " + attrElement.getName(), 1);
		processInstanceAttribute(attrElement, parent);
	}
	popNS();
	SchemaReader popped = readerStack.pop();
	prtln("\n readerStack (" + readerStack.size() + ") popped " + popped.getLocation().toString());
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:43,代码来源:StructureWalker.java

示例4: toString

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  NOT YET DOCUMENTED
 *
 * @return    NOT YET DOCUMENTED
 */
public String toString() {
	String s = "AttributeGroup: " + name;
	s += super.toString();
		String nl = "\n\t";
	for (Iterator i=getAttributes().iterator();i.hasNext();) {
		Element e = (Element)i.next();
		s += nl + e.asXML();
	}
	return s;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:16,代码来源:AttributeGroup.java

示例5: serializeAsXml

import org.dom4j.Element; //导入方法依赖的package包/类
public String serializeAsXml(T body) {
  Class<?> clazz = body.getClass();
  Element rootElement = DocumentHelper
      .createElement(clazz.getAnnotation(XmlRootElement.class).name());
  Document document = DocumentHelper.createDocument(rootElement);
  checkRequestPropertyValidAndAddElement(rootElement, body);
  printXML(document);
  return rootElement.asXML();
}
 
开发者ID:minlia-projects,项目名称:minlia-iot,代码行数:10,代码来源:AbstractAnnotationApiSerializer.java

示例6: saveBoardConfig

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * Сохранение конфигурации главного табло - ЖК или плазмы. Это XML-файл лежащий в папку
 * приложения mainboard.xml
 *
 * @param netProperty параметры соединения с сервером
 */
public static void saveBoardConfig(INetProperty netProperty, Element boardConfig) {
    QLog.l().logger().info("Сохранение конфигурации главного табло - ЖК или плазмы.");
    // загрузим ответ
    final CmdParams params = new CmdParams();
    params.textData = boardConfig.asXML();
    try {
        send(netProperty, Uses.TASK_SAVE_BOARD_CONFIG, params);
    } catch (QException e) {
        throw new ClientException(Locales.locMes("bad_response") + "\n" + e.toString());
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:18,代码来源:NetCommander.java

示例7: getMeta

import org.dom4j.Element; //导入方法依赖的package包/类
public String getMeta (String _format) {
	Element meta = DocumentHelper.createElement ("meta");
	meta.add(this.getDataStream( _format).createCopy());
	return meta.asXML();
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:6,代码来源:DataStreamWrapper.java

示例8: createAttribute

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Create an attribute in the instanceDocument and a schemaNode for this
 *  attribute, using the attribute type if specified, or the type specified in
 *  the schema element otherwise.<p>
 *
 *  NOTE: the attribute name may not be present in the schema element for this
 *  attribute if a reference is involved.
 *
 * @param  e              schema Element representing the attribute
 * @param  parent         The parent of this attribute in the instance Document
 * @param  attrName       The attribute name
 * @param  attrType       typeName (if present) overrides type specified in
 *      schema element
 * @exception  Exception  Description of the Exception
 */
private void createAttribute(Element e, Element parent, String attrName, GlobalDef attrType) throws Exception {
	Attribute a = null;

	prtln("\nCREATE ATTRIBUTE() attrName: (" + attrName + ")", 1);
	if (attrType == null) {
		prtln("\t" + "no attrType provided");
	}
	else {
		prtln("\t ... attribute typeName - " + attrType.getQualifiedName(), 1);
		// prtln ("\t" + "attrType provided: " + attrType.toString());
	}

	/*
	 *  we don't bother qualifying the attribute unless it's name is qualified
	 */
	if (NamespaceRegistry.isQualified(attrName)) {
		// resolve prefix and create qualified attribute name
		prtln("\t attrName is qualified");
		String prefix = NamespaceRegistry.getNamespacePrefix(attrName);
		Namespace attrNS = namespaces.getNSforPrefix(prefix);
		QName qname = df.createQName(NamespaceRegistry.stripNamespacePrefix(attrName), attrNS);
		a = df.createAttribute(parent, qname, "");
	}
	else {
		a = df.createAttribute(parent, attrName, "");
	}

	prtln("\n\t attribute: " + a.asXML(), 1);
	parent.add(a);
	String xpath = getPath(a);
	SchemaNode schemaNode = null;
	GlobalDef globalDef = null;

	globalDef = getElementTypeDef(e);

	if (globalDef == null) {
		throw new Exception("createAttribute got a null globalDef for " + e.asXML());
	}
	if (attrType != null) {
		prtln("\n\t CreateAttribute() instantiating SchemaNode with explicitly provided attrTypeDef", 1);
		schemaNode = new SchemaNode(e, globalDef, xpath, schemaNodeMap, attrType);
	}
	else {
		prtln("\n\tCreateAttribute() instantiating SchemaNode with implicitly provided attrTypeDef (" +
			globalDef.getQualifiedName() + ")", 1);

		schemaNode = new SchemaNode(e, globalDef, xpath, schemaNodeMap);
	}
	schemaNodeMap.setValue(xpath, schemaNode);
	prtln("\nexiting create attribute\n------------------------\n", 1);
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:67,代码来源:StructureWalker.java

示例9: buildAppObject

import org.dom4j.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
	private void buildAppObject(Vertx vertx,WebClient webclient,AppContain appinfo, Element appNode) {

		String name = appNode.attributeValue("name");

		if (S.isBlank(name))
			return;

		
		
		boolean cutname = "true".equalsIgnoreCase(appNode.attributeValue("cutContextPath")) ? true : false;
		String timeout = appNode.attributeValue("timeout");
		String dev = appNode.attributeValue("dev");
		String circuit_maxfail = appNode.attributeValue("maxfail");
		String circuit_reset = appNode.attributeValue("resetsecond");
		String depend = appNode.attributeValue("depend");

//		System.out.println(circuit_maxfail+"  "+circuit_reset);
		
		List<Element> nodes = appNode.elements(NODE_TAG);
		List<Element> include = appNode.elements(INCLUDE_TAG);
		
		if(nodes==null || nodes.isEmpty())
			throw new NullPointerException("Tag <app> must contains at least one <node> tag. \r\n"+appNode.asXML());

		NodeStragegy ns = createNodeStrategy(appNode);
		DevModeSupport devmode = new DevModeSupport();
		
		App a = new App(vertx,webclient,name,ns,appinfo);
		a.setCutAppName(cutname);
		if (S.isNotBlank(timeout))
			a.setTimeout(Integer.parseInt(timeout));
		if("true".equals(dev))
			a.setDevmode(devmode);
		if(S.isNotBlank(circuit_maxfail))
			a.setCircuitMaxfail(Integer.parseInt(circuit_maxfail));
		if(S.isNotBlank(circuit_reset))
			a.setCircuitReset(Long.parseLong(circuit_reset)*1000);
		if(this.inside_address!=null)
			a.setInside_address(this.inside_address);
		if(S.isNotBlank(depend))
			a.setDepends(depend);

		if (nodes != null && !nodes.isEmpty()) {
			nodes.forEach(n -> {
				String host = n.attributeValue("host");
				String port = n.attributeValue("port");
				String weight = n.attributeValue("weight");				
				if(S.isBlank(weight))
					a.addNode(vertx,host, Integer.parseInt(port),1);
				else
					a.addNode(vertx,host, Integer.parseInt(port), Integer.parseInt(weight));
			});
		}

		if (include != null && !include.isEmpty()) {
			include.forEach(i -> {
				a.addRoutePath(i.attributeValue("path"));
			});
		}

		appinfo.addAppObject(a);

		log.info("[{}] route path /{} for [{}]" ,vertx.getOrCreateContext().deploymentID(), name, name);

	}
 
开发者ID:troopson,项目名称:etagate,代码行数:67,代码来源:GateSetting.java


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