Creating XML element from XPath

Hi,

Is it possible to automatically create an XML element given an XPath query? 
For example I have the following XML doc:

<topic>
    <title>Hi this is the title</title>
    <description>This is a simple desc</description>
</topic>

Now say I have an XPath query '/topic/age' which will return a null node if 
I run it against the above XML doc. Now is there an easy way to automatically 
create the age node if it doesn't exist? Or do I need to do manual parsing 
and create the node manually?

For the above example probably you'll think that it should be easy to just 
create the age node, but consider the other XPath such as 
'/topic/description/comment' if the description node does not exist I want to 
automatically create it. 

So is this possible to do it with minimal work? I don't want to recreate the 
wheel if .Net already has a simpler way of doing it - just couldn't find it 
at the moment :)

Thanks,

Victor
0
synop (25)
9/20/2004 8:09:04 AM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
498 Views

Similar Articles

[PageSpeed] 43

Reply:

Similar Artilces:

error loading xml file
hello, the $xml loaded the xml file and it did store the xml as a property, but it won't display on screen. i need some help navigate out of the dark many thanks PSH �� $xml = new xml PSH �� $xml.load("h:\windowspowershell\template.xml") PSH �� $xml format-default : Object reference not set to an instance of an object. + CategoryInfo : NotSpecified: (:) [format-default], NullReferenceException + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.FormatDefaultCommand Not 100% sure what you are trying to do here but for a star...

OWA
SBS 2003 SP1, Exch 2003 SP2, FBA w/ SSL. If I add/delete a calendar event via OWA, I get a 5.1.7 NDR in my Inbox (pasted below). The calendar item is added/delete, and I see it in OWA or Outlook. I haven't seen any other posts similar to this, nothing on MS support. Any clues? ========== Your message did not reach some or all of the intended recipients. Subject: Sent: 12/21/2006 8:24 AM The following recipient(s) could not be reached: System Attendant on 12/21/2006 8:24 AM The e-mail address could not be found. Perhaps the recipient moved to a different e-mail organization, or t...

how do I increase drop list font and box size I created
Font is small and you have to scroll through list due to box size If the dropdown was created using Data Validation.............Font size is set at 8pt Dropdown box height cannot be changed. For workarounds like using a ComboBox and using Zoom see Debra Dalgleish's site on DV Lists. http://www.contextures.on.ca/tiptech.html Gord Dibben MS Excel MVP On Fri, 4 Apr 2008 11:36:02 -0700, cdietz1 <cdietz1@discussions.microsoft.com> wrote: >Font is small and you have to scroll through list due to box size ...

