GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes dtd mistake of some kind Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "dtd mistake of some kind" Watch "dtd mistake of some kind" New topic
Author

dtd mistake of some kind

Jay X Brown
Ranch Hand

Joined: Jan 26, 2001
Posts: 51
please help, i am at wits' end at this point.
i am just trying some simple validating parsing and this is the error i am getting.
i attach the result, the dtd fragment and the xml fragment below.
what have i done wrong?
apologies in advance for what i am sure is a stupid mistake.
jb
.... result ...
START DOCUMENT
<?xml version='1.0' encoding='UTF-8'?>
ELEMENT: <CustomerInfo
ATTR: Source "Internal"
>
ELEMENT: <username>
CHARS: arai@somewhere.org
END_ELM: </username>
** Parsing error, line 9, uri file:/local/WWW/tomcat-3.2.1/eg2.xml
Element "CustomerInfo" allows no further input; "name" is not allowed.
org.xml.sax.SAXParseException: Element "CustomerInfo" allows no further input; "
name" is not allowed.
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at org.xml.sax.SAXException.<init>(Compiled Code)
at org.xml.sax.SAXParseException.<init>(Compiled Code)
at com.sun.xml.parser.Parser.error(Compiled Code)
at com.sun.xml.parser.ValidatingParser$ChildrenValidator.consume(Compile
d Code)
at com.sun.xml.parser.Parser.maybeElement(Compiled Code)
at com.sun.xml.parser.Parser.content(Compiled Code)
at com.sun.xml.parser.Parser.maybeElement(Compiled Code)
at com.sun.xml.parser.Parser.parseInternal(Compiled Code)
at com.sun.xml.parser.Parser.parse(Compiled Code)
at javax.xml.parsers.SAXParser.parse(Compiled Code)
at javax.xml.parsers.SAXParser.parse(Compiled Code)
at echo5.main(Compiled Code)
... DTD fragment ...
<?xml version='1.0' encoding='us-ascii'?>
<!ELEMENT CustomerInfo (username | name | address* | detail*)>
<!ATTLIST CustomerInfo
Source (Internal|External|Unknown) "Internal">
<!ELEMENT username (#PCDATA)>
<!ELEMENT name (LastName, OtherNames)>
... XML fragment ...
<?xml version='1.0' encoding='us-ascii'?>
<!-- The first xml document -->
<!DOCTYPE CustomerInfo SYSTEM "eg3.dtd">
<CustomerInfo
Source="Internal"
>
<username>arai@somewhere.org</username>
<name title="Ms.">
<LastName>Rai</LastName>
<OtherNames>Aishwaria</OtherNames>
</name>
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Shouldn't the element -
<name title="Ms.">
have a corresponding ATTLIST entry in the DTD?
Also ( I'm nitpicking, ) I didn't see the CustomerInfo end tag in your XML document. I hope it is there

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Jay X Brown
Ranch Hand

Joined: Jan 26, 2001
Posts: 51
it has the attribute, i just didn't paste it here. but it wasn't getting to that point but just terminating after the name.
i just got it to work a second ago by replacing
<!ELEMENT CustomerInfo (username | name | address* | detail*)>
with
<!ELEMENT CustomerInfo (username, name, address*, detail*)>
---
i knew it was a silly mistake.
 
GeeCON Prague 2014
 
subject: dtd mistake of some kind