473,657 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlDocumentFrag ment

Would someone help me? What, if anything, is wrong with the following
code fragment?

private XmlNode CreateStyles(Xm lNode parent)
{

XmlDocumentFrag ment df = m_xmlDocument.C reateDocumentFr agment();

df.InnerXml = @"<w:styles> </w:styles>";

return parent.AppendCh ild(df);
}

and without prefix all work fine:

private XmlNode CreateStyles(Xm lNode parent)
{

XmlDocumentFrag ment df = m_xmlDocument.C reateDocumentFr agment();

df.InnerXml = @"<styles></styles>";

return parent.AppendCh ild(df);
}

Can I add xml fragment with prefixes?

Nov 12 '05 #1
1 2315


ap***@tick.ru wrote:
Would someone help me? What, if anything, is wrong with the following
code fragment?

private XmlNode CreateStyles(Xm lNode parent)
{

XmlDocumentFrag ment df = m_xmlDocument.C reateDocumentFr agment();

df.InnerXml = @"<w:styles> </w:styles>";


You need to bind the prefix w to some namespace URI e.g.
df.InnerXml =
@"<w:styles xmlns=""http://example.com/ns1""></w:styles>";

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2

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

Similar topics

4
3899
by: Amy L. | last post by:
It is my understanding that in order to append XML to a file you would have to read the file in as an XML document and insert the node. However, what if the file is close to 1GB in size? Would you require > 1GB of RAM to deal with reading this file in efficiently? Also, is XML an optimal solution when files get this large? I know I can solve my issue by formatting the records contained in my program into a comma delimited format which...
1
25530
by: ryang | last post by:
Hi, XmlElement.OuterXml allows us to get a string representation of a XML element as well as its children but it is get-only and you can't assign OuterXml to a string of XML fragment. Does anyone know a way to convert or create XML element from a string of XML fragment? For example, if I have string xmlfrag = "<FIRST name="first"><SECOND>blah</SECOND></FIRST>"; How do I create an XmlElement with children from the string to be used...
2
1189
by: Paul | last post by:
Is there a way to test if an XmlNode represents an enum?
0
3478
by: Ste | last post by:
I have the following problem..XmlDocumentFragment puts a blank namespace in the output XML I am trying to insert some text "<number of pagses>199</number of pagses>" into the <bookdetails> type. However using the XmlDocumentFragment class i get a blank namespace in the output XML ..see below for an example . Using this code :: // import the BookDetails <BookDetails> from the Soap exception
1
1814
by: Aaron | last post by:
I am trying to imput data in too a xml file. How can it deal with the issues below I try putting in System.XML to see but it give me a error about only having one inherits per class. Partial Class _xxxx Inherits Web.UI.Page
1
3624
by: Joe Monnin | last post by:
I have a web service that takes an XmlDocument as a parameter, performs some processing on it, and saves it to a database. The web service signature looks similar to this: public void SaveDocument(XmlDocument doc) { //Method logic omitted } The web service worked great in .net 1.1, but upon upgrading to .net 2.0 IIS
8
1527
by: murali.trichy | last post by:
Hi, I'm new to dotnet xml. I want to embed my part of xml to existing xml data using xmldocument. I think there is an option but i'm not getting exactly. eg: DocumentElement.InsertAfter is used to insert the node but reference is problem ie how can i give ?
14
11497
by: neerajb | last post by:
Hi, I am having an XML document(input.xml) which is showing the menu heirarchy used in my application.My requirement is to add "submenu" tag to those menuitems who are having the child menuitems as shown in output.xml. I am using VB.NET framework 1.1. Please Help, i have already invested my 2 days but unable to build the logic as input xml may be having any level of nesting of menuitems.
4
3268
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've got a lot of places in our code where we read relatively small xml user preference blocks. Currently that's creating a new XmlDocument in every spot. I was thinking we might see some speed improvements by having one, central XmlDocument and using doc.ReadNode() to process all of the fragments. Other than pumping up the NameTable with a mish-mash of different node names and namespaces, are there any other implications I'm...
0
8385
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, 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...
0
8303
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,...
0
8723
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 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...
1
8502
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
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...
1
6162
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 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...
0
5632
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();...
0
4150
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...
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.