Adding Sources to CustomXMLParts

Is there any Java Friendly way of adding Sources to the CustomXmlParts?

I want to add a source (ie Author, Website, Date Visited etc) to a document. The CustomXmlPart seems very sparse in functionality and only allows a byte array. I’ve added a source in a document and viewed the item1.xml file and the structure is fairly straight forward.

<b:Source>
<b:Tag>Ref01</b:Tag>
<b:SourceType>InternetSite</b:SourceType>
<b:Guid>{86E1A0BA-61C7-4272-96A0-D3E1E2BD5E51}</b:Guid>
<b:Author>
<b:Author>
<b:NameList>
<b:Person>
<b:Last>Surname</b:Last>
<b:First>FirstName</b:First>
</b:Person>
</b:NameList>
</b:Author>
</b:Author>
<b:Title>http://www.example.com</b:Title>
<b:InternetSiteTitle>Acme Corp</b:InternetSiteTitle>
<b:Year>2017</b:Year>
<b:Month>08</b:Month>
<b:Day>17</b:Day>
<b:URL>http://www.example.com</b:URL>
<b:RefOrder>1</b:RefOrder>
</b:Source>

There seems to be no API within Aspose Words to do this, so is the only alternative to do this using an XML Library, converting it to a byte array and then using the setData() method?

Best Regards,

@byb39,

Thanks for your inquiry. Yes, you understanding is correct. Please use Document.CustomXmlParts property to get or set the collection of Custom XML Data Storage Parts. You can use CustomXmlPart.Data property to get or set the XML content of this Custom XML Data Storage Part. There is no alternative way to set XML content to Custom XML Data Storage.

Please let us know if you have any more queries.