Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1088713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:06:37+00:00 2026-05-16T23:06:37+00:00

I’m encoding a document to attach as a base64 encoded element inside an xml

  • 0

I’m encoding a document to attach as a base64 encoded element inside an xml document for transmission. It’s easy enough, I just slurp the entire file into a byte array and then use MSXML’s nodeTypedValue to base64 encode the data as I put it into the element. The problem, however, is that MS XML then adds its own namespace and datatype attributes into the element, making the xml output fail validation. The code I’m using is below as well as the output.

How do I suppress the “xmlns:dt=”urn:schemas-microsoft-com:datatypes” dt:dt=”bin.base64″” attributes being appended to the element?

Private Function xmlBinaryDocument(filePath As String) As IXMLDOMElement
    Dim xmlDOM As MSXML2.DOMDocument60
    Set xmlDOM = New MSXML2.DOMDocument60

    Set xmlBinaryDocument = xmlDOM.createNode(NODE_ELEMENT, "document", NS)

    Dim strExtension As String
    Dim strMimeType As String
    Dim fso As FileSystemObject
    Set fso = New FileSystemObject

    ' Info about file
    strExtension = fso.GetExtensionName(filePath)
    strMimeType = extToMime(strExtension)

    ' Now read the file as binary data into a byte array
    Dim file() As Byte
    file = GetFileBytes(filePath)

    ' Store it in the xml element as a base64 datatype
    xmlBinaryDocument.dataType = "bin.base64"
    xmlBinaryDocument.nodeTypedValue = file

    ' attributes
    xmlBinaryDocument.setAttribute "document_content_type", strMimeType 
    xmlBinaryDocument.setAttribute "document_encoding_type", "base64"
    xmlBinaryDocument.setAttribute "document_extension", strExtension
End Function

Output:

<document xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64" 
document_content_type="application/rtf" document_encoding_type="base64" 
document_extension="rtf">***base64 encoded file here***</document>
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:06:37+00:00Added an answer on May 16, 2026 at 11:06 pm

    Should have dug around in Locals a bit more:

    xmlBinaryDocument.removeAttribute "dt:dt"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to select an H1 element which is the second-child in its group
I am currently running into a problem where an element is coming back from
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.