473,414 Members | 1,697 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,414 software developers and data experts.

'ss' is an undeclared namespace."

I am trying to insert a node (Row) in excel xml file. While trying to create a node and assign it to XMLDocumentFragment object it throws an error " 'ss' is an undeclared namespace." to me.

XmlDocumentFragment docFrag = this.document.CreateDocumentFragment();

docFrag.InnerXml = @" <Row ss:AutoFitHeight=""0"" ss:Height=""127.5"">
<Cell ss:StyleID=""s31""><Data ss:Type=""String"">COA</Data><NamedCell
ss:Name=""_FilterDatabase""/><NamedCell ss:Name=""Print_Area""/></Cell>
</Row>";

I have tried to do the following but this doesn't seems to help:

XmlNamespaceManager ns = new XmlNamespaceManager(document.NameTable);
ns.AddNamespace(String.Empty, "urn:schemas-microsoft-com:office:spreadsheet");
ns.AddNamespace("ss", "urn:schemas-microsoft-com:office:spreadsheet");

What can be the way out of this problem?

Thanks in advance..

Ashish
Aug 16 '07 #1
3 8273
jkmyoung
2,057 Expert 2GB
You won't be just able to set the InnerXML property because it needs the context of the Namespace Manager. Unfortunately MSDN is down at the moment. However, I would recommend using a function that builds the DocumentFragment from a string, and takes the Namespace Manager as the 2nd argument. Hopefully you can find the function from an autosuggest feature in your development tool.
Aug 16 '07 #2
I have the same problem. Please post sample code that will build a DocumentFragment using the Namespace Manager. I am working with VisualStudio, presentationml, and C#.
Apr 25 '10 #3
jkmyoung
2,057 Expert 2GB
I do not blame you for being confused. The implementation is horribly, horribly obfuscated.
Expand|Select|Wrap|Line Numbers
  1. NameTable nameTable = new NameTable();
  2.  
  3. XmlNamespaceManager namespaceManager = new XmlNamespaceManager(nameTable);
  4.  
  5. namespaceManager.AddNamespace("ss", "Excelsomethingsomething");
  6.  
  7. String xmlString = "<Row ss:AutoFitHeight=""0"" ss:Height=""127.5"">
  8. <Cell ss:StyleID=""s31""><Data ss:Type=""String"">COA</Data><NamedCell
  9. ss:Name=""_FilterDatabase""/><NamedCell ss:Name=""Print_Area""/></Cell>
  10. </Row>"
  11. XmlReaderSettings readerSettings = new XmlReaderSettings();
  12.  
  13. readerSettings.ConformanceLevel = ConformanceLevel.Fragment;
  14.  
  15. XmlParserContext parserContext = new XmlParserContext(nameTable, namespaceManager, writer.XmlLang, writer.XmlSpace);
  16.  
  17. XmlReader reader = XmlReader.Create(new StringReader(xmlString), readerSettings, parserContext))
  18.  
Then use XMLDocument.Load(XMLReader)
http://msdn.microsoft.com/en-us/libr...v=VS.100).aspx
Apr 27 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jason Sauer | last post by:
We use "FOR XML EXPLICIT" and "OPENXML" heavily on our SQL 2000 Advanced server. Every now and then we get an "Undeclared Tag ID" error (SQL Error #6806). If I open the stored procedure, modify it...
1
by: Romeo Disca | last post by:
Hello newsgroup, i'm new to xml - what's wrong with this piece code here? i have these two files: test.xml ---- <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE a SYSTEM "test.ent"
2
by: Dominik Amon | last post by:
Hi The Transform engine seams to fool me, first it says: 'xsl' is an undeclared namespace. but if i change it to <stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ...
5
by: SenthilSS | last post by:
My application produces XML Data files which have XML namespace qualified XML elements (nodes), but the namespace itself is not declared in the data file. My task is to read these data files in a...
2
by: ~~~ .NET Ed ~~~ | last post by:
It is not the first time I see this happen. I am using VS.NET 2003 with .NET Framework 1.1. In this particular situation I have a custom user control in a windows form. There is a member variable...
0
by: VB Programmer | last post by:
I wanted to access some properties of a panel control that is on a different form. So, I went to the (Declarations) section of my main form (the form with the panel) and changed the panel (called...
4
by: mros | last post by:
I've created three buttons on a form (IsMdiContainer=True), it's mdi parent. I need to disable these buttons from one of my child form. So, I've changed these buttons modifier to Friend Shared...
1
by: Jason Chan | last post by:
DateTime mydate = new DateTime(2006,1,1,0,0,0); string testStr = mydate.ToString("hh:mm:ss"); //return 12:00:00 mydate = new DateTime(2006,1,1,1,0,0) testStr = mydate.ToString("hh:mm:ss");...
1
by: John Slagle | last post by:
I am trying to parse this XML fragment: <xsl:apply-templates select="_APPLICATION/MORTGAGE_TERMS" mode="attrSpec"> <xsl:with-param name="elem" select="'LENDERLOANNUM'"> </xsl:with-param>...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.