How to quickly identify RSS versions and types

Source: Internet
Author: User
How to quickly identify the RSS version and type of the RSS namespace Atom

The code currently written only supports RSS2.0. I use socket to get the response content. how can I get the response content?
RSS1
RSS2
ATOM
RDF


It takes too much time to parse tags. if you look at the namespace, there are a lot of websites that generate feeds, and no namespace is written.

Some people have given some advice.


Reply to discussion (solution)

They are independent standard systems. are you planning to use the same code segment to process them?

They are independent standard systems. are you planning to use the same code segment to process them?

I will use a method or function to analyze the response of the target feed. It is atom or rss2 ,... One of them is then handled by the corresponding class to process the item or entry

RSS has Version declaration labels

Since you have corresponding processing classes, what do you want to discuss?

If you say that you use socket to get the response content, it should be regarded as a stream method.
You can use the built-in xml parsing function (xml_xxxx) for parsing without the need to write the processing classes separately. Easy to scale

Since you have corresponding processing classes, what do you want to discuss?
Re:
Step 1: You know it's rss2 or atom. I am asking this

Step 2: For rss2, delegate the processing class of rss2
If it is atom, delegate the processing class of atom

Step 3: The second step generates an array of standard class instances that I have written for processing.

...

You can use the built-in xml parsing function (xml_xxxx) for parsing without the need to write the processing classes separately. Easy to scale
Re:

I did not show it after collection, but I still need to write it to the database according to my standards. so I need different processing classes to find what I need.

The feed node contains the xmlns attribute atom.
The version attribute of the rss node indicates the version number.
Rdf namespace ID

As long as you are not using the integrated XML processing class (DOMDocument, SimpleXML) for processing, it is still very easy, otherwise you need to explore (maybe Xuyang loads raw data multiple times)
Xml parsing functions only need to be scanned once (especially for your applications that only extract specified information)

The feed node contains the xmlns attribute atom.
The version attribute of the rss node indicates the version number.
Rdf namespace ID

As long as you are not using the integrated XML processing class (DOMDocument, SimpleXML) for processing, it is still very easy, otherwise you need to explore (maybe Xuyang loads raw data multiple times)
Xml parsing functions only need to be scanned once (especially for your applications that only extract specified information)
Thank you. Go home and write at night

Atom: xmlns = "http://www.w3.org/2005/Atom"
Rdf: xmlns: rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns"
Rss2: xmlns: dc = "http://purl.org/dc/elements/1.1"

It is easy to judge if all data is written into xmlns, that is, there are many websites whose rss2 does not write xmlns. this is too annoying.

This is some of the formats provided by ZendFramework (in tests/Zend/Feed/_ files, it should be comprehensive)


Tests/Zend/Feed/_ files
Re:
Where can I access this? can I provide a connection?

Since it is made of php, even though it is not needed, it will always look at the next ZendFramework framework, right?
I downloaded a lot of frameworks and compared them to identify them.

Since it is made of php, even though it is not needed, it will always look at the next ZendFramework framework, right?
I downloaded a lot of frameworks and compared them to identify them.
I have never talked about zf.

Writing php is just soy sauce

This is some of the formats provided by ZendFramework (in tests/Zend/Feed/_ files, it should be comprehensive)


I have a question: if there is a namespace for both rdf and rss, which is not determined from namespace:
Example

 
 
 
  
 


Or

 
 
  
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.