Познакомьтесь с пентестом веб-приложений на практике в нашем новом бесплатном курсе
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
'Open xml file named after current database
Dim stream As NotesStream
Set stream = session.CreateStream
filename$ = "c:\dxl\" + Left(db.FileName, Len(db.FileName) - 4) + "_documents.xml"
If Not stream.Open(filename$) Then
Messagebox "Cannot open " + filename$ + ". Check to make sure this directory exists.",, "Error"
Exit Sub
End If
Call stream.Truncate
'Build a NoteCollection to limit the export file to documents
Dim nc As NotesNoteCollection
Set nc = db.CreateNoteCollection(False)
nc.SelectDocuments=True
Call nc.BuildCollection
'Export current database as DXL
Dim exporter As NotesDXLExporter
Set exporter = session.CreateDXLExporter(nc, stream)
exporter.OutputDOCTYPE = False
Call exporter.Process
<?xml version='1.0' encoding='utf-8'?><database xmlns="http://www.lotus.com/dxl" version="7.0" maintenanceversion="3.0" replicaid="85256C9B00734E32" path="xml\dxl_helloworld.nsf" title="DXL Hello World"><datamodified><datetime>20091109T135057,72+03</datetime>
</datamodified>
<designmodified><datetime>20091109T135046,08+03</datetime>
</designmodified>
<document form="Hello"><created><datetime>20021226T160225,33-05</datetime>
</created>
<modified><datetime>20021226T160227,63-05</datetime>
</modified>
<revised><datetime>20021226T160227,62-05</datetime>
</revised>
<lastaccessed><datetime>20021226T160227,62-05</datetime>
</lastaccessed>
<addedtofile><datetime>20021226T160227,62-05</datetime>
</addedtofile>
<name>CN=David DeJean/O=DeJean</name>
<item name="HelloData"><text>Hello World.</text>
</item>
</document>
<document form="Hello"><created><datetime>20091109T135048,49+03</datetime>
</created>
<modified><datetime>20091109T135057,72+03</datetime>
</modified>
<revised><datetime>20091109T135057,71+03</datetime>
</revised>
<lastaccessed><datetime>20091109T135057,71+03</datetime>
</lastaccessed>
<addedtofile><datetime>20091109T135057,71+03</datetime>
</addedtofile>
<name>CN=admin/O=melenki</name>
<item name="HelloData"><text>Hello World.</text>
</item>
<item name="Body"><richtext><pardef id="1"></pardef>
<par def="1"><attachmentref name="3054-0134.pdf" displayname="3054-0134.pdf"><picture height="47px" width="77px"><notesbitmap>
lQAmAAAAAAAAAAAAAAABAAAAAAAAAE0ALwAIAAEACAABAIAAAwCWAA8GAAAAAAAAAAAAAC8A/QVA
CQDFAEADAMcAzQYBI0AEAEADAMcAAQLDAMQBwwsEEwYTK0ADAMcAQAIAxgDCOwFGw0kBRsI7AWDC
XwZ1XXRzcVvCWsJZAS/CBkADAMYAQAIAxgACRj3DHMI9wksBf8JHA3sxOsI5CV4kMCEYKlcLBkAD
<Убрано из-за экономии места>
FWMVZBV8FToVSjleJDAhWCMXGwEbK0ADAMMAQAIAxgACWzrDMQF9whUGNEoVOhRKwhQBNMIwwiEI
bwYvEwABGytAAwDCAEACAMYAARjDJANFYRTCRQdhFHgUJBR5wiHDHwlCLAJXFy8rEyNAAwABAEAC
AwBTAFAAQQBDAEUAAAAICAgICAgICAUArX0FALV+BAARLAQADz4CAgICAgICAgAAAAAHAAAAAAAA
AAQAAgA=
</notesbitmap>
</picture>
</attachmentref>
</par>
</richtext>
</item>
<item name="$FILE" summary="true" sign="true" seal="true"><object><file hosttype="msdos" compression="none" flags="sign storedindoc" encoding="none" name="3054-0134.pdf" desiredcompression="huffman"><created><datetime>20091102T131934,73+03</datetime>
</created>
<modified><datetime>20091102T131935,62+03</datetime>
</modified>
<filedata>
JVBERi0xLjINJeLjz9MNCjQ0IDAgb2JqDTw8IC9MaW5lYXJpemVkIDEgDS9MIDM1MDgyNiANL0gg
WyA3NTIgMjE2IF0gDS9PIDQ3IA0vRSAxMDk5NyANL04gNiANL1QgMzQ5OTAyIA0+PiANZW5kb2Jq
MDAwMDAwMTE5NiAwMDAwMCBuDQowMDAwMDAxMzE4IDAwMDAwIG4NCjAwMDAwMDEzMzggMDAwMDAg
<Убрано из-за экономии места>
<Тут сам файл в нативном виде>
DQowMDAwMzQ2Njg0IDAwMDAwIG4NCjAwMDAzNDY3MDYgMDAwMDAgbg0KMDAwMDM0OTg3MCAwMDAw
MCBuDQp0cmFpbGVyDTw8DS9TaXplIDQ0DT4+DXN0YXJ0eHJlZg0xNzMNJSVFT0YN
</filedata>
</file>
</object>
</item>
</document>
</database>
желательно так как оно там есть?
import lotus.domino.*;
import org.w3c.dom.*;
public class JavaAgent extends AgentBase {
public void NotesMain()
{
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
lotus.domino.Document inDoc =
agentContext.getDocumentContext();
[b] // Parse the XML body of the mail message.
RichTextItem inBody = (RichTextItem)
inDoc.getFirstItem("Body");
org.w3c.dom.Document inDom = inBody.parseXML(false);[/b]
// Call the item shredder and Save the result
shredXML(inDom.getDocumentElement(), inDoc);
inDoc.save();
} catch (Exception e) {
if (e instanceof NotesException)
{
System.err.println(((NotesException)e).text);
}
e.printStackTrace();
}
}
//Convert an XML DOM tree into a set of items on a document.
// Each child of the given Node is turned into an item named
// after the element.
private void shredXML(Node n, lotus.domino.Document doc)
throws lotus.domino.NotesException
{
for(Children cTop = new Children(n); cTop.hasMoreNodes(); ) {
Node node = cTop.nextChild();
if (node.getNodeType() == Node.ELEMENT_NODE) {
doc.appendItemValue(node.getNodeName(),
getChildrenText(node));
}
}
}
// A DOM helper method to collect up all of the text content
// for a node. All of the children (and children of children,
// and ...) are examined, and all of the text is concatenated
// together.
private String getChildrenText(Node n)
{
String text = "";
for(Children c = new Children(n); c.hasMoreNodes(); ) {
Node child = c.nextChild();
switch (child.getNodeType()) {
case Node.DOCUMENT_NODE:
case Node.ELEMENT_NODE:
// For an element or document root, recur on the children
// of the node.
text += getChildrenText(child);
break;
case Node.TEXT_NODE:
case Node.CDATA_SECTION_NODE:
// For text content or CDATA nodes, append the content.
text += child.getNodeValue();
break;
}
}
return text;
}
}
// A helper class for the DOM: an iterator over the children
// of a node.
import org.w3c.dom.*;
public class Children {
private NodeList nodelist;
private int i;
private int numChildren;
// Construct a Children from a Node.
public Children(Node n)
{
nodelist = n.getChildNodes();
if (nodelist == null) {
numChildren = 0;
}
else {
numChildren = nodelist.getLength();
}
i = 0;
}
// Are there any more children, or have we used them all?
public boolean hasMoreNodes()
{
return i < numChildren;
}
// Return the next child.
public Node nextChild()
{
if (i >= numChildren) {
return null;
}
return nodelist.item(i++);
}
}
уточняю задачу нужно для клиента от 6.5 и дальшеВ восьмёрке у DXLExporter'а можно зарестриктить какие айтемы экспортировать, так что вполне возможно экспортнуть только один айтем.
Обучение наступательной кибербезопасности в игровой форме. Начать игру!