Notifications
Announcements
No record found.
Hey team,
I want to deserialize an XML file and extract the file name through x . Which function can I use to deserialize the XML file to extract the file name? I saw an example but it uses a function which is dependent on Form Class which I don't want. Please can you help me with my issue.
Example I saw:
var classImported = FormRunConfigurationClass::deserialize(file, docuvalue.FileName);
Hi skd,
Do you want to deserialize XML file stored in document management to extract some values from the content?
Hey Sergei Minozhenko,
The XML file is stored in the Docuref table.
The code I referred to read the selected XML file from DocuRef and DocuValue Table. Now I want to deserialize the XML file to get the file name. How can I get it via x ?
XmlDocument xmlDoc = new XmlDocument(); Filename filepath; Filename filename; Filename fileType; str fileNameString; DocuRef docuref; DocuValue docuvalue; select firstonly docuref where docuref.recId == _docuRef.RecId join docuvalue where docuvalue.recid == docuref.ValueRecId; DocuAction act = docuref.docuAction(); System.IO.StreamReader sr = new System.IO.StreamReader(act.getStream(docuref)); str file = sr.ReadToEnd();
You can use XMLDocument class to deserialize XML and find elements you are interested in.
XmlDocument xmlDoc = XmlDocument::newFromStream(DocumentManagement::getAttachmentStream(docuRef));
www.axaptapedia.com/XMLDocument_class
By using this I'm not able to fetch my docs. It is throwing null exception. Please can you guide me as what have I done wrong. I simply want to read the XML file and fetch and the Owner(File) name.
This is how I wrote my code:
Filename filepath; Filename filename; Filename fileType; str fileNameString; DocuRef docuref; DocuValue docuvalue; Description name; XmlElement OwnerValue; XmlNode xmlNode; while select * from docuref where docuref.RefTableId == 17136 join docuvalue where docuvalue.recid == docuref.ValueRecId { XmlDocument xmlDoc = XmlDocument::newFromStream(DocumentManagement::getAttachmentStream(docuRef)); xmlNode = xmlDoc.getNamedElement('OwnerValue'); info(strFmt("Owner Name: %1", xmlNode.nodeValue())); }
my XML File:
First, you need to find "FormRunConfigurationSerializer" element and in the found element, you need to find "OwnerValue" element
xmlNode = xmlDoc.getNamedElement('FormRunConfigurationSerializer').getNamedElement('OwnerValue');
Also, use "text" method to get element value. NodeValue returns null for element node types.
info(strFmt("Owner Name: %1", xmlNode.text()));
Thank you so much. It worked for me.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader