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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:16:38+00:00 2026-05-27T14:16:38+00:00

I have to validate XML file that contains embedded XML, with XML Schema. Correctness

  • 0

I have to validate XML file that contains embedded XML, with XML Schema. Correctness of the inner XML doesn’t interest me. Which type should I use in XML Schema for this type of content? Simple xs:string doesn’t work.

  • 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-27T14:16:38+00:00Added an answer on May 27, 2026 at 2:16 pm

    You have a number of alternatives for embedding XML within another XML document.

    xs:any:

    You can use the xs:any type in your schema (link). However you will need to include a schema for the embedded XML (which will be used to validate it).

    Alternatively, xs:string can be made to work if you either embed the inner XML within a CDATA section or escape all the < and & characters.

    CDATA section:

    <InnerXml>
      <![CDATA[
        <InnerXmlRoot>
          <InnerXmlContent>One & Two</InnerXmlContent>
        </InnerXmlRoot>
      ]]>
    </InnerXml> 
    

    The only thing you need to be careful of with this approach is that the inner XML cannot contain CDATA sections as the allowed content cannot contain ]]> (see the XML specification).

    Character escaping:

    <InnerXml>
      &lt;InnerXmlRoot>
        &lt;InnerXmlContent>One &amp; Two&lt;/InnerXmlContent>
      &lt;/InnerXmlRoot>
    </InnerXml> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple doc.xml file which contains a single root element with a
I have an XML file that contains a script of items to check and
I have an XML file that is validating against a schema. However on our
I have an XML file that I'm trying to validate against an XSD file
I have a Xml-Schema file to validate xml-Files. Xml-Schema: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema
I need to validate a xml file against DTD schema. I found out that
We have a Perl program to validate XML which is invoked from a Java
I am trying to create a Xml schema for a xml file that looks
I have written a small XML validator, that takes in an XML file and
I have this code to validate an XML file against an XSD file: $file

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.