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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:58:29+00:00 2026-06-10T05:58:29+00:00

I have a file which has xml like tags and a bunch of invalid

  • 0

I have a file which has xml like tags and a bunch of invalid xml data because of which I cannot use a normal xml validators like xmllint on the the file. I want to ignore the invalid xml data and just check the file for well formedness.

<?xml version="1.0" encoding="utf-8"?>
<HOST>
<VERSION>5</VERSION> 
<OUTPUT>
   bunch of text which also contains tags like  <SYSTEM> 
   more tags like <->   <temp>  & ; 
   some more text and numbers
 </OUTPUT>
</HOST>

In the above example can I just ignore tags like <system>, <->, &, ; etc and just check for valid opening and closing tags like <HOST> </HOST> <VERSION> </VERSION> and <OUTPUT>
</OUTPUT>. The above file should return back saying its well formed since all the valid tags have proper opening and closing brackets.

Can I create my own dtd/xsd ?? to look for the tags which I want and ignore rest of tags using Perl.

My main problem is that I dont know the right keywords to describe my problem which is why google is not giving me the right results. Can someone please push me in the right direction. Thanks

  • 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-10T05:58:30+00:00Added an answer on June 10, 2026 at 5:58 am

    You’ll have to clean up the input first. Once you do that, then you can do DTD, schemas, proper parsing, and whatever.

    If it’s just the OUTPUT tag, you can try this:

    s/(<OUTPUT>)/$1<![CDATA[/;
    s/(</OUTPUT>)/]]>$1/;
    

    After that is done, your input should be ready for XML parsing, validation, etc. If your input might contain CDATA sections, you’ll have to do more, but that should be enough to get started.

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

Sidebar

Related Questions

I have a very large XML file which has like 40000 data, and when
I have an XML file which has many section like the one below: <Operations>
I have a .out file which has xml content like this. <header stub> <article
I have an XML file which has a simple nodes like: <question lang='en'>Do you
I have a xml file which has umlauts in it like so: <NameGe>ËÇ</NameGe> Is
I have this xml file which has text init. i.e Hi my name is
I have an XML file which has to be transformed using XSLT, I am
I have parsed XML file into objects, in which each object has a 1:1
I have an XML file that has a number of nodes, each of which
I have a PHP file which produces an Xml sitemap based on data which

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.