Can someone answer some of my XML questions plz!

DAM

Diamond Member
Jan 10, 2000
6,102
1
76
Ok, so I have been reading about XML and I just wanted to mess around with it just to see what its capabilities were, however, I am not too sure I understand exactly how to use it, and how to test it? Can you use it on a database? What prog can you use to write it and checks for sytax? etc, etc.



dam()
 
Nov 7, 2000
16,403
3
81
XML is kinda like a custom HTML - you decide the tags, their heirarchy and style. To make a simple XML page, first you have to create your DTD, or document type definition. It follows a specific syntax and specifies how your document will be constructed - ie what tags will contain what. Heres a small example of a DTD you might create for a shakespeare play -

-----------start of page.xml-----------------
<?xml version='1.0' encoding ='UTF-8' standalone="yes"?> THIS LINE SPECIFIES WHAT VERSION OF XML
<?xml-stylesheet href="msndcss.css" type="text/css"?> THIS IS THE LINK TO YOUR CSS FILE, WHERE YOU DECLARE HOW EACH TAG IS TO BE FORMATTED

<!-- XML VERSION DECLARATION -->

<!-- THE DTD -->

<!DOCTYPE Shakespeare
[
<!ELEMENT play (#PCDATA|act)*> PLAY IS THE HIGHEST RANKING TAG, IT WILL CONTAIN ONLY CHARACTERS, OR ACT OBJECTS
<!ELEMENT act (#PCDATA|scene)*> THE ACT ELEMENT WILL CONTAIN ONLY SCENES
<!ELEMENT scene (#PCDATA|speaker)*> ETC
<!ELEMENT speaker (#PCDATA|line)*>
<!ELEMENT line (#PCDATA)*>
]>
<!-- END DTD -->

<PLAY>Hamlet
<ACT>Act X
<SCENE>Scene X
<SPEAKER>Hamlet
<LINE>To be or not to be,...</LINE>
</SPEAKER
</SCENE>
</ACT>
</PLAY>




MAYBE THIS WILL GIVE YOU SOME IDEAS...

XML does interface with XML databases, but i dont know anything about that
All the writing I have done has been in notepad.
The browsers will usually let you know when your syntax is wonky.
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
I am not an expert, but I will tell you what I know. First off, Microsoft currently wants everything to be in XML, so the ways in which it can be used change often. Primary XML was developed to be used as a language for data description, as opposed to HTML which is used for data presentation. I don't understand what you mean by "can it be used ON a database", but XML can be used as a small database. It can then be queried using an XMLParser. You can write XML documents in notepad, and I would recomend doing so because you don't need all of those XML specific editors. You can use IE (which calls an XMLparser) to validate (check syntax) for your XML.
 

Juniper

Platinum Member
Nov 7, 2001
2,025
1
0
I think I'm more newbie than any of you here. :Q

Anyway, I have written a DTD for a resume before, for an assignment. So, the idea of databases with XML is quite unknown to me. What do you mean by

XML can be used as a small database?

Do you mean that somehow, when an XML document is generated, the XML parser can look for the required data by specifying the tag, and then store that data in a real database? Care to explain more? :)


 

Czar

Lifer
Oct 9, 1999
28,510
0
0
Here is the option file from ghost recon

- <OptionsFile>
<MouseRadiansPerPixel>0.008727</MouseRadiansPerPixel>
<UseMouseInput>TRUE</UseMouseInput>
<MoveShuffleThreshold>10</MoveShuffleThreshold>
<MoveNormalThreshold>30</MoveNormalThreshold>
<MoveFastThreshold>100</MoveFastThreshold>
<MouseLookReverseY>FALSE</MouseLookReverseY>
<IFFEnabled>TRUE</IFFEnabled>
<ThreatIndicatorEnabled>TRUE</ThreatIndicatorEnabled>
<DefaultKeyMappingFilename>defplayr.keys</DefaultKeyMappingFilename>
- <Gameplay>
<BloodOn>TRUE</BloodOn>
<RecordGame>FALSE</RecordGame>
<ShowIntro>TRUE</ShowIntro>
<AutoAssignStats>TRUE</AutoAssignStats>
</Gameplay>
<ShellBackgroundIndex>0</ShellBackgroundIndex>
<ReticuleColorR>255</ReticuleColorR>
<ReticuleColorG>214</ReticuleColorG>
<ReticuleColorB>17</ReticuleColorB>
<ReticuleIFFColorR>160</ReticuleIFFColorR>
<ReticuleIFFColorG>200</ReticuleIFFColorG>
<ReticuleIFFColorB>255</ReticuleIFFColorB>
<XBoxMode>FALSE</XBoxMode>
- <Graphics>
<FullScreen>TRUE</FullScreen>
<VideoResolution Width="1024" Height="768" BitDepth="16" />
<ShowFrameRate>FALSE</ShowFrameRate>
<UsePrimaryDisplay>FALSE</UsePrimaryDisplay>
<UseDisplayDeviceGuid>FALSE</UseDisplayDeviceGuid>
<DisplayDeviceGuid>{000000d2-0035-0000-ffff-ffffc8000000}</DisplayDeviceGuid>
<CompressTextures>TRUE</CompressTextures>
<HumanShadowDetail>0</HumanShadowDetail>
<VehicleShadowDetail>0</VehicleShadowDetail>
<BulletHoleMax>100</BulletHoleMax>
<Gamma>0.600000</Gamma>
<ShowDeadBodies>TRUE</ShowDeadBodies>
<CharVertexWeight>FALSE</CharVertexWeight>
<ParticleDetail>0</ParticleDetail>
<UITextureDetail>2</UITextureDetail>
<LevelTextureDetail>1</LevelTextureDetail>
<CharacterTextureDetail>1</CharacterTextureDetail>
<EffectTextureDetail>1</EffectTextureDetail>
<ZBufferBits>16</ZBufferBits>
<TreeModelDetail>MEDIUM</TreeModelDetail>
<CharacterModelDetail>MEDIUM</CharacterModelDetail>
</Graphics>
- <Sound>
<MasterVolume>1.000000</MasterVolume>
<MasterSwitch>TRUE</MasterSwitch>
<EffectsVolume>1.000000</EffectsVolume>
<EffectsSwitch>TRUE</EffectsSwitch>
<MusicVolume>1.000000</MusicVolume>
<MusicSwitch>TRUE</MusicSwitch>
<VoiceVolume>1.000000</VoiceVolume>
<VoiceSwitch>TRUE</VoiceSwitch>
<AlternateCache>FALSE</AlternateCache>
<UseEAX>TRUE</UseEAX>
</Sound>
- <Multiplayer>
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<ChatMsg text="" team="false" />
<MPGameName>Ghost Recon Server</MPGameName>
<MOTD>Message of the Day</MOTD>
<JoinPort>2346</JoinPort>
<AnnouncePort>2347</AnnouncePort>
<BehindFirewall>FALSE</BehindFirewall>
<PreferredIP>DEFAULT</PreferredIP>
<RemoteServerAccess>FALSE</RemoteServerAccess>
<RemoteServerPasswd>password</RemoteServerPasswd>
<GameSynchTimeout>600.000000</GameSynchTimeout>
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
<IPAddress />
</Multiplayer>
<PlayerName>someone</PlayerName>
</OptionsFile>


As you can see its just a small text file that works sortof like a databse and its written like html... I dont like it very much but some do. SQL IS DA LIFE

 

Ameesh

Lifer
Apr 3, 2001
23,686
1
0
XML should only store raw data, not aggreagate info or any other. My Roomate is a PM in the XML group at Microsoft.
 

DAM

Diamond Member
Jan 10, 2000
6,102
1
76
wait I still think I dont understand: can someone give me a simple use for xml as well as a comples example of xml usage?




thanks



dam()
 

Ameesh

Lifer
Apr 3, 2001
23,686
1
0
xml is strongly typed html so basically it looks like html but it only holds data and it is strongly checked meaning you have to close a tag that you open, and you cant cross tags:


so (this is valid xml):


<root>
<outerxml>
<data name="Ameesh"> Cool Guy! </data>
<data name="Ameesh"> Cool Guy! </data>
<data name="Ameesh"> Cool Guy! </data>
</outerxml>
</root>


this is not:

<Foo><B></Foo></B> // BAD! you cant do this!


understand?