Jump to content

What is the XML format for this code?


displaynameis

Recommended Posts

Hello friends,I want to know what kind of XML format does the following xml code has it? I know there are different types of XML format available like basic format, advanced format etc. I am searching in web to know the format for the following code, but couldn't find it. Could someone direct me with the sample format for the following code? First, whether this type of below xml format is right or wrong there?

<items><mycategory name="Name1" baseurl="http://mywebserver/mydaya/1"><file name="mymusic1.mp3" title="MYMUSIC1" size="1603669"/><file name="mymusic2.mp3" title="MYMUSIC2" size="1237341"/><file name="mymusic3.mp3" title="MYMUSIC3" size="8487240"/><file name="mymusic4.mp3" title="MYMUSIC4" size="2487240"/><file name="mymusic5.mp3" title="MYMUSIC5" size="1891663"/></mycategory></items>

Thank you very much for your helps.Martin.

Link to comment
Share on other sites

Names like "basic format" or "advanced format" have no real meaning. They might make sense in a tutorial, but in practice they don't. XML is XML. If you find some aspects of it more "basic" than others, okay.Except for missing an xml tag like this:<?xml version="1.0" encoding="UTF-8"?>. . . that XML looks fine, and most XML parsers will honor that structure. It is fine because the two outer elements have opening and closing tags, and because the file elements are self-closing tags.Are you having problems with this somewhere?

Link to comment
Share on other sites

Thank you so much for the reply.I want to know how is the format it belongs to? I meant to say, "<items>" is parent, "<mycategory" is child, then what is "name="Name1" baseurl="http://mywebserver/mydaya/1" called and why do there again "<file name=" tags there?

I thought basically XML format is as,<items>	   // --> <parent><mycategory>	 // --><child><name="Name1" baseurl="http://mywebserver/mydaya/1">  // --><element><file name="mymusic1.mp3" title="MYMUSIC1" size="1603669"/>  // --><element><file name="mymusic2.mp3" title="MYMUSIC2" size="1237341"/>  // --><element><file name="mymusic3.mp3" title="MYMUSIC3" size="8487240"/>  // --><element><file name="mymusic4.mp3" title="MYMUSIC4" size="2487240"/>  // --><element><file name="mymusic5.mp3" title="MYMUSIC5" size="1891663"/>  // --><element></mycategory>   // --><child><items>   // --><parent>Please correct me if i'm wrong.

But, in what i posted code is being different from above, i want to know what makes the difference then..? What extra is being added in original code? How does that format belonging..(for ex: parent, child etc..?) ?Thank you very much.Martin.

Link to comment
Share on other sites

Everything that starts with "<" and ends with ">" is a tag.Tags are two kinds - opening ("<...>") and closing ("</...>") ones.Everything that starts with an opening tag and ends with a closing tag is an element.Everything between an opening and a closing tag is called "element contents".Everything within an opening tag in the form of ...="..." is called an attribute (of the element).Now... about the parent and child thing... this is NOT some kind of a special element... those are terms used to define how is one node (i.e. element or an attribute) related to another node. If element A appears in the element contents of element B, then A is a child of B, and B is a parent of A. In your sample at the top, "items" is a parent of all other elements, "mycategory" is a parent of all "file" elements, and "file" elements are not parents to any element. "name" is an attribute of the "mycategory" and "file" elements, where the parent of the first attribute is the "mycategory" element, and the parent of the latter "name" attributes are the "file" elements.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...