Solved

IMPLIED

Posted on 2000-02-23
4
737 Views
Last Modified: 2008-03-03
Hi,

I don't understand the way the IMPLIED works. In some tutorial I red that it means you are providing an implied default value for an attribute. As oposed to REQUIERED where you just mention that it will be checked if that attribute is there, but you do not provide any value for it.
This is done in the .dtd file.
But the tutorial does not provide any value for that attribute in the .dtd file ? Where will you provide the default value ?

That's from the tutorial:

<!ATTLIST Port
name            NMTOKEN #REQUIRED
hostName        NMTOKEN #IMPLIED
function        %funcType; #REQUIRED
number          CDATA #REQUIRED
type            %serverType;
serverPort      %fbool;
%basicAttrs;>



Thanks.
0
Comment
Question by:simi
  • 2
4 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 2554674
Over view:
Value Explanation
#DEFAULT value
 The attribute has a default value
 
#REQUIRED
 The attribute value must be included in the element
 
#IMPLIED
 The attribute does not have to be included
 
#FIXED value
 The attribute value is fixed
 


Detailed:
REQUIRED Default
The REQUIRED flag specifies that though there is no default value provided by the DTD, the attribute when actually implemented in an XML document must define a value. For example, suppose you wanted to define a standard PAGE_AUTHOR element that could be added to every page on any site that used it. Your intent is to make sure that every author provides contact information for bugs and broken links. However, you won't know in advance what the default values should be because everyone who implements your DTD will have different personal information. Thus, you can make the contact information attributes required, while not providing defaults.

IMPLIED Default
When you use the IMPLIED default, you will provide a default value for the document author. If the document author does not override your default, your default will be used.

FIXED Default
Sometimes you will want to provide a default value that the document author may not modify. In that case, you will use FIXED.

also check out:
http://hotwired.lycos.com/webmonkey/98/45/index3a_page2.html?tw=authoring

CJ
0
 

Author Comment

by:simi
ID: 2555301
Thanks but your answer is nothing but cut and paste from the same site I have posted the DTD example.
The reason why I was asking the question was because I did not understand from the tutorial exactly what your answer is stating.
What I do not understand is where do you specifi the implied value.
If not in the .dtd file then where ?
A .dtd file can be used by multiple .xml files as a document type definition.
When at creation of the .dtd you do not know what will be the value for a certain attribute, but you know you want all .xml files having such a value you use #REQUIRED.
When you use #IMPLIED you should provide a default value, that is used if the .xml file does not overrite it by providing one. That's why it is not necesarry needed, like with a required one.
If there was a place to put the implied value itself that would be the .dtd file, but the example we are both talking about is not doing that.
This is my question. Where do I place the default value of the #IMPLIED attribute ?

Thanks.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 2555750
not in the dtd but in the .xml (atleast thats what my reading lead me to believe, I will check more tonite)

CJ
0
 
LVL 1

Accepted Solution

by:
dmaryakh earned 25 total points
ID: 2559145
#IMPLIED - It is optional to supply a value for this attribute in the document instance; applications will beed to supply their own value if one is needed for processing.

#REQUIRED  - a value must be supplied for the attribute in the documents instance.

As for your question of where would you place the default value of the #IMPLIED attribute, you havr to place it in you application that will process the instance. However you might also have something like that in your DTD

<!ATTLIST doc
   status (draft|final|other) #IMPLIED
   audience (novice|expert) #REQUIRED
>

if you do not supply the value for your status attribute, it is understood by the parser that your application will use some predefined default value for this attribute. If you ommit your audience attribute however, the parser is going to complain that the instance is not valid, since it is required that this attribute have to be present in the instance

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now