XSD doesn't validate XPath
I'm fairly new to xsd. I'm validating xml against xsd using XmlReaderSettings. It looks like my xsd does not verify the element path: My schema definition allows for both OrderProperties and OrderPartners elements, however Partner can be specified only under OrderPartners. In other words, the correct path is OrderPartners/Partner, not OrderProperties/Partner. My xml contains OrderProperties/Partner ONLY and my xml validation code does not give me an error (I'm sure the code is working since it's giving me other errors such as invalid value for an attribute or missing ele...

Create MDI Child inside a thread?
I have attempted this through a CWinThread derived class but have been unable to get the window creation to work correctly. This is what I have so far: BOOL CSecurityFrameThread::InitInstance() { CRuntimeClass *pRT = RUNTIME_CLASS( CSecurityFrame ); CFrameWnd *pFrame = (CFrameWnd *)pRT->CreateObject(); CCreateContext ct; ct.m_pCurrentDoc = NULL; ct.m_pCurrentFrame = (CFrameWnd *)m_pParent; ct.m_pLastView = NULL; ct.m_pNewDocTemplate = NULL; BOOL bSuccess = pFrame->LoadFrame(IDR_TRUSSVIEWER, WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_CHILD...

vs.net xml parser
hi anyone know of a C++ (ansi) XML parser which uses Visual Studio .Net 2003 compiler?? apz wrote: > anyone know of a C++ (ansi) XML parser which uses Visual Studio .Net 2003 > compiler?? MSXML? -- Oleg Tkachenko [XML MVP] http://blog.tkachenko.com my fault.. was actually lookin for a open source lib... and i did find some options... thanks anyway! "Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message news:uWQXpYK0EHA.1260@TK2MSFTNGP12.phx.gbl... > apz wrote: > >> anyone know of a C++ (ansi) XML parser which uses Visual S...

How to keep display format when exporting XML?
First thank you for taking the time to read about my problem. My problem is this. When exporting my xml data, the time/date values loose their display format. A time of 01:30 am, for example, becomes something like 0.001353 when exported.. What do I need to do to keep the same format as is displayed in Excel? It would sure be great if you could help. Kind regards ...

Difference between XML templates and Active Reports
Why does RMS use XML templates (for receipts and P.O.s) and for most other reports Active Reports? I realize that the XML receipts can not be changed or resorted on the preview screen, but why use not all active reports? Active reports are based on formating the results of a SQL Query - if you can work out the SQL to get the result set you want, you can create almost any report you want. The XML Templates are based on objects internal to RMS, like the current transaction for reciept printing, the active PO or Transfer request for PO prining, or a given customer for Statements. Y...

Toolbox wizard to create Command Button
Access 2003 Windows XP Professional I used the Control Wizard on the Toolbox to create a Command Button to close the form. When I try to use it it will not run and returns this error message - The expression On Click you entered as the event property setting produced the following error: Expected: list separator or ). * The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]. * There may have been an error evaluating the function, event, or macro. Any ideas why? I'm at a loss. Check to see if you haven't changed the name ...

Creating an AD account don't make the mailbox in exch2K3
Hi, I don't understand what's happening. When I create a new account in AD, it no longer creates the mailboxes in exchange 2003. It was working a week ago... It asks me if I also want to create a mailbox, I answer YES and ... no mailbox. Please help me, I must create this mailbox quickly since a new employee arrived and my boss doesn't understand why the mail is not set yet. I believe that the mailbox is actually created only after the first message is sent to it or there is a first logon. So if you are looking for it and you do not see it, this may be the cause. Frank &qu...

create price list from excel sheet
I have been using Excel 2003 to manage a list of approximately 200 items. This is a very simple list comprising of four or five fields one of which is the price. I prefer to use Excel to manage this data because it then becomes very simple for me to use formulas in order to calculate prices after changes or additions to the items. I would like to produce a simple A5 flyer listing all the items together with their prices. What will be the best way to do this? I have explored the possibility of exporting the Excel sheet into something like Microsoft publisher but I am looking for a fa...

create a report using vba to select the names for the report
Hi, I need to create a report of selected Customers, I have gone as far as creating a string with customer names in it. Whats next? sample = Selected_Customer_Names= [ABC], [test], [New], [A New One] ...... and so on. Is this correct for the report and/or how do i open the report with the above only listed? -- Message posted via http://www.accessmonster.com On Wed, 28 Apr 2010 03:47:34 GMT, "trevorC via AccessMonster.com" <u44860@uwe> wrote: >Hi, >I need to create a report of selected Customers, I have gone as far as >creating a string with ...

VS2003
Hello, I have a dialog resource and have created CDialog and a CFormView classes for this dialog. If I right-click a control in my dialog I can create a variable for the control, but how do I specify which class the variable belongs to, ie. my CDialog or CFormView class? I don't see how I can tell the add variable class wizard to which class the variable should be added. I'm converting a Dialog based app to a doc-view type app and am experimenting with CFormView, which is why I have CFormView and CDialog classes referencing the same dialog resource. Thanks for any help. -R...

XML Receipt and Conditions
I wanted to make a small adjustment to the receipt when a certain condition is met. If a particular word (eg. family) is typed into the comment on an item I wanted something slightly different to happen to the receipt I've just about got it, just stuck on the condition tag <IF> <CONDITION>len(Entry.Comment)</CONDITION> <THEN> I can get it using len but this makes it happen for any word, is there anyway I can make it so that it is more specific ie Entry.Comment contains '%family%' try <IF> <CONDITION>Entry.Comment like '%family%'&...

rules created in Outlook 2003
I have a client who uses a lot of rules within Outlook 2003 to sort her mail. She is now getting this error when she attempts to create a new rule: "One or more rules could not be uplodaed to Exchange server and have been deactivated. This could be because some of the parameters are not supported or there is insufficient space to store all of your rules." Anyone have any ideas on how I can allow her to create more rules? Thanks. Hi, See this, e2k/e2k3 have the rules limit: http://support.microsoft.com/default.aspx?scid=kb;en-us;147298&Product=exch2k There"s...

XML DATASET problem
I am having big problem manipulating XML in a dataset. I am reading in a schema based on the following XML document. The minute I try to e.g. create a new row I get 'Object reference not set to an instance of an object' error <?xml version="1.0" encoding="utf-8"?> <DocumentElement xmlns="http://tempuri.org/dseditted2.xsd"> <TableInfo> <FieldName>column value</FieldName> <ControlType>column value</ControlType> <IsNull>column value</IsNull> <MaxLength>column value</MaxLength> </TableInfo&g...

DataSet write xml
Hi, I have observed that DataSet.WriteXML() method does not store "Allow Zero Length", "Indexed", and "Required" properties of the fields of a table in the table schema. dataset.WriteXml(stream, XmlWriteMode.WriteSchema) How do I instruct WriteXML() method to include these information along with field name, type and size? <xs:element name="field1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="64" /> </xs:restriction> &...

How to display XML string returned by CRM Accountobject.retrive me
Hi All, Please let me know how i can display the query results fetched from crm database into Datagrid directly. Any help is appreciated. "Vijay Kr. Poriya" wrote: > Hi All, > > Please let me know how i can display the query results fetched from crm > database into Datagrid directly. > > Any help is appreciated. > > Vijay - I assume that you are referring to using the CRMAccount.Retrieve method documented at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/CrmSdk1_2/htm/v1d2crmaccountretrievemethod.asp This method will retrie...

How to create new record
How can i use code to create a new record into a table. Something like this? CreateNewRecord("John","Smith") I tried to Google it but i can't seem to find the answer. help! thanks On Wed, 4 Jul 2007 19:34:03 -0500, "Tim McGavin" <nws@gsw-inc.com> wrote: >How can i use code to create a new record into a table. > >Something like this? > >CreateNewRecord("John","Smith") > >I tried to Google it but i can't seem to find the answer. > >help! >thanks > Open a Recordset based on the table and use ...

Read XML into Dataset and load SQL server table from Dataset
Hello all, I am working on a project with the following characteristics: 1. Load data from a SQL server table to an xml file 2. Read the xml file into a dataset. 3. Load data from the dataset into another SQL server table. I was able to accomplish the first objective. I used the following code to read the generated xml file into a dataset. Dim strXml As String = "C:\Customers.xml" Dim sr As StreamReader = New StreamReader(strXml) Dim ds As DataSet = New DataSet ds.ReadXml(sr, XmlReadMode.IgnoreSchema) How can I traverse in the dataset and post each row to my desired table on ...

How to create a formula?
What do I do to have a result appear automatically in F68 which is the result of F67+C68+E68-D68. Currently I Copy and Paste on F67 & F68. In the cell type =F67+C68+E68-D68 best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "Zygy" <zygy@bt.connect.com> wrote in message news:eDXC$INMHHA.5064@TK2MSFTNGP04.phx.gbl... > What do I do to have a result appear automatically in F68 which is the > result of F67+C68+E68-D68. Currently I Copy and Paste on F67 & F68. > As I said I copy and paste the formula already, but how do I...

RPC Error: creating mail in child domain from mmc User and computer.
Hello, I've an active directory on windows 2000, connected to several childs domains. In my father network i've an exchange 2003. Before i could create mail adress in my child domain from the mmc "user and computer" of my exchange server in my father domain. But now when i want to do " task exchange" on a user i get error : "RPC server is not avaiable, error id : c00706ba...." c00706ba". I don't know if this error is due to the exchange SP1, because i'didn't create new mail account for several month. Someone could help me. Forgive my ba...

Who Created Journal Entry
I am new to Great Plains. Is there a way to find out who created Journal Entries. I see the LASTUSER field in the GL20000. I'm not sure what this field actually represents and when it gets updated. Any resources that anybody could reccomend would be greatly appreciated. This won't help you for the past - but here's an idea for the future. All journal entries have source document of GJ. WE established source document codes as GJ-XX where XX would be each accountants initials. They are instructed to change the source document each time they make an entry. This is not a...

View equations created in Word 2007
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: intel Greetings! I've successfully installed Office 2008 update 12.0.1 on my MacBook Pro running 10.5.2. One of the fixes that was listed in the Microsoft Knowledgebase article associated with the update was the ability to edit equations created in Word 2007 for Windows. After applying the update, I still get a warning message when opening a file created in Word 2007: "This file contains Word 2007 for Windows equations"; the document opens with placeholders (blank squares) instead of the equations. Does anyone el...

creating mde files for spilt databases
HiI'm working with a database which was created in Access 2000 but it is now running in Access 2003. I wanted to split this database and create mde files to add to each users computer but I keep getting an error message which tells me the mde file needs to be created in Access 2000. We no longer have this version of Access so is there a way round it?ThanksJody...