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


Java XMLStreamWriter.writeEmptyElement方法代碼示例

本文整理匯總了Java中javax.xml.stream.XMLStreamWriter.writeEmptyElement方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLStreamWriter.writeEmptyElement方法的具體用法?Java XMLStreamWriter.writeEmptyElement怎麽用?Java XMLStreamWriter.writeEmptyElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.stream.XMLStreamWriter的用法示例。


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

示例1: exportParameters

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Extracts and exports normal parameters
 * 
 * @param writer Writer object
 * @param ob Object 
 * @throws XMLStreamException 
 */
static void exportParameters(XMLStreamWriter writer,
		Object ob) throws XMLStreamException {
	Method[] mets = ob.getClass().getMethods();
	for(Method m : mets) {
		//lookup if the Method is marked as ExchangeParameter and NOT a setter
		ExchangeParameter ep = m.getAnnotation(ExchangeParameter.class);
		if(ep != null && m.getName().contains("get")) {
			writer.writeEmptyElement("Parameter");
			String paramName = m.getName().substring(3);
			SimpleEntry<String, String> se = exportParamType(ob, m.getName());
			writer.writeAttribute("name", paramName);
			writer.writeAttribute("type", se.getKey());
			writer.writeAttribute("value", se.getValue());
		}
	}
	
}
 
開發者ID:KeepTheBeats,項目名稱:alevin-svn2,代碼行數:25,代碼來源:XMLExporter.java

示例2: exportConstructParameters

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Extracts and write out the AdditionalConstructionParameters to the writer
 * 
 * @param writer Given Writer
 * @param ob Object with annotations from AdditionalConstructParameter.class
 * @throws XMLStreamException 
 */
static void exportConstructParameters(XMLStreamWriter writer,
		Object ob) throws XMLStreamException {
	//Get the Construction Parameters
	AdditionalConstructParameter acp = ob.getClass().getAnnotation(AdditionalConstructParameter.class);
	if(acp != null) {
		for(int i = 0; i < acp.parameterGetters().length; i++) {
			writer.writeEmptyElement("ConstructParameter");
			writer.writeAttribute("name", acp.parameterNames()[i]);
			SimpleEntry<String, String> se = exportParamType(ob, acp.parameterGetters()[i]);
			writer.writeAttribute("type", se.getKey());
			writer.writeAttribute("value", se.getValue());
		}
	}
	
	
}
 
開發者ID:KeepTheBeats,項目名稱:alevin-svn2,代碼行數:24,代碼來源:XMLExporter.java

示例3: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {
  for (Equipment contains_Equipments : this.contains_Equipments){
           try {
             xmlsw.writeEmptyElement(CIMURI.CIMURI,"EquipmentContainer.Contains_Equipments");
             xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                       + contains_Equipments.getId());
           } catch (XMLStreamException e) {
             StringBuilder errorMessage = new StringBuilder(
                                "Error while trying to write the reference to ");
             errorMessage.append("EquipmentContainer ");
             errorMessage.append("which ID has been initialized to : ");
             errorMessage.append(getId());
             errorMessage.append(" in the subset ");
             errorMessage.append("${subsetModel.getSubset($class).getName()}");
             LOGGER.error(errorMessage.toString());
             LOGGER.error(e.toString(), e);
           }
  }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:31,代碼來源:EquipmentContainer.java

示例4: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {
  for (SubGeographicalRegion regions : this.regions){
           try {
             xmlsw.writeEmptyElement(CIMURI.CIMURI,"GeographicalRegion.Regions");
             xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                       + regions.getId());
           } catch (XMLStreamException e) {
             StringBuilder errorMessage = new StringBuilder(
                                "Error while trying to write the reference to ");
             errorMessage.append("GeographicalRegion ");
             errorMessage.append("which ID has been initialized to : ");
             errorMessage.append(getId());
             errorMessage.append(" in the subset ");
             errorMessage.append("Equipment");
             LOGGER.error(errorMessage.toString());
             LOGGER.error(e.toString(), e);
           }
  }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:31,代碼來源:GeographicalRegion.java

示例5: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {
  for (TopologicalNode topologicalNode : this.topologicalNode){
           try {
             xmlsw.writeEmptyElement(CIMURI.CIMURI,"ConnectivityNodeContainer.TopologicalNode");
             xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                       + topologicalNode.getId());
           } catch (XMLStreamException e) {
             StringBuilder errorMessage = new StringBuilder(
                                "Error while trying to write the reference to ");
             errorMessage.append("ConnectivityNodeContainer ");
             errorMessage.append("which ID has been initialized to : ");
             errorMessage.append(getId());
             errorMessage.append(" in the subset ");
             errorMessage.append("${subsetModel.getSubset($class).getName()}");
             LOGGER.error(errorMessage.toString());
             LOGGER.error(e.toString(), e);
           }
  }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:31,代碼來源:ConnectivityNodeContainer.java

