[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get the 1st element in DTDD
- From: Bing.Li@asu.edu
- To: Murali Mani <mani@CS.UCLA.EDU>
- Date: Fri, 22 Jun 2001 13:09:05 -0700 (MST)
Murali,
Now I attempt to design a method to access the root in the DTD. I think it is
not hard to do that. Just String methods provided by Java can implement
it. After getting the root, a well-formed XML can be constructed according to
my program. I can show you that later if you are interested in.
Thanks for your help!
Bing
_________________
| How are you? |_____ __
| I am Li Bing. | |__| |_________
|________________| OK? |::| | Need /
| \.____|::|__| Help? <
| \::/ \._______\
/\**/\ | ___________________________________
( o_o )_ |__|http://www.public.asu.edu/~libing /
(u--u \_) | |bing.li@asu.edu, 480-829-8492(H) /
(||___ )==\ |480-965-9038(L)480-965-1746(O) \
,dP"/b/=( /P"/b\ |__________________________________\
|8 || 8\=== || 8
`b, ,P `b, ,P
"""` """`
On Fri, 22 Jun 2001, Murali Mani wrote:
>
> Yes, doc should be initialized by an XML document, this is a wierd part of
> XML, DOCTYPE declaration comes with the XML Document, and you cannot
> specify DOCTYPE as part of the DTD.
>
> Other things --
> I have always *very* strongly felt that the possible root elements of a
> document should be specified in the DTD/schema -- this is exactly what we
> do in regular tree grammars.
>
> RELAX supports specification of the set of possible root elements of the
> document using export -- I am sure RELAX NG and TREX also have a similar
> feature.... XML Schema supports this in a very wierd manner -- start with
> something totally orthogonal, and use that for specifying the set of root
> elements also.
>
> People say that the schema gives the type definitions, that is right, but
> finally we have to arrange the types as a tree, for which we need to
> specify a set of possible root elements.
>
> Anyways, though I have always believed that the schema should specify the
> possible root types, people have always said against this, I have always
> waited for one good reason for not specifying the root of the document in
> the schema, but unfortunately, I do not think I have seen any... I will
> keep waiting for some good reason ...
>
> Anyways, regarding your application, I think you have to assume a
> particular root element -- possibly your API might be something like --
>
> createDocument (String name), which will then construct a document with
> name as the name of the document root element, and the document will
> conform to the DTD.
>
> regards - murali.
>
> On Fri, 22 Jun 2001 Bing.Li@asu.edu wrote:
>
> > Dear Mani,
> >
> > Thanks for your help!
> >
> > But I think the doc should be initialized by an XML, right? Now I haven't an
> > XML because I need to use DTD to generate the XML. So I can't get the doc. Do
> > you think so?
> >
> > Thanks,
> > Bing
> >
> > _________________
> > | How are you? |_____ __
> > | I am Li Bing. | |__| |_________
> > |________________| OK? |::| | Need /
> > | \.____|::|__| Help? <
> > | \::/ \._______\
> > /\**/\ | ___________________________________
> > ( o_o )_ |__|http://www.public.asu.edu/~libing /
> > (u--u \_) | |bing.li@asu.edu, 480-829-8492(H) /
> > (||___ )==\ |480-965-9038(L)480-965-1746(O) \
> > ,dP"/b/=( /P"/b\ |__________________________________\
> > |8 || 8\=== || 8
> > `b, ,P `b, ,P
> > """` """`
> >
> >
> > On Fri, 22 Jun 2001, Murali Mani wrote:
> >
> > >
> > > Sorry i did not use the exact names -- i have not used xml parsers from
> > > March 2000 -- sorry for the imprecise answers --
> > >
> > > basically you have to do this --
> > >
> > > To get to the first element of the DTD -- I think you want to know what is
> > > the element specified as the root using the DOCTYPE declaration --
> > >
> > > do this --
> > >
> > > Let the Document be doc
> > >
> > > (doc.getDoctype ()).getName ()
> > >
> > > Document.getDoctype () returns DocumentType --
> > > DocumentType.getName () returns the name of the DOCTYPE declaration as a
> > > String
> > >
> > > regards - murali.
> > >
> > > Note that in xml4j 1.1.16, if I remember correctly, DTD implements
> > > DocumentType, also the method getDoctype is in the Document interface --
> > > it is not in DTD.
> > >
> > > On Fri, 22 Jun 2001 Bing.Li@asu.edu wrote:
> > >
> > > > Dear Murali,
> > > >
> > > > I didn't get the method, getDocTypeDeclaration, in the DTD class. I use IBM
> > > > XML Parser for Java 1.1.16. What about you?
> > > >
> > > > Thanks,
> > > > Bing
> > > > _________________
> > > > | How are you? |_____ __
> > > > | I am Li Bing. | |__| |_________
> > > > |________________| OK? |::| | Need /
> > > > | \.____|::|__| Help? <
> > > > | \::/ \._______\
> > > > /\**/\ | ___________________________________
> > > > ( o_o )_ |__|http://www.public.asu.edu/~libing /
> > > > (u--u \_) | |bing.li@asu.edu, 480-829-8492(H) /
> > > > (||___ )==\ |480-965-9038(L)480-965-1746(O) \
> > > > ,dP"/b/=( /P"/b\ |__________________________________\
> > > > |8 || 8\=== || 8
> > > > `b, ,P `b, ,P
> > > > """` """`
> > > >
> > > >
> > > > On Fri, 22 Jun 2001, Murali Mani wrote:
> > > >
> > > > > > I think there is something like getDocTypeDeclaration in the
> > > > interface > Document -- please check.. > > cheers - murali. > > On
> > > > Fri, 22 Jun 2001 Bing.Li@asu.edu wrote: > > > Dear all, > > > > Now I
> > > > am using DOM to generate XML files. I need to get the first
> > > element of
> > > > > > DTD.
> > > > > >
> > > > > > I am able to use
> > > > > >
> > > > > > Enumeration en = dtd.getElementDeclarations();
> > > > > >
> > > > > > to get all the elements in the DTD. But I don't know which one is the first
> > > > > > element in the DTD.
> > > > > >
> > > > > > I appreciate any help from you!
> > > > > >
> > > > > > Li Bing
> > > > > >
> > > > > > _________________
> > > > > > | How are you? |_____ __
> > > > > > | I am Li Bing. | |__| |_________
> > > > > > |________________| OK? |::| | Need /
> > > > > > | \.____|::|__| Help? <
> > > > > > | \::/ \._______\
> > > > > > /\**/\ | ___________________________________
> > > > > > ( o_o )_ |__|http://www.public.asu.edu/~libing /
> > > > > > (u--u \_) | |bing.li@asu.edu, 480-829-8492(H) /
> > > > > > (||___ )==\ |480-965-9038(L)480-965-1746(O) \
> > > > > > ,dP"/b/=( /P"/b\ |__________________________________\
> > > > > > |8 || 8\=== || 8
> > > > > > `b, ,P `b, ,P
> > > > > > """` """`
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ------------------------------------------------------------------
> > > > > > The xml-dev list is sponsored by XML.org, an initiative of OASIS
> > > > > > <http://www.oasis-open.org>
> > > > > >
> > > > > > The list archives are at http://lists.xml.org/archives/xml-dev/
> > > > > >
> > > > > > To unsubscribe from this elist send a message with the single word
> > > > > > "unsubscribe" in the body to: xml-dev-request@lists.xml.org
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
> ------------------------------------------------------------------
> The xml-dev list is sponsored by XML.org, an initiative of OASIS
> <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To unsubscribe from this elist send a message with the single word
> "unsubscribe" in the body to: xml-dev-request@lists.xml.org
>