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


Java XmlOptions.setSaveSuggestedPrefixes方法代碼示例

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


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

示例1: getXmlOptions

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public XmlOptions getXmlOptions() {
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.oscarmcmaster.org/AR2005", "");
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	Map<String,String> implicitNamespaces = new HashMap<String,String>();
	implicitNamespaces.put("","http://www.oscarmcmaster.org/AR2005");
	opts.setSaveImplicitNamespaces(implicitNamespaces);
	opts.setSaveNamespacesFirst();
	opts.setCharacterEncoding("UTF-16");
	
	return opts;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:18,代碼來源:ONAREnhancedBornConnector.java

示例2: generateXMLAndValidate

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
@Test
public void generateXMLAndValidate() throws Exception {
	ARRecordSetDocument recordSetD = ARRecordSetDocument.Factory.newInstance();
	ARRecordSet recordSet = recordSetD.addNewARRecordSet();
	ARRecord arRecord = recordSet.addNewARRecord();
	AR1 ar1 = arRecord.addNewAR1();
	populateAr1(ar1);
	AR2 ar2 = arRecord.addNewAR2();
	populateAr2(ar2);
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.oscarmcmaster.org/AR2005", "");
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	ArrayList validationErrors = new ArrayList();
	XmlOptions m_validationOptions = new XmlOptions();
	m_validationOptions.setErrorListener(validationErrors);
	recordSetD.validate(m_validationOptions);
	for(Object o:validationErrors) {
		System.out.println(o);
	}
	recordSetD.save(new FileOutputStream("ar2005.xml"),opts);
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:25,代碼來源:AR2005XMLTest.java

示例3: writeXmlObject

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
/**
 * Writes the document into given stream. Removes namespace usage from SignedDoc element (Digidoc container) Amphora test
 * environment is not capable of receiving such xml
 */
private void writeXmlObject(XmlObject xmlObject, OutputStream outputStream) {
    XmlOptions options = new XmlOptions();
    options.setCharacterEncoding(DVK_MESSAGE_CHARSET);
    { // fix DigiDoc client bug (also present with PostiPoiss doc-management-system)
      // they don't accept that SignedDoc have nameSpace alias set
        options.setSavePrettyPrint();
        HashMap<String, String> suggestedPrefixes = new HashMap<String, String>(2);
        suggestedPrefixes.put("http://www.sk.ee/DigiDoc/v1.3.0#", "");
        // suggestedPrefixes.put("http://www.sk.ee/DigiDoc/v1.4.0#", "");
        options.setSaveSuggestedPrefixes(suggestedPrefixes);
    }
    try {
        xmlObject.save(outputStream, options);
        writeXmlObjectToSentDocumentsFolder(xmlObject, options);
    } catch (IOException e) {
        log.error("Writing document failed", e);
        throw new java.lang.RuntimeException(e);
    }
}
 
開發者ID:nortal,項目名稱:j-road,代碼行數:24,代碼來源:DhlXTeeServiceImpl.java

示例4: createMarkDocumentsReceivedV2AttachmentBody

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] createMarkDocumentsReceivedV2AttachmentBody(Collection<TagasisideType> receivedDocsInfos) {
    TagasisideArrayType receivedDocs = TagasisideArrayType.Factory.newInstance();
    receivedDocs.setItemArray(receivedDocsInfos.toArray(new TagasisideType[receivedDocsInfos.size()]));
    if (log.isTraceEnabled()) {
        log.trace("created markDocumentsReceivedV2 attachmentBody: " + receivedDocs);
    }
    XmlOptions options = new XmlOptions();
    options.setCharacterEncoding(DVK_MESSAGE_CHARSET);
    { // When marking documents received, with version 2
      // they don't accept that item children, such as dhl_id and fault have nameSpace prefixes set
        HashMap<String, String> suggestedPrefixes = new HashMap<String, String>(2);
        suggestedPrefixes.put("http://www.riik.ee/schemas/dhl", "");
        options.setSaveSuggestedPrefixes(suggestedPrefixes);
        options.setSaveNoXmlDecl();
    }
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {
        receivedDocs.save(bos, options);
        String s = new String(bos.toByteArray(), DVK_MESSAGE_CHARSET);
        return gzipAndEncodeString(s);
    } catch (IOException e) {
        throw new RuntimeException("Failed to create markDocumentsReceivedV2 request attachmentBody", e);
    }
}
 
開發者ID:nortal,項目名稱:j-road,代碼行數:25,代碼來源:DhlXTeeServiceImpl.java

示例5: writeXmlFile

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public static void writeXmlFile(XmlObject docObject, String targetFilePath) {

        File xmlFile = new File(targetFilePath);

        HashMap NamespaceMap = new HashMap();
        NamespaceMap.put("http://www.opengis.net/om/2.0", "om");
        NamespaceMap.put(NS_GML, "gml");
        NamespaceMap.put(NS_MET_BASIC, "");
        NamespaceMap.put(NS_OPM, "");
        NamespaceMap.put(NS_METCE, "metce");
        NamespaceMap.put(NS_SAF, "saf");
        NamespaceMap.put(NS_IWXXM, "");
        NamespaceMap.put(NS_XS, "");
        NamespaceMap.put(NS_SAMS, "sams");
        NamespaceMap.put(NS_SAM, "sam");


        XmlOptions xmlOptions = new XmlOptions();
        xmlOptions.setSavePrettyPrint();
        xmlOptions.setSaveSuggestedPrefixes(NamespaceMap);
        xmlOptions.setSaveAggressiveNamespaces();
        xmlOptions.setUseDefaultNamespace();


        try {
            docObject.save(xmlFile, xmlOptions);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 
開發者ID:saeidrastak,項目名稱:IWXXMConverter,代碼行數:31,代碼來源:CommonUtils.java

示例6: generateXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateXml(LoggedInInfo loggedInInfo, Integer demographicNo, Integer rourkeFdid, Integer nddsFdid, Integer report18mFdid, boolean useClinicInfoForOrganizationId) {
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;
	
	BORN18MFormToXML xml = new BORN18MFormToXML(demographicNo);
	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		//pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addXmlToStream(loggedInInfo, pw, opts, rourkeFdid, nddsFdid, report18mFdid, useClinicInfoForOrganizationId);
		
		pw.close();
		if (xmlCreated) return os.toByteArray();
	}
	catch(Exception e) {
		logger.warn("Unable to add record",e);
	}
	
	return null;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:30,代碼來源:BORN18MConnector.java

示例7: generateXMLAndValidate

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public void generateXMLAndValidate(LoggedInInfo loggedInInfo, OutputStream os, String providerNo,String demographicNo, int formId, int episodeId) throws Exception {
	this.demographicNo = demographicNo;
	this.providerNo = providerNo;
	this.formId = formId;
	this.episodeId = episodeId;
	FrmRecord rec = (new FrmRecordFactory()).factory("ONAREnhanced");
    props = rec.getFormRecord(loggedInInfo, Integer.parseInt(demographicNo), formId);

	ARRecordSetDocument recordSetD = ARRecordSetDocument.Factory.newInstance();
	ARRecordSet recordSet = recordSetD.addNewARRecordSet();
	ARRecord arRecord = recordSet.addNewARRecord();
	AR1 ar1 = arRecord.addNewAR1();
	populateAr1(ar1,providerNo);
	AR2 ar2 = arRecord.addNewAR2();
	populateAr2(ar2);
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.oscarmcmaster.org/AR2005", "");
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	ArrayList validationErrors = new ArrayList();
	XmlOptions m_validationOptions = new XmlOptions();
	m_validationOptions.setErrorListener(validationErrors);
	recordSetD.validate(m_validationOptions);
	for(Object o:validationErrors) {
		MiscUtils.getLogger().warn(o);
	}
	recordSetD.save(os,opts);
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:31,代碼來源:ONAREnhancedFormToXML.java

示例8: generateWBCSDXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateWBCSDXml(BORNWbCsdXmlGenerator xml, Integer demographicNo) {
	HashMap<String, String> suggestedPrefixes = new HashMap<String, String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;

	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		//pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addToStream(pw, opts, demographicNo, true);

		pw.close();
		if (xmlCreated) return os.toByteArray();
	} catch (Exception e) {
		logger.warn("Unable to add record", e);
	}

	return null;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:28,代碼來源:BORNWBCSDJob.java

示例9: generateWBXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateWBXml(BORNWbXmlGenerator xml, Integer demographicNo) {
	HashMap<String, String> suggestedPrefixes = new HashMap<String, String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;

	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		//pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addToStream(pw, opts, true);

		pw.close();
		if (xmlCreated) return os.toByteArray();
	} catch (Exception e) {
		logger.warn("Unable to add record", e);
	}

	return null;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:28,代碼來源:BORNWBJob.java

示例10: getDefaultOptions

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public static XmlOptions getDefaultOptions() {
	XmlOptions options = new XmlOptions();
	options.put(XmlOptions.SAVE_PRETTY_PRINT);
	options.put(XmlOptions.SAVE_PRETTY_PRINT_INDENT, 3);
	options.put(XmlOptions.SAVE_AGGRESSIVE_NAMESPACES);

	HashMap<String, String> suggestedPrefix = new HashMap<String, String>();
	suggestedPrefix.put("cds_dt", "cdsd");
	options.setSaveSuggestedPrefixes(suggestedPrefix);
	options.setSaveOuter();
	return options;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:13,代碼來源:DemographicExportHelper.java

示例11: create

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
static public void create(DemographicsDocument.Demographics demographic, List<ReportsReceivedDocument.ReportsReceived> reports, String filepath) {

        OmdCdsDocument omdCdsDoc = OmdCdsDocument.Factory.newInstance();
        OmdCds omdCds = omdCdsDoc.addNewOmdCds();
        PatientRecord patientRecord = omdCds.addNewPatientRecord();

        Demographics HRMdemo = patientRecord.addNewDemographics();

        writeDemographics(demographic, HRMdemo);
        writeReportsReceived(reports, patientRecord);

	XmlOptions options = new XmlOptions();
	options.put( XmlOptions.SAVE_PRETTY_PRINT );
	options.put( XmlOptions.SAVE_PRETTY_PRINT_INDENT, 3 );
	options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES );

        HashMap<String,String> suggestedPrefix = new HashMap<String,String>();
        suggestedPrefix.put("cds_dt","cdsd");
        options.setSaveSuggestedPrefixes(suggestedPrefix);
	options.setSaveOuter();

        File file = new File(filepath);
        try {
            omdCdsDoc.save(file, options);
        } catch (IOException ex) {
            Logger.getLogger(CreateHRMFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:29,代碼來源:CreateHRMFile.java

示例12: getXmlOptions

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
public static XmlOptions getXmlOptions() {
    XmlOptions xmlOptions = new XmlOptions();
    //xmlOptions.setUseDefaultNamespace();
    HashMap<String, String> ns = new HashMap<String, String>();
    //ns.put("urn:mpeg:DASH:schema:MPD:2011", "");
    ns.put("urn:mpeg:cenc:2013", "cenc");
    ns.put("urn:mpeg:drmtdoday:cenc:2014", "drmtoday");
    ns.put("urn:microsoft:playready", "mspr");
    xmlOptions.setSaveSuggestedPrefixes(ns);
    xmlOptions.setSaveAggressiveNamespaces();
    xmlOptions.setUseDefaultNamespace();
    xmlOptions.setSavePrettyPrint();
    return xmlOptions;
}
 
開發者ID:castlabs,項目名稱:dashencrypt,代碼行數:15,代碼來源:ManifestHelper.java

示例13: getOptions

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private XmlOptions getOptions() {
    HashMap<String, String> map = new HashMap<String, String>();
    map.put(NAMESPACE, NAMESPACE_PREFIX);
    XmlOptions options = new XmlOptions();
    options.setSaveAggressiveNamespaces();
    options.setSavePrettyPrint();
    options.setSaveSuggestedPrefixes(map);
    return options;
}
 
開發者ID:52North,項目名稱:uncertml-api,代碼行數:10,代碼來源:XMLEncoder.java

示例14: saveDocumentImpl

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
@Override
protected void saveDocumentImpl(CdwaliteWrapDocument cdwaliteWrapDocument,
        OutputStream out) throws IOException {
    XmlOptions xmlOptions = new XmlOptions();
    HashMap<String, String> namespaceMap = new HashMap<String, String>();
    namespaceMap.put(CDWALITE_NS_URI, CDWALITE_NS_PREFIX);
    xmlOptions.setSaveSuggestedPrefixes(namespaceMap);
    xmlOptions.setSavePrettyPrint();
    xmlOptions.setValidateStrict();
    addSchemaLocation(cdwaliteWrapDocument);
    cdwaliteWrapDocument.save(out, xmlOptions);
}
 
開發者ID:moosbusch,項目名稱:xbCDWALite,代碼行數:13,代碼來源:DefaultCdwaLiteXmlDocument.java

示例15: generateXml

import org.apache.xmlbeans.XmlOptions; //導入方法依賴的package包/類
private byte[] generateXml(Integer demographicNo, Integer rourkeFdid, Integer nddsFdid, Integer report18mFdid) {
	HashMap<String,String> suggestedPrefixes = new HashMap<String,String>();
	suggestedPrefixes.put("http://www.w3.org/2001/XMLSchema-instance","xsi");
	XmlOptions opts = new XmlOptions();
	opts.setSaveSuggestedPrefixes(suggestedPrefixes);
	opts.setSavePrettyPrint();
	opts.setSaveNoXmlDecl();
	opts.setUseDefaultNamespace();
	opts.setSaveNamespacesFirst();
	ByteArrayOutputStream os = null;
	PrintWriter pw = null;
	boolean xmlCreated = false;
	
	BORN18MFormToXML xml = new BORN18MFormToXML(demographicNo);
	try {
		os = new ByteArrayOutputStream();
		pw = new PrintWriter(os, true);
		pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xmlCreated = xml.addXmlToStream(pw, opts, rourkeFdid, nddsFdid, report18mFdid);
		
		pw.close();
		if (xmlCreated) return os.toByteArray();
	}
	catch(Exception e) {
		logger.warn("Unable to add record",e);
	}
	
	return null;
}
 
開發者ID:oscarservice,項目名稱:oscar-old,代碼行數:30,代碼來源:BORN18MConnector.java


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