示例6: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {
  for (SynchronousMachine initiallyUsedBySynchronousMachine : this.initiallyUsedBySynchronousMachine){
           try {
             xmlsw.writeEmptyElement(CIMURI.CIMURI,"ReactiveCapabilityCurve.InitiallyUsedBySynchronousMachine");
             xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                       + initiallyUsedBySynchronousMachine.getId());
           } catch (XMLStreamException e) {
             StringBuilder errorMessage = new StringBuilder(
                                "Error while trying to write the reference to ");
             errorMessage.append("ReactiveCapabilityCurve ");
             errorMessage.append("which ID has been initialized to : ");
             errorMessage.append(getId());
             errorMessage.append(" in the subset ");
             errorMessage.append("Equipment");
             LOGGER.error(errorMessage.toString());
             LOGGER.error(e.toString(), e);
           }
  }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:31,代碼來源:ReactiveCapabilityCurve.java

示例7: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {
  for (CurveData curveScheduleDatas : this.curveScheduleDatas){
           try {
             xmlsw.writeEmptyElement(CIMURI.CIMURI,"Curve.CurveScheduleDatas");
             xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                       + curveScheduleDatas.getId());
           } catch (XMLStreamException e) {
             StringBuilder errorMessage = new StringBuilder(
                                "Error while trying to write the reference to ");
             errorMessage.append("Curve ");
             errorMessage.append("which ID has been initialized to : ");
             errorMessage.append(getId());
             errorMessage.append(" in the subset ");
             errorMessage.append("${subsetModel.getSubset($class).getName()}");
             LOGGER.error(errorMessage.toString());
             LOGGER.error(e.toString(), e);
           }
  }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:31,代碼來源:Curve.java

示例8: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {
  for (TransformerWinding contains_TransformerWindings : this.contains_TransformerWindings){
           try {
             xmlsw.writeEmptyElement(CIMURI.CIMURI,"PowerTransformer.Contains_TransformerWindings");
             xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                       + contains_TransformerWindings.getId());
           } catch (XMLStreamException e) {
             StringBuilder errorMessage = new StringBuilder(
                                "Error while trying to write the reference to ");
             errorMessage.append("PowerTransformer ");
             errorMessage.append("which ID has been initialized to : ");
             errorMessage.append(getId());
             errorMessage.append(" in the subset ");
             errorMessage.append("Equipment");
             LOGGER.error(errorMessage.toString());
             LOGGER.error(e.toString(), e);
           }
  }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:31,代碼來源:PowerTransformer.java

