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

  • SEARCH
  • Home
  • 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 3788232
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:57:59+00:00 2026-05-19T11:57:59+00:00

I’m writing a piece of software that accepts XML from our clients. The xml

  • 0

I’m writing a piece of software that accepts XML from our clients.
The xml has2 parts, a standard part that contains set fields, and a freeform part that allows our clients to add own their own xml

<OverallDocument>
    <SetFields>
        <name>Jon Doe</name>
        <age>24</age>
        <sex>M</sex>
    </SetFields>
    <FreeXML>
    <!--custom xml goes here-->
    </FreeXML>
</OverallDocument>

The system is set so that the OverallDocument has a schema that covers all sections of the xml except what goes inside the FreeXML tags.
The contents of the FreeXML tags has it’s own schema sent to us by our client.

<OverallDocument>
    <SetFields>
        <name>Jane Doe</name>
        <age>30</age>
        <sex>F</sex>
    </SetFields>
    <FreeXML>
    <Custom1>
        <CustomString>aaaaaa</CustomString>
        <CustomInt>12345</CustomInt>
    </Custom1>
    </FreeXML>
</OverallDocument>

In this case the client’s xml looks like this

<Custom1>
    <CustomString>aaaaaa</CustomString>
    <CustomInt>12345</CustomInt>
</Custom1>

The program is trying to extract the client’s custom xml for further processing.

So far, no problems. this all reads nicely into an xmldocument.
Unfortunatly some of our clients use namespace prefixes on their custom xml without declaring the prefixes in the xml document.

<OverallDocument>
    <SetFields>
        <name>Jane Doe</name>
        <age>30</age>
        <sex>F</sex>
    </SetFields>
    <FreeXML>
    <hl:Custom1>
        <CustomString>aaaaaa</CustomString>
        <CustomInt>12345</CustomInt>
    </hl:Custom1>
    </FreeXML>
</OverallDocument>

This causes the xmldocument to fall over as the prefixes are not declared in the xml. I tried getting around this by removing all namespace prefixes from the code, but this causes issues later on in the processing as the clients’ schemas require the prefixes to be on the tags.

some further problems

  • We have many clients with different
    schemas and different namespaces.
  • Each XML file can have multiple
    FreeXML elements in different
    sections (so it’s not possible to
    simply extract the FreeXML section as
    different clients use 1 or more and
    use sections in different locations
    throughout the document.
  • We cannot edit the clients’ schema.
  • We cannot tell the clients to sort
    their act out and write working xml.

Ideally it would be best if we can just specify the namespace and prefix to the xmldocument reader.
eg

dim xdoc as xmldocument = xmldocument
'add namespace and prefix
xdoc.loadxml(xmlcode)
  • 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-05-19T11:58:00+00:00Added an answer on May 19, 2026 at 11:58 am

    It seems the way to fix this is to change the way the xml is loaded into the xmldocument.
    Whereas before i was parsing a string into the loadxml method of the xmldocument. I now parse a string into a stringreader, then parse the stringreader into an xmltextreader.
    The xmltextreader has the Namespaces property which allows you to turn namespace validataion off.
    The xmltextreader can then be parsed into the load method of the xmldocument.

    Dim xstring As String = xmldata
    Dim sreader As New System.IO.StringReader(xstring) 'load string into stringreader
    Dim xreader As New XmlTextReader(sreader)          'load stringreader into xmltextreader
    xreader.Namespaces = False                         'turn off namespaces
    Dim xdoc As XmlDocument = New XmlDocument          'create xmldocument
    xdoc.Load(xreader)                                 'Load xmltextreader into xmldocument
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.