Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of XML Mode vCard

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the example analysis of XML mode vCard for you. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Recording contact information is important for all business applications, and capturing this information through an effective XML structure can simplify the processing of such data.

Contact information can vary widely, so you should choose XML. For example, some companies and individuals may have multiple addresses, phone numbers, and e-mail accounts. It is easy to declare multiple pieces of such information in the XML structure.

The vCard structure, which is often used to represent contact information on Internet, is platform independent and makes it easy to generate and import different applications. It supports some of the flexibility of the XML structure, but it is actually a simple text-based format that uses declarative fields and extensions to provide information. Unlike the XML,vCard format, which is flat text, you cannot add information directly to various elements. A phone number is a good example, it is not necessarily associated with an address, but only as another phone number in the record.

The W3 Alliance proposes a XML in vCard format, which uses the RDF XML standard to facilitate formatting and exchange of contact information. Using the RDF framework, you can retain some structured information during the declaration process. For example, the RDF standard supports the use of packages, sequences, and alternatives to describe data. Packages support the declaration of an object (such as multiple roles) multiple times, and can be used when the sequence is not important. Sequences are used to define the order of objects, such as the hierarchy of people roles in an organization. Alternatives allow you to select an item from the list, such as multiple e-mail addresses.

Listing 6 shows the vCard of the virtual character Charles Perston.

Listing 6. VCard for Charles Perston

BEGIN:VCARD

VERSION:3.0

NRO Perstonnance Charles

FN:Charles Perston

ORG:Perston Technology

EMAIL;type=INTERNET;type=WORK;type=pref:null@perston.co.uk

TEL;type=WORK;type=pref:01234 567890

Item1.ADR;type=WORK;type=pref:;;Perston House;Perston;Perstonshire;P1 0NSipUK

Item1.X-ABADR:gb

X-ABUID:5AE47BB6-4E0F-4558-980C-BD3066FA6154/:ABPerson

END:VCARD

Using the vCard XML standard, the structure in listing 7 can be used to represent the same information.

Listing 7. Using the vCard XML standard to represent Charles Perston

Charles Perston

Perston

Charles

Perston House

Perston

Perstonshire

P1 0NS

UK

Null@perston.co.uk

Perston Technology

The XML format is longer, but it is easier to understand what you are looking at and the relationship between the parts. This format allows for more detailed information and details. For example, it is easy to find the country you need in the address, and this information is implicit in the standard vCard output.

For example, it's easy to use XPath or SAX events to extract a list of countries to know the number of contacts in different regions.

This is the end of this article on "sample Analysis of XML Mode vCard". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report