All I could see in the debugger is that they were "First-chance exceptions"
and for the description it said Microsoft C++ exception. I have my exception
settings set to "Stop if not handled", so I was pretty sure it was something
I should have been catching.

Anyway, I was just curious. I wasn't even really trying to create an element
name (just typed the wrong thing) and I thought I'd bring it up to make sure
that was the intentional behavior. Sounds like it is :)



-----Original Message-----
From: Derek Harmon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 10:03 PM
To: [EMAIL PROTECTED]
Subject: Re: Exceptions on createElement with spaces


> I am using xerces 1.4 on win32 and I get exceptions whenever I try to use
> the DOM_Document::createElement if my element name contains spaces. I
really
:  : 
> Are spaces not allowed in element names?

As you suspect, spaces are _not_ allowed in element names.  Element
names must be NCNames.

    An NCName [xmlns-4] starts with a letter or an underscore, and
    then zero or more NCNameChars.

    An NCNameChar [xmlns-5] is a letter, underscore, digit, period,
    dash, combining character [xml-87] or extender [xml-89].

The last two are sets of Unicode characters, none of which are a
space.  ;-)

> If not, should I be catching exceptions that come from the DOM_Element::
> createElement calls?

I'm not clear when you say "Microsoft C++ Exceptions" whether
you mean:

(i) "first-chance exceptions" in the IDDE, which are either errors
that were caught in an attached process, or errors waiting to pop
up a nasty dialog box on your screen.

(ii) "structured exception handling" (SEH) exceptions which was
Microsoft's way of handling exceptions with extended keywords
before ANSI C++ standardized matters.

(iii) ANSI C++ Exceptions (in which case the Microsoft appelation
is unnecessary).

I'd recommend not passing non-NCNames to DOM_Element::
createElement( ) to begin with.  As you mentioned, you wanted
to create a text node.  Create a new DOM_Text object and pass
it to your DOM_Element using DOM_Element::appendChild( ).


Derek Harmon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to