User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the XML, XSLT and XPATH section within the Software Development category of DaniWeb, a massive community of 391,692 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,210 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our XML, XSLT and XPATH advertiser:
Views: 1036 | Replies: 1
Reply
Join Date: Jan 2008
Location: USA East Cost
Posts: 386
Reputation: CoolGamer48 is on a distinguished road 
Rep Power: 1
Solved Threads: 37
CoolGamer48's Avatar
CoolGamer48 CoolGamer48 is offline Offline
Posting Whiz

Writing XML parser - some syntax questions

  #1  
Jul 7th, 2008
Hey, I'm attempting to write an XML parser in C++, and I have some questions on some XML syntax. First: what is the rule for what goes between the end of the last attribute and the end of a tag? E.g.:

is this ok: <tag attribute="value" > ?

is this ok: <tag attribute="value"> ?

and this: <tag attribute="value" /> ?

and this: <tag attribute="value"/> ?

Which of those are ok and which are not (if any)?


Second, can there be whitespace between the attribute name and the equal sign and the equal sign and the attribute value: (atr="value", atr = "value",atr ="value", or atr= "value")?

That's it for now, but I might have a couple more questions later.
I'm a student. If my statements seem too absolute, feel free to coat them with "In my opinion..." or "I believe...".
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2004
Posts: 6,017
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 26
Solved Threads: 414
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: Writing XML parser - some syntax questions

  #2  
Jul 7th, 2008
>Which of those are ok and which are not (if any)?
They're all valid XML. The extra space in an empty element is a style guideline in XHTML for compatibility reasons, but that has to do with conforming applications and not the requirements of a parser.

>can there be whitespace between the attribute name and
>the equal sign and the equal sign and the attribute value
I think this will be the least of your problems, but yes, whitespace between markup elements is allowed. The big issue is figuring out where whitespace is significant, and the XML specification will tell you that in painful detail.
Member of: Beautiful Code Club.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb XML, XSLT and XPATH Marketplace
Thread Tools Display Modes

Other Threads in the XML, XSLT and XPATH Forum

All times are GMT -4. The time now is 2:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC