473,387 Members | 1,435 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ATTLIST id ID not working?

Greetings!

Not sure if this is the right place to post this or if I should post in the
Java newsgroup.

I have a DTD which specifies:

<!ATTLIST category id ID #IMPLIED>

In my xml document I have:

<category id = "Barber and Beauty Salons">
..
..
..
<category id="Attorneys">
..
..
..
<category id = "Florists">

My thinking is that the DTD has specified id as a unique ID.

When I try this in my jsp page:

Element test = doc.getElementById("Attorneys");
out.println("Testing " + test);

All I get for test is null. Is this a feature, bug or somthing I'm doing
wrong? :-))

Eric

Jul 20 '05 #1
4 3213
eric <er********@earthlink.net.spamno> writes:
<!ATTLIST category id ID #IMPLIED> <category id = "Barber and Beauty Salons">


ID-attribute values cannot contain spaces. See
http://www.w3.org/TR/REC-xml#id

-- Alain.
Jul 20 '05 #2
eric wrote:
<!ATTLIST category id ID #IMPLIED>

In my xml document I have:

<category id = "Barber and Beauty Salons">
This does not match the production rules for ID (contains whie space).
..
..
..
<category id="Attorneys">

When I try this in my jsp page:

Element test = doc.getElementById("Attorneys");
out.println("Testing " + test);

All I get for test is null. Is this a feature, bug or somthing I'm doing
wrong? :-))


Hmm, maybe you're not parsing with validation switched on.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)

Jul 20 '05 #3
Johannes,

Thanks for pointing out the whitespace! It did not make any difference
though.

I should have put this in my original post. Here's how I set up the
validation:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating (true);

if(dbf.isValidating())
out.println("It is validating <br />");

I get no errors and the out.println displays. I wonder why the white space
in the id wasn't caught?

Still getting null for doc.getElementById("Attorneys");

Eric
Johannes Koch wrote:
eric wrote:
<!ATTLIST category id ID #IMPLIED>

In my xml document I have:

<category id = "Barber and Beauty Salons">


This does not match the production rules for ID (contains whie space).
..
..
..
<category id="Attorneys">

When I try this in my jsp page:

Element test = doc.getElementById("Attorneys");
out.println("Testing " + test);

All I get for test is null. Is this a feature, bug or somthing I'm doing
wrong? :-))


Hmm, maybe you're not parsing with validation switched on.

Jul 20 '05 #4
Hello Eric,

Try the following print statement instead.

Element test = doc.getElementById("Attorneys");
out.println("Testing " + test.getNodeName());

We've run into the same problem before. Usually I would expect the
Java object value to be printed, but it always returns a null for XML
Node objects.

Check the API for the Node class for a table of values that will be
returned depending on the method called for a specific implemenation of
the Node class.

Kind regards,
Eric

eric wrote:
Greetings!

Not sure if this is the right place to post this or if I should post in the
Java newsgroup.

I have a DTD which specifies:

<!ATTLIST category id ID #IMPLIED>

In my xml document I have:

<category id = "Barber and Beauty Salons">
.
.
.
<category id="Attorneys">
.
.
.
<category id = "Florists">

My thinking is that the DTD has specified id as a unique ID.

When I try this in my jsp page:

Element test = doc.getElementById("Attorneys");
out.println("Testing " + test);

All I get for test is null. Is this a feature, bug or somthing I'm doing
wrong? :-))

Eric


Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gary | last post by:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)"); This is not working ..what could be the...
6
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
8
by: Hardy Wang | last post by:
Hi: Is it possible for me to create/open web application from remote machine other than port 80? And create application directly under virtual web site instead of creating a virtual directory?...
5
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We...
5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
8
by: jojobar | last post by:
Okay, I am trying to do is to test the webresource in 2.0 1. I created a new project with assembly name (and default assembly name) "Office". 2. I added the following to the AssemblyInfo.cs...
2
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.