本文整理汇总了Java中com.helger.xml.microdom.IMicroDocument类的典型用法代码示例。如果您正苦于以下问题:Java IMicroDocument类的具体用法?Java IMicroDocument怎么用?Java IMicroDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMicroDocument类属于com.helger.xml.microdom包,在下文中一共展示了IMicroDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendBodyPayloadSignedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendBodyPayloadSignedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.setPayload (DOMReader.readXMLDOM (new ClassPathResource (AS4TestConstants.TEST_PAYLOAD_XML)));
// Keystore
_setKeyStoreTestData (aClient);
// Sign specific
aClient.setCryptoAlgorithmSign (ECryptoAlgorithmSign.RSA_SHA_256);
aClient.setCryptoAlgorithmSignDigest (ECryptoAlgorithmSignDigest.DIGEST_SHA_256);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
assertTrue (MicroWriter.getNodeAsString (aDoc).contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
开发者ID:phax,项目名称:ph-as4,代码行数:17,代码来源:AS4ClientUserMessageTest.java
示例2: sendBodyPayloadSignedEncryptedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendBodyPayloadSignedEncryptedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.setPayload (DOMReader.readXMLDOM (new ClassPathResource (AS4TestConstants.TEST_PAYLOAD_XML)));
// Keystore
_setKeyStoreTestData (aClient);
// Sign specific
aClient.setCryptoAlgorithmSign (ECryptoAlgorithmSign.RSA_SHA_256);
aClient.setCryptoAlgorithmSignDigest (ECryptoAlgorithmSignDigest.DIGEST_SHA_256);
// Encrypt specific
aClient.setCryptoAlgorithmCrypt (ECryptoAlgorithmCrypt.AES_128_GCM);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
assertTrue (MicroWriter.getNodeAsString (aDoc).contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
开发者ID:phax,项目名称:ph-as4,代码行数:20,代码来源:AS4ClientUserMessageTest.java
示例3: sendOneAttachmentSignedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendOneAttachmentSignedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML_XML).getAsFile (),
CMimeType.APPLICATION_XML);
// Keystore
_setKeyStoreTestData (aClient);
// Sign specific
aClient.setCryptoAlgorithmSign (ECryptoAlgorithmSign.RSA_SHA_256);
aClient.setCryptoAlgorithmSignDigest (ECryptoAlgorithmSignDigest.DIGEST_SHA_256);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
assertTrue (MicroWriter.getNodeAsString (aDoc).contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
开发者ID:phax,项目名称:ph-as4,代码行数:18,代码来源:AS4ClientUserMessageTest.java
示例4: sendOneAttachmentEncryptedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendOneAttachmentEncryptedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML_XML).getAsFile (),
CMimeType.APPLICATION_XML);
// Keystore
_setKeyStoreTestData (aClient);
// Encrypt specific
aClient.setCryptoAlgorithmCrypt (ECryptoAlgorithmCrypt.AES_128_GCM);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
s_aLogger.info (MicroWriter.getNodeAsString (aDoc));
}
开发者ID:phax,项目名称:ph-as4,代码行数:17,代码来源:AS4ClientUserMessageTest.java
示例5: sendOneAttachmentSignedEncryptedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendOneAttachmentSignedEncryptedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML_XML).getAsFile (),
CMimeType.APPLICATION_XML);
// Keystore
_setKeyStoreTestData (aClient);
// Sign specific
aClient.setCryptoAlgorithmSign (ECryptoAlgorithmSign.RSA_SHA_256);
aClient.setCryptoAlgorithmSignDigest (ECryptoAlgorithmSignDigest.DIGEST_SHA_256);
// Encrypt specific
aClient.setCryptoAlgorithmCrypt (ECryptoAlgorithmCrypt.AES_128_GCM);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
assertTrue (MicroWriter.getNodeAsString (aDoc).contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
开发者ID:phax,项目名称:ph-as4,代码行数:21,代码来源:AS4ClientUserMessageTest.java
示例6: sendManyAttachmentSignedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendManyAttachmentSignedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML_XML).getAsFile (),
CMimeType.APPLICATION_XML);
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML2_XML).getAsFile (),
CMimeType.APPLICATION_XML);
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_TEST_IMG_JPG).getAsFile (),
CMimeType.IMAGE_JPG);
// Keystore
_setKeyStoreTestData (aClient);
// Sign specific
aClient.setCryptoAlgorithmSign (ECryptoAlgorithmSign.RSA_SHA_256);
aClient.setCryptoAlgorithmSignDigest (ECryptoAlgorithmSignDigest.DIGEST_SHA_256);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
assertTrue (MicroWriter.getNodeAsString (aDoc).contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
开发者ID:phax,项目名称:ph-as4,代码行数:22,代码来源:AS4ClientUserMessageTest.java
示例7: sendManyAttachmentEncryptedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendManyAttachmentEncryptedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML_XML).getAsFile (),
CMimeType.APPLICATION_XML);
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML2_XML).getAsFile (),
CMimeType.APPLICATION_XML);
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_TEST_IMG_JPG).getAsFile (),
CMimeType.IMAGE_JPG);
// Keystore
_setKeyStoreTestData (aClient);
// Encrypt specific
aClient.setCryptoAlgorithmCrypt (ECryptoAlgorithmCrypt.AES_128_GCM);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
assertTrue (MicroWriter.getNodeAsString (aDoc).contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
开发者ID:phax,项目名称:ph-as4,代码行数:21,代码来源:AS4ClientUserMessageTest.java
示例8: sendManyAttachmentSignedEncryptedMessageSuccessful
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void sendManyAttachmentSignedEncryptedMessageSuccessful () throws Exception
{
final AS4ClientUserMessage aClient = _getMandatoryAttributesSuccessMessage ();
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML_XML).getAsFile (),
CMimeType.APPLICATION_XML);
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_SHORTXML2_XML).getAsFile (),
CMimeType.APPLICATION_XML);
aClient.addAttachment (new ClassPathResource (AS4TestConstants.ATTACHMENT_TEST_IMG_JPG).getAsFile (),
CMimeType.IMAGE_JPG);
// Keystore
_setKeyStoreTestData (aClient);
// Sign specific
aClient.setCryptoAlgorithmSign (ECryptoAlgorithmSign.RSA_SHA_256);
aClient.setCryptoAlgorithmSignDigest (ECryptoAlgorithmSignDigest.DIGEST_SHA_256);
// Encrypt specific
aClient.setCryptoAlgorithmCrypt (ECryptoAlgorithmCrypt.AES_128_GCM);
final IMicroDocument aDoc = aClient.sendMessageAndGetMicroDocument (SERVER_URL);
assertTrue (MicroWriter.getNodeAsString (aDoc).contains (AS4TestConstants.RECEIPT_ASSERTCHECK));
}
开发者ID:phax,项目名称:ph-as4,代码行数:25,代码来源:AS4ClientUserMessageTest.java
示例9: PageSecureAllParticipants
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
public PageSecureAllParticipants (@Nonnull @Nonempty final String sID)
{
super (sID, "All participants");
m_aExportAll = addAjax ( (req, res) -> {
final IMicroDocument aDoc = new MicroDocument ();
final IMicroElement aRoot = aDoc.appendElement ("root");
final ICommonsSortedSet <IParticipantIdentifier> aAllIDs = PDMetaManager.getStorageMgr ()
.getAllContainedParticipantIDs ();
for (final IParticipantIdentifier aParticipantID : aAllIDs)
{
final String sParticipantID = aParticipantID.getURIEncoded ();
aRoot.appendElement ("item").appendText (sParticipantID);
}
res.xml (aDoc);
res.attachment ("participant-list.xml");
});
}
开发者ID:phax,项目名称:peppol-directory,代码行数:18,代码来源:PageSecureAllParticipants.java
示例10: close
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
public void close () throws IOException
{
// Get all remaining objects and save them for late reuse
final ICommonsList <IIndexerWorkItem> aRemainingWorkItems = m_aIndexerWorkQueue.stop ();
if (aRemainingWorkItems.isNotEmpty ())
{
s_aLogger.info ("Persisting " + aRemainingWorkItems.size () + " indexer work items");
final IMicroDocument aDoc = new MicroDocument ();
final IMicroElement eRoot = aDoc.appendElement (ELEMENT_ROOT);
for (final IIndexerWorkItem aItem : aRemainingWorkItems)
eRoot.appendChild (MicroTypeConverter.convertToMicroElement (aItem, ELEMENT_ITEM));
if (MicroWriter.writeToFile (aDoc, m_aIndexerWorkItemFile).isFailure ())
throw new IllegalStateException ("Failed to write IndexerWorkItems to " + m_aIndexerWorkItemFile);
}
// Unschedule the job to avoid problems on shutdown. Use the saved instance
// because GlobalQuartzScheduler.getInstance() would fail because the global
// scope is already in destruction.
m_aScheduler.unscheduleJob (m_aTriggerKey);
// Close Lucene index etc.
m_aStorageMgr.close ();
}
开发者ID:phax,项目名称:peppol-directory,代码行数:24,代码来源:PDIndexerManager.java
示例11: testExternalNoXSD
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void testExternalNoXSD ()
{
final com.helger.jaxb.mock.external.MockJAXBArchive aArc = new com.helger.jaxb.mock.external.MockJAXBArchive ();
aArc.setVersion ("1.23");
final MockExternalArchiveWriterBuilder aWriter = new MockExternalArchiveWriterBuilder ();
final Document aDoc = aWriter.getAsDocument (aArc);
assertNotNull (aDoc);
final IMicroDocument aDoc2 = aWriter.getAsMicroDocument (aArc);
assertNotNull (aDoc2);
final com.helger.jaxb.mock.external.MockJAXBArchive aArc2 = new MockExternalArchiveReaderBuilder ().read (aDoc);
assertNotNull (aArc2);
assertEquals (aWriter.getAsString (aArc), aWriter.getAsString (aArc2));
}
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:JAXBBuilderFuncTest.java
示例12: testConvertToXML
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
public void testConvertToXML ()
{
final IMicroDocument aDoc = new MicroDocument ();
final IMicroElement eRoot = aDoc.appendElement ("vatins");
for (final VATINStructure aStructure : VATINStructureManager.getAllStructures ())
{
final IMicroElement eVatin = eRoot.appendElement ("vatin");
eVatin.setAttribute ("country", aStructure.getCountry ().getCountry ());
eVatin.setAttribute ("pattern", aStructure.getPattern ());
for (final String sExample : aStructure.getExamples ())
eVatin.appendElement ("example").appendText (sExample);
}
final String sXML = MicroWriter.getNodeAsString (aDoc);
assertNotNull (sXML);
}
开发者ID:phax,项目名称:ph-masterdata,代码行数:17,代码来源:VATINStructureManagerTest.java
示例13: read
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
/**
* Read the information from the specified resource.
*
* @param aRes
* The resource to read. May not be <code>null</code>.
* @return this
*/
@Nonnull
public MimeTypeInfoManager read (@Nonnull final IReadableResource aRes)
{
ValueEnforcer.notNull (aRes, "Resource");
final IMicroDocument aDoc = MicroReader.readMicroXML (aRes);
if (aDoc == null)
throw new IllegalArgumentException ("Failed to read MimeTypeInfo resource " + aRes);
aDoc.getDocumentElement ().forAllChildElements (eItem -> {
final MimeTypeInfo aInfo = MicroTypeConverter.convertToNative (eItem, MimeTypeInfo.class);
registerMimeType (aInfo);
});
return this;
}
开发者ID:phax,项目名称:ph-commons,代码行数:23,代码来源:MimeTypeInfoManager.java
示例14: readFromResource
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Nonnull
public ISO639_2Handler readFromResource (@Nonnull final IReadableResource aRes)
{
final IMicroDocument aDoc = MicroReader.readMicroXML (aRes);
for (final IMicroElement eItem : aDoc.getDocumentElement ().getAllChildElements ("item"))
{
final String sAlpha3B = eItem.getAttributeValue ("alpha3");
final String sAlpha3T = eItem.getAttributeValue ("alpha3t");
final String sAlpha2 = eItem.getAttributeValue ("alpha2");
final String sEN = eItem.getAttributeValue ("en");
final String sFR = eItem.getAttributeValue ("fr");
final ISO639_2Item aItem = new ISO639_2Item (sAlpha3B, sAlpha3T, sAlpha2, sEN, sFR);
registerItem (aItem);
}
return this;
}
开发者ID:phax,项目名称:ph-masterdata,代码行数:17,代码来源:ISO639_2Handler.java
示例15: readMicroXML
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Nullable
public static IMicroDocument readMicroXML (@WillClose @Nullable final InputStream aIS,
@Nullable final ISAXReaderSettings aSettings)
{
if (aIS == null)
return null;
try
{
return readMicroXML (InputSourceFactory.create (aIS), aSettings);
}
finally
{
StreamHelper.close (aIS);
}
}
开发者ID:phax,项目名称:ph-commons,代码行数:17,代码来源:MicroReader.java
示例16: getWithResolvedSchematronIncludes
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
/**
* Resolve all Schematron includes of the passed resource.
*
* @param aResource
* The Schematron resource to read. May not be <code>null</code>.
* @param aSettings
* The SAX reader settings to be used. May be <code>null</code> to use
* the default settings.
* @param aErrorHandler
* The error handler to be used. May not be <code>null</code>.
* @return <code>null</code> if the passed resource could not be read as XML
* document
*/
@Nullable
public static IMicroDocument getWithResolvedSchematronIncludes (@Nonnull final IReadableResource aResource,
@Nullable final ISAXReaderSettings aSettings,
@Nonnull final IPSErrorHandler aErrorHandler)
{
final InputSource aIS = InputSourceFactory.create (aResource);
final IMicroDocument aDoc = MicroReader.readMicroXML (aIS, aSettings);
if (aDoc != null)
{
// Resolve all Schematron includes
if (_recursiveResolveAllSchematronIncludes (aDoc.getDocumentElement (),
aResource,
aSettings,
aErrorHandler).isFailure ())
{
// Error resolving includes
return null;
}
}
return aDoc;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:35,代码来源:SchematronHelper.java
示例17: writeMap
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
/**
* Write the passed map to the passed output stream using the predefined XML
* layout.
*
* @param aMap
* The map to be written. May not be <code>null</code>.
* @param aOS
* The output stream to write to. The stream is closed independent of
* success or failure. May not be <code>null</code>.
* @return {@link ESuccess#SUCCESS} when everything went well,
* {@link ESuccess#FAILURE} otherwise.
*/
@Nonnull
public static ESuccess writeMap (@Nonnull final Map <String, String> aMap, @Nonnull @WillClose final OutputStream aOS)
{
ValueEnforcer.notNull (aMap, "Map");
ValueEnforcer.notNull (aOS, "OutputStream");
try
{
final IMicroDocument aDoc = createMapDocument (aMap);
return MicroWriter.writeToStream (aDoc, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS);
}
finally
{
StreamHelper.close (aOS);
}
}
开发者ID:phax,项目名称:ph-commons,代码行数:29,代码来源:XMLMapHandler.java
示例18: writeList
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
/**
* Write the passed collection to the passed output stream using the
* predefined XML layout.
*
* @param aCollection
* The map to be written. May not be <code>null</code>.
* @param aOS
* The output stream to write to. The stream is closed independent of
* success or failure. May not be <code>null</code>.
* @return {@link ESuccess#SUCCESS} when everything went well,
* {@link ESuccess#FAILURE} otherwise.
*/
@Nonnull
public static ESuccess writeList (@Nonnull final Collection <String> aCollection,
@Nonnull @WillClose final OutputStream aOS)
{
ValueEnforcer.notNull (aCollection, "Collection");
ValueEnforcer.notNull (aOS, "OutputStream");
try
{
final IMicroDocument aDoc = createListDocument (aCollection);
return MicroWriter.writeToStream (aDoc, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS);
}
finally
{
StreamHelper.close (aOS);
}
}
开发者ID:phax,项目名称:ph-commons,代码行数:30,代码来源:XMLListHandler.java
示例19: readSchema
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
/**
* Read the schema from the resource supplied in the constructor. First all
* includes are resolved and than {@link #readSchemaFromXML(IMicroElement)} is
* called.
*
* @return The read {@link PSSchema}.
* @throws SchematronReadException
* If reading fails
*/
@Nonnull
public PSSchema readSchema () throws SchematronReadException
{
// Resolve all includes as the first action
final SAXReaderSettings aSettings = new SAXReaderSettings ().setEntityResolver (m_aEntityResolver);
final IMicroDocument aDoc = SchematronHelper.getWithResolvedSchematronIncludes (m_aResource,
aSettings,
m_aErrorHandler);
if (aDoc == null || aDoc.getDocumentElement () == null)
throw new SchematronReadException (m_aResource,
"Failed to resolve includes in Schematron resource " + m_aResource);
if (SchematronDebug.isShowResolvedSourceSchematron ())
s_aLogger.info ("Resolved source Schematron:\n" + MicroWriter.getNodeAsString (aDoc));
return readSchemaFromXML (aDoc.getDocumentElement ());
}
开发者ID:phax,项目名称:ph-schematron,代码行数:28,代码来源:PSReader.java
示例20: testSpecialCharactersXML10Text
import com.helger.xml.microdom.IMicroDocument; //导入依赖的package包/类
@Test
@Ignore ("Takes too long and was already tested with JDK 1.8 runtime parser")
public void testSpecialCharactersXML10Text ()
{
final EXMLSerializeVersion eXMLSerializeVersion = EXMLSerializeVersion.XML_10;
final XMLWriterSettings aSettings = new XMLWriterSettings ().setSerializeVersion (eXMLSerializeVersion);
for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; ++i)
if (!XMLCharHelper.isInvalidXMLTextChar (eXMLSerializeVersion, (char) i))
{
final String sText = "abc" + (char) i + "def";
assertEquals (7, sText.length ());
final IMicroDocument aDoc = new MicroDocument ();
aDoc.appendElement ("root").appendText (sText);
final String sXML = MicroWriter.getNodeAsString (aDoc, aSettings);
final IMicroDocument aDoc2 = MicroReader.readMicroXML (sXML);
assertNotNull ("Failed to read with byte " + i + "\n" + sXML, aDoc2);
assertEquals ("Length for byte " + i, i == 0 ? 6 : 7, aDoc2.getDocumentElement ().getTextContent ().length ());
assertTrue ("Difference in byte 0x" + Integer.toHexString (i), aDoc.isEqualContent (aDoc2));
}
}
开发者ID:phax,项目名称:ph-commons,代码行数:22,代码来源:MicroWriterTest.java
注:本文中的com.helger.xml.microdom.IMicroDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论