Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import XML file into XML document in extension #1298

Closed
Bobby7878 opened this issue Dec 23, 2017 · 1 comment
Closed

Import XML file into XML document in extension #1298

Bobby7878 opened this issue Dec 23, 2017 · 1 comment

Comments

@Bobby7878
Copy link

Hi,
Can anyone help me with how to import an existing xml file into a xmldocument? I have used the function xmldocument.load(path) before, but I can not use that in an extension.

thanks.

@jennisoliman
Copy link

Hi,
I have used the following code, which uses UploadIntoStream to load the xml file into an Instream, then XmlDocument.ReadFrom to read the stream into an xmldocument.
Hope it helps.

var
Tempblob : Record Tempblob;
TargetXmlDoc : XmlDocument;
XmlDec : XmlDeclaration;
begin
// Create Xml Document
TargetXmlDoc := XmlDocument.Create;
xmlDec := xmlDeclaration.Create('1.0','UTF-8','');
TargetXmlDoc.SetDeclaration(xmlDec);

// Create Instream & upload file into it               
Tempblob.blob.CreateInStream(Instr);
filename := 'Content.xml';
filepath := 'C:\Temp';
UploadIntoStream('Window Title',filepath,'',filename,Instr);

// Read stream into new xml document        
Xmldocument.ReadFrom(Instr, TargetXmlDoc); 

end

@microsoft microsoft locked and limited conversation to collaborators Apr 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants