• Follow us on Twitter @buckeyeplanet and @bp_recruiting, like us on Facebook! Enjoy a post or article, recommend it to others! BP is only as strong as its community, and we only promote by word of mouth, so share away!
  • Consider registering! Fewer and higher quality ads, no emails you don't want, access to all the forums, download game torrents, private messages, polls, Sportsbook, etc. Even if you just want to lurk, there are a lot of good reasons to register!
s.gif
s.gif
s.gif
 
Upvote 0
OSUsushichic;1104086; said:
Does anyone know XML? I'm trying to create a relatively simple document but I cannot get it to validate with the DTD. I was just wondering if anyone could help.

Common mistakes that will prevent validation:

Tag cases not matching, e.g., you declared a <Car> tag and then used <car>
Missing closing tags, e.g., you forgot </Car> after using <Car>Lexus
Not quoting attributes, e.g., having <Car type=sedan> instead of <Car type="sedan">
Using one of the 5 predefined entity references in your data. These 5 are:
< (less than) need to use &lt;
> (greater than) need to use &gt;
& (ampersand) need to use &amp;
" (quotation mark, or double quote) need to use &apos;
' (apostrophe, or single quote) need to use &quot;
Improperly nested elements, e.g., <Car><model></Car></model> instead of <Car><model></model></Car>
 
Upvote 0
MililaniBuckeye;1104802; said:
Common mistakes that will prevent validation:

Tag cases not matching, e.g., you declared a <Car> tag and then used <car>
Missing closing tags, e.g., you forgot </Car> after using <Car>Lexus
Not quoting attributes, e.g., having <Car type=sedan> instead of <Car type="sedan">
Using one of the 5 predefined entity references in your data. These 5 are:
< (less than) need to use &lt;
> (greater than) need to use &gt;
& (ampersand) need to use &amp;
" (quotation mark, or double quote) need to use &apos;
' (apostrophe, or single quote) need to use &quot;
Improperly nested elements, e.g., <Car><model></Car></model> instead of <Car><model></model></Car>

Thanks, Mili. I'm confused about what to do with the $ sign. I have this:

<books>
<book>
<title>The Eyre Affair</title>
<author>Jasper Fforde</author>
<price>$9.98</price>
</book>
...
(and two more <book> sets like this one)
</books>

I think the price should either look like this:
<price>$9.98</price>

(Unicode symbol for $)

and then declare the entity &#x0024 in the DTD. But I'm not sure how to do this. The book I'm using doesn't explain this very well. I know I also can set up the $ as the default currency for these, which would be better since I'm using the $ multiple times, but I'm also not sure how to do that. It's frustrating me!
 
Upvote 0
OSUsushichic;1104980; said:
Thanks, Mili. I'm confused about what to do with the $ sign. I have this:

<books>
<book>
<title>The Eyre Affair</title>
<author>Jasper Fforde</author>
<price>$9.98</price>
</book>
...
(and two more <book> sets like this one)
</books>

I think the price should either look like this:
<price>$9.98</price>

(Unicode symbol for $)

and then declare the entity &#x0024 in the DTD. But I'm not sure how to do this. The book I'm using doesn't explain this very well. I know I also can set up the $ as the default currency for these, which would be better since I'm using the $ multiple times, but I'm also not sure how to do that. It's frustrating me!

Just now got back to this thread. What I'd do is not use a dollar sign in the price field, but just the amount itself...you could always print the dollar sign in front of the amount when printing reports, displaying web pages, etc. It would look like this (ignore the leading periods, I just wanted to also show you the indentations I like to do to make it easier to read and troubleshoot...those periods would actually be spaces):

<books>
..<book>
....<title>The Eyre Affair</title>
....<author>Jasper Fforde</author>
....<price>9.98</price>
..</book>
</books>
 
Upvote 0
MililaniBuckeye;1108988; said:
Just now got back to this thread. What I'd do is not use a dollar sign in the price field, but just the amount itself...you could always print the dollar sign in front of the amount when printing reports, displaying web pages, etc. It would look like this (ignore the leading periods, I just wanted to also show you the indentations I like to do to make it easier to read and troubleshoot...those periods would actually be spaces):

<books>
..<book>
....<title>The Eyre Affair</title>
....<author>Jasper Fforde</author>
....<price>9.98</price>
..</book>
</books>

I could do it that way, but that would be a cop-out! :p I'm required to use the dollar sign, or somehow indicate that the currency is USD. I'm going to ask some folks at the MIT library. They deal with XML all the time.
 
Upvote 0
OSUsushichic;1109164; said:
I could do it that way, but that would be a cop-out! :p I'm required to use the dollar sign, or somehow indicate that the currency is USD. I'm going to ask some folks at the MIT library. They deal with XML all the time.


How about using an attribute for the price element?

<price currency="USD">9.98</price>

That way you can define any currency you want (British pounds, Japanese yen, Canadian dollars, etc.).
 
Upvote 0
MililaniBuckeye;1109544; said:
How about using an attribute for the price element?

<price currency="USD">9.98</price>

That way you can define any currency you want (British pounds, Japanese yen, Canadian dollars, etc.).

That is what I did for now. I still would like to know what to do with symbols or how do designate USD as the default. I've just been too busy to get back to it. Thanks, guys, for your help!
 
Upvote 0
Back
Top