Skip to main content

Posts

Showing posts from October 3, 2010

XML Attributes

From HTML you will remember this: < IMG SRC="comp.gif" >. The SRC attribute provides additional information about the IMG element. In HTML (and in XML) attributes provide additional information about elements: < img src="computer.gif" > < a href="demo.asp" > Attributes often provide information that is not a part of the data. In the example below, the file type is irrelevant to the data, but important to the software that wants to manipulate the element: < file type="gif" > computer.gif < /file > Students now u know abt basic XML, its scripting rules. Lets understand XML attributes which can be understood as property of an element. Here are simple rules for XML elements Quote Styles, "female" or 'female'? Attribute values must always be enclosed in quotes, but either single or double quotes can be used. For a person's sex, the person tag can be written like this: < person se...

Element naming

XML elements must follow these naming rules: Names can contain letters, numbers, and other characters Names must not start with a number or punctuation character Names must not start with the letters xml (or XML, or Xml, etc) Names cannot contain spaces Take care when you "invent" element names and follow these simple rules: Any name can be used, no words are reserved, but the idea is to make names descriptive. Names with an underscore separator are nice. Examples: < stud_name >, < stud_age > . Avoid "-" and "." in names. For example, if you name something "first-name," it could be a mess if your software tries to subtract name from first. Or if you name something "first.name," your software may think that "name" is a property of the object "first." Element names can be as long as you like, but don't exaggerate. Names should be short and simple, like this: < Thesis_title ...