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 8981577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:22:17+00:00 2026-06-15T20:22:17+00:00

I am trying to do some XSLT transformation, to convert an XML to XML,

  • 0

I am trying to do some XSLT transformation, to convert an XML to XML, using the following lines of code. When i try to create an XMLDocument object from the transformed XML i am getting an error

Data at the root level is invalid. Line 1, position 1.

 Dim outputXML As New XmlDocument

        Dim stream As New MemoryStream
        Dim writer As XmlTextWriter = New XmlTextWriter(stream, System.Text.UnicodeEncoding.UTF8)

        Dim navigator As XPathNavigator = illustratePlusXML.CreateNavigator()
        Dim transormer As XslCompiledTransform = New XslCompiledTransform()
        transormer.Load(ConfigurationManager.AppSettings("XSLT_File_Path"))
        transormer.Transform(navigator, Nothing, writer)

        Dim output As String = System.Text.UnicodeEncoding.UTF8.GetString(stream.ToArray())
        outputXML.LoadXml(output)

        Return outputXML

I could find a special character(square box), i persume this is causing the error. attached snapshot of the output xml. Can somebody please suggest ?

output xml with special character

  • 1 1 Answer
  • 0 Views
  • 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-06-15T20:22:19+00:00Added an answer on June 15, 2026 at 8:22 pm

    If you want to populate an XmlDocument as the result of an XSLT transformation then simply do

    Dim resultDoc As New XmlDocument()
    Using xw As XmlWriter = resultDoc.CreateNavigator().AppendChild()
            Dim navigator As XPathNavigator = illustratePlusXML.CreateNavigator()
            Dim transormer As XslCompiledTransform = New XslCompiledTransform()
            transormer.Load(ConfigurationManager.AppSettings("XSLT_File_Path"))
            transormer.Transform(navigator, Nothing, xw)  
            xw.Close()
    End Using
    

    There is no need to use a MemoryStream. If you really think you need to use a MemoryStream then make sure you reset its Position to 0 before calling the Load method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to render some data from a large XML using XSLT. The
I'm trying to extract some information from an xml file using xslt. I've used
I am trying to create a table using Xml/Xslt, where some of the cells
I'm trying to transform some XML into HTML using XSLT . Problem: I can't
I’ve been trying to transform some simple XML into another simple XML using XSLT.
i am trying to convert XML to csv using xslt, i am not familiar
I'm trying to load some xml and xslt stuff into this following html file:
I'm trying to render the following HTML code using xslt: <foo:bar href=[MYURL]/> I created
I'm trying to program a homepage with some XML transformations with XSLT. I'm using
I am trying to convert an HTML file into XML file using XSLT (Using

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.