如何删除由开始/结束文档方法添加的StaxEventItemWriter标记?
我在生成XML文件时默认添加,所以请任何人告诉我如何删除默认的根标记。
Ex-
<?xml version='1.0' encoding='UTF-8'?>
<root>
<ressourcespleiade date="2015-10-03 06:38:00.000">
---
---
</..>
答案 0 :(得分:0)
我结束了这样的事情:
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Imports System.IO
Public Sub createPdfFileWithAnEmptySignatureField()
Dim strOutputFilePath As String = "C:\Temp\File_ready_for_signing.pdf"
Dim strFieldName as String = "myEmptySignatureField"
Dim document As Document = New Document
Dim writer As PdfWriter
writer = PdfWriter.GetInstance(document, New FileStream(strOutputFilePath, FileMode.Create))
document.Open()
document.Add(New Paragraph("The following is an empty signature field:"))
Dim field As PdfFormField = PdfFormField.CreateSignature(writer)
field.SetWidget(New Rectangle(50, 740, 120, 780), PdfAnnotation.HIGHLIGHT_OUTLINE)
field.FieldName = strFieldName
writer.AddAnnotation(field)
document.Close()
End Sub
IMO,这不是很干净,但也不是很糟糕。这样你就可以依赖StaxEventItemWriter类的每个机制,但是不写任何根元素。