Sponsored Content
Top Forums UNIX for Beginners Questions & Answers General Purpose XML Processing Post 303026310 by bakunin on Saturday 24th of November 2018 02:46:05 AM
Old 11-24-2018
Quote:
Originally Posted by rahuldaso
what is the main difference beetween html and xml?
XML is the principle of using markup - "tags" - to denote special parts of a text put into a standardised format: tags are denoted "<tagname>", etc.. (there would be other ways of marking up text, like:

Code:
This is normal text [italic=on]but[italic=off] the last word was different.

which is also using the markup-principle but is not XML.)

HTML is one very specific variety of XML, with a fixed set of tags that can occur and a fixed order of tags that have to be there:

Code:
<body>....</body>
<head>....</head>

would be an error in HTML because the head-tag has to come before the body-tag. In XML this would be perfectly OK because there is no such rule. In fact there is no list of tags which are allowed and no prescribed structure they are allowed to have like there is in HTML.

So, in short: every HTML text is a valid XML text too, but not every XML has to be calid HTML.

I hope this helps.

bakunin
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Looking for a general purpose System Monitor

Does anyone have any scripts or suggestions on a general purpose Unix/Linux monitoring tool? (5 Replies)
Discussion started by: darthur
5 Replies

2. Shell Programming and Scripting

need help on xml processing

I am trying to divide a xml file(my.xml) like this: <?xml version="1.0" encoding="UTF-8"?> <Proto PName="hmmmmmmm"> <Menu id="A" ver="1"> <P> <P name="AA" Type="X"/> <P name="BB" Type="Y"/> <P name="CC" Type="Z"/> </P> ... (4 Replies)
Discussion started by: demoprog
4 Replies

3. Shell Programming and Scripting

CSV processing to XML

Hi, i am really fresh with shell scripting and programming, i have an issue i am not able to solve to populate data on my server for Cisco IP phones. I have CSV file within the following format: ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;... (9 Replies)
Discussion started by: angel2008
9 Replies

4. Programming

help me with perl script xml processing

Hi everyone, I have Xml files in a folder, I need to extract some attribute values form xml files and store in a hash. My xml file look like this. <?xml version="1.0" encoding="UTF-8"?> <Servicelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"... (0 Replies)
Discussion started by: pavani reddy
0 Replies

5. Shell Programming and Scripting

Help with XML file processing

I need to get all session_ID 's for product="D-0002" from a XML file: Sample input: <session session_ID="6411206" create_date="2012-04-10-10.22.13.000000"> <marketing_info> <program_id>D4AWFU</program_id> <subchannel_id>abc</subchannel_id> </marketing_info> ... (1 Reply)
Discussion started by: karumudi7
1 Replies

6. Shell Programming and Scripting

processing xml with awk

With the following input sample extracted from a xml file <rel ver="123"> <mod name="on"> <node env="ac" env="1"> <ins ip="10.192.0.1"/> <ins ip="10.192.0.2"/> ... (1 Reply)
Discussion started by: cabrao
1 Replies

7. UNIX for Beginners Questions & Answers

General Purpose Date Script

There must be thousands of one-off solutions scattered around this forum. GNU Date is so handy because it's general but if they're asking they probably don't have it. We have some nice scripts but they tend to need dates formatted in a very particular way. This is a rough approximation which... (18 Replies)
Discussion started by: Corona688
18 Replies
Strip(3pm)						User Contributed Perl Documentation						Strip(3pm)

NAME
HTML::Strip - Perl extension for stripping HTML markup from text. SYNOPSIS
use HTML::Strip; my $hs = HTML::Strip->new(); my $clean_text = $hs->parse( $raw_html ); $hs->eof; DESCRIPTION
This module simply strips HTML-like markup from text in a very quick and brutal manner. It could quite easily be used to strip XML or SGML from text as well; but removing HTML markup is a much more common problem, hence this module lives in the HTML:: namespace. It is written in XS, and thus about five times quicker than using regular expressions for the same task. It does not do any syntax checking (if you want that, use HTML::Parser), instead it merely applies the following rules: 1. Anything that looks like a tag, or group of tags will be replaced with a single space character. Tags are considered to be anything that starts with a "<" and ends with a ">"; with the caveat that a ">" character may appear in either of the following without ending the tag: Quote Quotes are considered to start with either a "'" or a """ character, and end with a matching character not preceded by an even number or escaping slashes (i.e. """ does not end the quote but "\\"" does). Comment If the tag starts with an exclamation mark, it is assumed to be a declaration or a comment. Within such tags, ">" characters do not end the tag if they appear within pairs of double dashes (e.g. "<!-- <a href="old.htm">old page</a> -->" would be stripped completely). 2. Anything the appears within so-called strip tags is stripped as well. By default, these tags are "title", "script", "style" and "applet". HTML::Strip maintains state between calls, so you can parse a document in chunks should you wish. If one chunk ends half-way through a tag, quote, comment, or whatever; it will remember this, and expect the next call to parse to start with the remains of said tag. If this is not going to be the case, be sure to call $hs->eof() between calls to $hs->parse(). METHODS new() Constructor. Can optionally take a hash of settings (with keys corresponsing to the "set_" methods below). For example, the following is a valid constructor: my $hs = HTML::Strip->new( striptags => [ 'script', 'iframe' ], emit_spaces => 0 ); parse() Takes a string as an argument, returns it stripped of HTML. eof() Resets the current state information, ready to parse a new block of HTML. clear_striptags() Clears the current set of strip tags. add_striptag() Adds the string passed as an argument to the current set of strip tags. set_striptags() Takes a reference to an array of strings, which replace the current set of strip tags. set_emit_spaces() Takes a boolean value. If set to false, HTML::Strip will not attempt any conversion of tags into spaces. Set to true by default. set_decode_entities() Takes a boolean value. If set to false, HTML::Strip will decode HTML entities. Set to true by default. LIMITATIONS Whitespace Despite only outputting one space character per group of tags, and avoiding doing so when tags are bordered by spaces or the start or end of strings, HTML::Strip can often output more than desired; such as with the following HTML: <h1> HTML::Strip </h1> <p> <em> <strong> fast, and brutal </strong> </em> </p> Which gives the following output: " HTML::Strip fast, and brutal " Thus, you may want to post-filter the output of HTML::Strip to remove excess whitespace (for example, using "tr/ / /s;"). (This has been improved since previous releases, but is still an issue) HTML Entities HTML::Strip will only attempt decoding of HTML entities if HTML::Entities is installed. EXPORT None by default. AUTHOR
Alex Bowley <kilinrax@cpan.org> SEE ALSO
perl, HTML::Parser, HTML::Entities perl v5.14.2 2011-11-15 Strip(3pm)
All times are GMT -4. The time now is 02:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy