Hi,
I've create a web applicatation the create an xml document dynamically.
Now that is does this I would like to add a stylesheet to the xml
document. I'm using the following code:
XmlDocument doc = new XmlDocument();
XmlDeclaration declaration = doc.CreateXmlDe claration("1.0" , "UTF-8",
null);
doc.PrependChil d(declaration);
XmlProcessingIn struction objStyleSheet =
doc.CreateProce ssingInstructio n("xml-stylesheet","") ;
XmlAttribute objAttType = doc.CreateAttri bute("type");
objAttType.Valu e = "text/css";
XmlAttribute objAttHref = doc.CreateAttri bute("href");
objAttHref.Valu e = "xml.css";
objStyleSheet.A ttributes.Appen d(objAttType);
objStyleSheet.A ttributes.Appen d(objAttHref);
It compiles find however when running it shows the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object.
Source Error:
Line 153: objAttHref.Valu e = "xml.css";
Line 154:
Line 155: objStyleSheet.A ttributes.Appen d(objAttType);
Line 156: objStyleSheet.A ttributes.Appen d(objAttHref);
Any help would be much appreciated.
Thanks
Simon 1 1282
It may be that you just have a syntax error in a part of your code. You
should be expecting a finished product like so:
<?xml version="1.0" encoding="UTF-8" standalone="yes "?>
<?xml-stylesheet href="http://www.blogger.com/styles/atom.css"
type="text/css"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"accyboy198 1" wrote:
Hi,
I've create a web applicatation the create an xml document dynamically.
Now that is does this I would like to add a stylesheet to the xml
document. I'm using the following code:
XmlDocument doc = new XmlDocument();
XmlDeclaration declaration = doc.CreateXmlDe claration("1.0" , "UTF-8",
null);
doc.PrependChil d(declaration);
XmlProcessingIn struction objStyleSheet =
doc.CreateProce ssingInstructio n("xml-stylesheet","") ;
XmlAttribute objAttType = doc.CreateAttri bute("type");
objAttType.Valu e = "text/css";
XmlAttribute objAttHref = doc.CreateAttri bute("href");
objAttHref.Valu e = "xml.css";
objStyleSheet.A ttributes.Appen d(objAttType);
objStyleSheet.A ttributes.Appen d(objAttHref);
It compiles find however when running it shows the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object.
Source Error:
Line 153: objAttHref.Valu e = "xml.css";
Line 154:
Line 155: objStyleSheet.A ttributes.Appen d(objAttType);
Line 156: objStyleSheet.A ttributes.Appen d(objAttHref);
Any help would be much appreciated.
Thanks
Simon
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Newgene |
last post by:
Hi, group,
I am trying to dynamically add a method to class by following
this post:
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/2ec2ad7a0a5d54a1/928e91be352c6bfc?q=%22new.code(%22+%22import+new&_done=%2Fgroup%2Fcomp.lang.python%2Fsearch%3Fgroup%3Dcomp.lang.python%26q%3D%22new.code(%22+%22import+new%26qt_g%3D1%26&_doneTitle=Back+to+Search&&d#928e91be352c6bfc
But I got the Error like the below:
...
|
by: NotGiven |
last post by:
I want to learn moer of what I saw in a recent example. They create a page
that created new fields/element. It's not like they were hidden and they
displayed them, they were not there, then the script created them.
It used things like parentnode, insertBefore, appendChildNode,...
Any ideas/direction is appreciated.
|
by: Null |
last post by:
Hello --
I am looking for a way to dynamically generate PDF documents - combining
Crystal Reports and data driven "fields".
For example, I have a template that's essentially a summary document and I
would like to populate certain fields with client names and account data.
Also, I would like to make a "master" PDF that contains all the PDF
summaries in one document -- and use bookmarks if possible.
|
by: John Crowley |
last post by:
I've run into a problem where drop down lists are refusing to data bind with the following error on the DataBind() call
Specified argument was out of the range of valid values. Parameter name: value
Stack trace is showing the error in OnDataBinding event, which I don't hook in the cases where I'm getting this error
ArgumentOutOfRangeException: Specified argument was out of the range of valid values
Parameter name: value...
|
by: Asaf |
last post by:
I am trying to create and use a COM object with C#.NET 2005.
The assembly is set to "Register for COM interop" but when I am trying to
call it from VB on Word 2003 I am getting this error:
Run-time error '-2147024894 (80070002)':
File or assembly name COMTest3, or one of its dependencies, was not found.
The code for the COM:
| |
by: Ed Jay |
last post by:
I generate a DHTML page (a medical report) with dynamically generated text
based on user input (answers to questions). The page length changes
dynamically. I desire that when the page is printed and reaches a specific
length, it terminates printing that page, prints a page number, and then
begins to print the next page using the same header and format as the
previous page. The page uses no tables or paragraph elements, only CSS.
IOW, I...
|
by: Bjorn Sagbakken |
last post by:
Hello
In VS2005:
I am adding buttons and textboxes dynamically into a table, that also
dynamically expands.
So far, so good, actually very nice.
But I am having trouble starting the desired subroutine on postback. To me
it seems like the button click event looks for a client script instead of
going to the aspx codepage and execute the sub there.
The same thing happens with textboxes, where I programatically add
|
by: semomaniz |
last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have set text boxes and labels inside the table rows. I then added a button. All of these are done through code.
The problem that i am having is i can get the value from a text box with resides inside the first panel (out side of panel that is...
|
by: RichB |
last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am
trying to add a tabbed control to the page.
I have no problems within the aspx file, and can dynamically manipulate a
tabcontainer which has 1 panel already, however I want to try create the
TabPanels dynamically. I followed the advice here:
http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe
Stagner)
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |