Solved

IMPLIED

Posted on 2000-02-23
4
739 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 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

21 Experts available now in Live!

Get 1:1 Help Now