示例9: writeCurrentLimits

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
public static void writeCurrentLimits(Integer index, CurrentLimits limits, XMLStreamWriter writer, String nsUri) throws XMLStreamException {
    if (!Float.isNaN(limits.getPermanentLimit())
        || !limits.getTemporaryLimits().isEmpty()) {
        if (limits.getTemporaryLimits().isEmpty()) {
            writer.writeEmptyElement(nsUri, CURRENT_LIMITS + indexToString(index));
        } else {
            writer.writeStartElement(nsUri, CURRENT_LIMITS + indexToString(index));
        }
        XmlUtil.writeFloat("permanentLimit", limits.getPermanentLimit(), writer);
        for (CurrentLimits.TemporaryLimit tl : limits.getTemporaryLimits()) {
            writer.writeEmptyElement(IIDM_URI, "temporaryLimit");
            writer.writeAttribute("name", tl.getName());
            XmlUtil.writeOptionalInt("acceptableDuration", tl.getAcceptableDuration(), Integer.MAX_VALUE, writer);
            XmlUtil.writeOptionalFloat("value", tl.getValue(), Float.MAX_VALUE, writer);
            XmlUtil.writeOptionalBoolean("fictitious", tl.isFictitious(), false, writer);
        }
        if (!limits.getTemporaryLimits().isEmpty()) {
            writer.writeEndElement();
        }
    }
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:22,代碼來源:AbstractConnectableXml.java

示例10: handleMessage

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
@SuppressWarnings("nls")
@Override
public void handleMessage(SoapMessage message) throws Fault
{
	final UserState us = CurrentUser.getUserState();
	XMLStreamWriterCallback obj = new XMLStreamWriterCallback()
	{
		@Override
		public void write(XMLStreamWriter writer) throws Fault, XMLStreamException
		{
			writer.writeEmptyElement("equella");
			writer.writeAttribute("session", us.getSessionID());
			writer.writeAttribute("id", us.getUserBean().getUniqueID());
			writer.writeAttribute("username", us.getUserBean().getUsername());

		}
	};

	message.getHeaders().add(new Header(new QName("equella"), obj, new StaxDataBinding()));
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:21,代碼來源:TokenHeaderOutInterceptor.java

示例11: exportMappings

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * This Method exports the Mappings
 * 
 * @param writer WriterObject
 * @param ad Demand
 * @throws XMLStreamException 
 */
static void exportMappings(XMLStreamWriter writer, AbstractDemand ad) throws XMLStreamException {
	for(Mapping map : ad.getMappings()) {
		String type = map.getResource().getClass().getSimpleName();
		long entityID = map.getResource().getOwner().getId();
		
		writer.writeEmptyElement("Mapping");
		writer.writeAttribute("resourceType", type);
		writer.writeAttribute("substrateEntity", entityID+"");
	}
	
}
 
開發者ID:KeepTheBeats,項目名稱:alevin-svn2,代碼行數:19,代碼來源:XMLExporter.java

示例12: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {

/*
 * Careful here : we may write an association "twice" if
 * the association is 1..1 one and if
 * both ends belong to the same subset
 */

    if (idFossilFuels != null &&
            !idFossilFuels.isEmpty()) {

        try {
            // xmlsw.writeCharacters("\t");
            xmlsw.writeEmptyElement(CIMURI.CIMURI,
                    "ThermalGeneratingUnit.FossilFuels");
            xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                    + idFossilFuels);
            // xmlsw.writeCharacters("\n");
        } catch(XMLStreamException e) {
            StringBuilder errorMessage = new StringBuilder(
                    "Error while trying to write the resource attribute ");
            errorMessage.append("FossilFuels");
            errorMessage.append(" in class ");
            errorMessage.append("ThermalGeneratingUnit ");
            errorMessage.append("which ID has been initialized to : ");
            errorMessage.append(getId());
            LOGGER.error(errorMessage.toString());
            LOGGER.error(e.toString(), e);
        }
    }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:43,代碼來源:ThermalGeneratingUnit.java

示例13: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {
    if (idLoadResponse != null) {
        try {
            // xmlsw.writeCharacters("\t");
            xmlsw.writeEmptyElement(CIMURI.CIMURI,
                    "EnergyConsumer.LoadResponse");
            xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                    + idLoadResponse);
            // xmlsw.writeCharacters("\n");
        } catch(XMLStreamException e) {
            StringBuilder errorMessage = new StringBuilder(
                    "Error while trying to write the resource attribute ");
            errorMessage.append("LoadResponse");
            errorMessage.append(" in class ");
            errorMessage.append("EnergyConsumer ");
            errorMessage.append("which ID has been initialized to : ");
            errorMessage.append(getId());
            LOGGER.error(errorMessage.toString());
            LOGGER.error(e.toString(), e);
        }
    }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:34,代碼來源:EnergyConsumer.java

示例14: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {

/*
 * Careful here : we may write an association "twice" if
 * the association is 1..1 one and if
 * both ends belong to the same subset
 */

    if (idVoltageControlZone != null &&
            !idVoltageControlZone.isEmpty()) {

        try {
            // xmlsw.writeCharacters("\t");
            xmlsw.writeEmptyElement(CIMURI.CIMURI,
                    "BusbarSection.VoltageControlZone");
            xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                    + idVoltageControlZone);
            // xmlsw.writeCharacters("\n");
        } catch(XMLStreamException e) {
            StringBuilder errorMessage = new StringBuilder(
                    "Error while trying to write the resource attribute ");
            errorMessage.append("VoltageControlZone");
            errorMessage.append(" in class ");
            errorMessage.append("BusbarSection ");
            errorMessage.append("which ID has been initialized to : ");
            errorMessage.append(getId());
            LOGGER.error(errorMessage.toString());
            LOGGER.error(e.toString(), e);
        }
    }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:43,代碼來源:BusbarSection.java

示例15: writeClass

import javax.xml.stream.XMLStreamWriter; //導入方法依賴的package包/類
/**
 * Utility to return the content of this class into the CIM XML format
 *
 * @param xmlsw
 *            the stream in which are stored the elements to write
 */
private void writeClass(XMLStreamWriter xmlsw) {

    if (currentBitset.get(0)) {

/*
 * Careful here : we may write an association "twice" if
 * the association is 1..1 one and if
 * both ends belong to the same subset
 */

    if (idDrivenBy_SynchronousMachine != null &&
            !idDrivenBy_SynchronousMachine.isEmpty()) {

        try {
            // xmlsw.writeCharacters("\t");
            xmlsw.writeEmptyElement(CIMURI.CIMURI,
                    "HydroPump.DrivenBy_SynchronousMachine");
            xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#"
                    + idDrivenBy_SynchronousMachine);
            // xmlsw.writeCharacters("\n");
        } catch(XMLStreamException e) {
            StringBuilder errorMessage = new StringBuilder(
                    "Error while trying to write the resource attribute ");
            errorMessage.append("DrivenBy_SynchronousMachine");
            errorMessage.append(" in class ");
            errorMessage.append("HydroPump ");
            errorMessage.append("which ID has been initialized to : ");
            errorMessage.append(getId());
            LOGGER.error(errorMessage.toString());
            LOGGER.error(e.toString(), e);
        }
    }
    }

    return;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:43,代碼來源:HydroPump.java


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