Error creating Namespace summary

Topics: Bugs, Features, General Discussion
Jun 27, 2007 at 5:33 AM
I'm having some issues with adding some extra content via API Topic Management. Half the time what I type gets wiped. Other times changes in Text are overruled by changes in the HTML pane. And then I get the following error exiting out of the dialog:

*An Error occured while executing a command.
Command: ApiTopicManagement
Tool bar: Doc Project - Sandcastle

An item with the same key has already been added*

Admittedly I'm trying to be tricky and adding some more collapsible sections via explicit HTML. But it's not completely invalid because every once in a while the changes will stick and it compiles just fine. For now i'm just adding the HTML by hand in project.xml.

Should I not be doing this with HTML, but instead using proper sandcastle mark-up in the code? If so, any pointers on the valid mark-up allowed and where to add it for a namespace?

thanks,
arne
Coordinator
Jun 27, 2007 at 6:32 AM
Hi Arne,

Could you describe the steps for me to reproduce the error and the issue with the text not being saved?

You should be able to put any valid XML into the text box. If you can post a sample of what doesn't work for you, I'd appreciate that too.

Thanks,
Dave
Jun 27, 2007 at 4:06 PM
Ok, I can't reliably reproduce the error message. I can reproduce a lot of artifacts but they don't seem to happen consistently.

Generally the issue happens if you edit html in Summary Text mode and switch back to Summary HTML. Some of the time your edits are just wiped out, other times they are accepted.

Sometimes after I get the edit accepted and leave the dialog, when i get back it's replaced with a red Only white space characters should be used.

If I use  
Jun 27, 2007 at 4:11 PM
Dave,

Just wanted to add that I know i've been bugging these forums ever since finding DocProject. I just wanted to let you know I really appreciate the great work you've done creating DocProject. I may be running into issues, but without your help, I wouldn't even have any documentation, because Sandcastle straight up is just way too much trouble for me to even attempt to tackle.

cheeers,
arne
Coordinator
Jun 27, 2007 at 8:28 PM
Hi Arne,

Thanks for the reply.


Ok, I can't reliably reproduce the error message. I can reproduce a lot of artifacts but they don't seem to happen consistently.

Generally the issue happens if you edit html in Summary Text mode and switch back to Summary HTML. Some of the time your edits are just wiped out, other times they are accepted.

I'll see if I can reproduce the issue by just playing around with the dialog.


Sometimes after I get the edit accepted and leave the dialog, when i get back it's replaced with a red Only white space characters should be used.

It appears that the error message comes from the XmlTextWriter class when it throws ArgumentException, but I'm not sure why it's occurring yet. I'll probably have to get my hands on some test HTML to reproduce this problem.

Here's one of the few things I've found about this error on the web, so far:

http://www.infopathdev.com/forums/post/6170.aspx


If I use [?] in the Summary text and switch to Summary HTML it usually just doesn't take the edit. If it does, it properly converts it to [?] but once it saves it to project.xml, that gets turned into normal whitespace. which can screw up rendering.

What goes in the spaces in your post? Just white-space? The characters you have used may have been wiki markup, which can be escaped by wrapping it with {""}.


The problem really comes down to having to do HTML by hand since the HTML editor isn't full featured enough (and neither do i expect it to be) but the HTML editor seems to be needed to verify the html as XHTML compliant and may decide to rewrite it for you.

Yes. When I created the editor I quickly learned that no matter what DocType is used the WebBrowser control will always output HTML markup, which may be invalid as XML. So I had to write an HTML to XML converter class, which you can find in the DaveSexton.Controls.HtmlEditor project.

The converter doesn't actually write XHTML markup though; it only converts HTML to XML as best as it can. This means that you may lose certain formatting. But in testing it appears to work fine for almost anything that you do in the editor, aside from pasting invalid HTML or dragging and dropping elements between other elements. But even then I tried to make the converter preserve as much of the formatting as possible while still turning it into valid XML so that user's wouldn't have to deal with conversion errors, just conversion formatting errors.

I'd also like to extend the HTML editor control. What features are you missing? Do you mean things like guidelines and commands such as a bulleted list?

I'm fine with just doing my work by hand in project.xml, but it might be useful to just stuff Summary Text into CDATA inside project.xml, so that it can be accepted verbatim and XSL can take that text verbatim and not error out on the transform.

That's an interesting idea, but if you use any markup in your CDATA it won't be processed as markup. That means that your summary text could only consist of text and no <see cref=""/> links or in-line code tags (<c></c>) and other useful formatting elements.


Just wanted to add that I know i've been bugging these forums ever since finding DocProject. I just wanted to let you know I really appreciate the great work you've done creating DocProject. I may be running into issues, but without your help, I wouldn't even have any documentation, because Sandcastle straight up is just way too much trouble for me to even attempt to tackle.

I appreciate it.

Part of the reason for making this a free community tool is that the community becomes a test bed for finding bugs that I normally wouldn't find on my own, making DocProject a much better product. So I don't see your repeated posts as bugging me, I just see that you're helping me to fix problems :)

Thanks,
Dave
Jun 27, 2007 at 10:10 PM
Ok it was supposed to be If I use &nbsp; in the Summary text and switch to Summary HTML it usually just doesn't take the edit. If it does, it properly converts it to &#160; but once it saves it to project.xml, that gets turned into normal whitespace. which can screw up rendering.

I need to learn this markup..

Anywaty, regarding the CDATA. I didn't even realize you could use documentation mark-up. Ok, never mind the CDATA. My needs were very fringe and i got the work-around, editing project.xml directly, so i'm good to go
Coordinator
Jun 27, 2007 at 10:40 PM
Hi Arne,

Well I'm glad that editing the project.xml file directly works for you though I'm going to continue to improve the HTML editor so maybe in the future you'll find it to be more usable. I've even thought about adding features that would create code comment markup such as dragging a node from the TOC and having it generate <see cref="...">...</see> in the document automatically.

As for the entity name conversion, &nbsp; is not valid XML marup so it must be converted into its numeric entity reference form, as you've discovered. But unfortunetly its equivalent doesn't have exactly the same semantics. &nbsp; is a non-breaking space and will also always force a space in the output, whereas &#160; is equivalent to just typing a single space character, which may be considered as insignificant by the XmlDocument class depending upon where it's located.

Thanks,
Dave
Coordinator
Jun 29, 2007 at 3:48 PM
Hi Arne,

FYI, I was able to reproduce the issue with the HTML being wiped out. It appears to only happen in one particular situation. If you focus the Summary Text tab while the dialog is loading and then after it loads select a namespace node with an existing summary value, and then switch to the Summary Html tab, the markup is lost. But if you switch to any tab after the dialog has loaded and then proceed in the same way, the markup is not lost.

I'm working on improving the Html Editor control for the next release and I'll try to make sure that this bug is fixed.

Thanks,
Dave