Reading a specific node off an XML file, then copying it into a different XML file.

Here's the scenario, I am doing an XML data store of applicants. Once I view the list, which I've done, I want to
approve or deny an entry of my choice. How do I go about approving one node, which, I believe I can specifically
view any one I choose, but then, I want to send the ones I approve to a seperate XML file. Basically, I could do
a few things, maybe read the one node I approve to a variable that stores it, then write it to an XML file, I need
help. Any would be appreciated on how to do this.
0
jlrolin
10/19/2005 1:57:30 AM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

5 Replies
1012 Views

Similar Articles

[PageSpeed] 47

How do I go about approving one node??

<APPLICANTLIST>
    <APPLICANTS APPROVED="FALSE">
        <ID>1</ID>
        <NAME>TEST</NAME>
    </APPLICANTS>
    <APPLICANTS APPROVED="FALSE">
        <ID>2</ID>
        <NAME>TEST2</NAME>
    </APPLICANTS>
</APPLICANTLIST>

You can set separate attribute for approval.
Every time you approve the applicant set "APPROVED" attribute to true.

eg you approved Applicant1 then

<APPLICANTLIST>
    <APPLICANTS APPROVED="TRUE">
        <ID>1</ID>
        <NAME>TEST</NAME>
    </APPLICANTS>
    <APPLICANTS APPROVED="FALSE">
        <ID>2</ID>
        <NAME>TEST2</NAME>
    </APPLICANTS>
</APPLICANTLIST>


If you are satisfied on this point post back
then only we can move to selection and writing approved node to xml.

My Blog: DotNetError@BhatiaWorld

Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
0
BhatiaWorld
10/19/2005 6:19:14 AM
Thanks for your help, it is most appreciated. I have taken the time to outline
my XML data with the approved="true" or approved="false". I have a few
functions within my ASP that edits the detail and views detail, as well as, updates
the detail. However, how do I change the approved tag to false or true depending
on whether I'm approving it or not? My edit detail code just makes text fields out
of the data, and then reiterates through all the data checking for changes and
making them.
0
jlrolin
10/19/2005 3:52:05 PM
I can't seem to figure out how to change the child value on contact approved
to true by searching for a certain subchild.
0
jlrolin
10/19/2005 4:33:50 PM
Working on this all day, been stuck, here's my XML file: apply.xml

<?xml version="1.0"?>
<applicants>
 <contact approved="false">
  <field id="id" taborder="1">
   <field_value>1</field_value>
  </field>
  <field id="firstName" taborder="2">
   <field_value>Reggie</field_value>
  </field>
  <field id="lastName" taborder="3">
   <field_value>Wallace</field_value>
  </field>
  <field id="address1" taborder="4">
   <field_value>202 East Haverbrook</field_value>
  </field>
  <field id="address2" taborder="5">
   <field_value>Oklahoma City, OK 73114</field_value>
  </field>
  <field id="phone" taborder="6">
   <field_value>4055551234</field_value>
  </field>
  <field id="ssn" taborder="7">
   <field_value>432548765</field_value>
  </field>
  <field id="primaryskill" taborder="8">
   <field_value>Welding</field_value>
  </field>
 </contact>
 <contact approved="false">
  <field id="id" taborder="1">
   <field_value>2</field_value>
  </field>
  <field id="firstName" taborder="2">
   <field_value>George</field_value>
  </field>
  <field id="lastName" taborder="3">
   <field_value>Meers</field_value>
  </field>
  <field id="address1" taborder="4">
   <field_value>119 S. Country Ave.</field_value>
  </field>
  <field id="address2" taborder="5">
   <field_value>Normal, IL 61761</field_value>
  </field>
  <field id="phone" taborder="6">
   <field_value>3328065434</field_value>
  </field>
  <field id="ssn" taborder="7">
   <field_value>654321232</field_value>
  </field>
  <field id="primaryskill" taborder="8">
   <field_value>Carpentry</field_value>
  </field>
 </contact>
</applicants>

For the subchild field value, I want to pass an ID from the previous page of listed applicants of that of the users choice, I've done so, but I want to grab it, then find that record with that ID, then change that record's approved status to true.

0
jlrolin
10/19/2005 8:23:59 PM
Hi,


It will be better if you restructure the xml in this way.

<applicants>
<contact approved="false">
     <id taborder="1">1</id> 
      <firstName taborder="2">Reggie</firstName>
      <lastName taborder="3">Wallace</lastName>
      <address1 taborder="4">Wallace</address1>
      <address2 taborder="5">Wallace</address2>
      <phone taborder="6">4055551234</phone>
      <ssn taborder="7">432548765</ssn>
      <primaryskill taborder="8">Welding</primaryskill>
</contact>
<contact approved="false">
     <id taborder="1">2</id> 
      <firstName taborder="2">Reggie2</firstName>
      <lastName taborder="3">Wallace2</lastName>
      <address1 taborder="4">Wallace2</address1>
      <address2 taborder="5">Wallace2</address2>
      <phone taborder="6">4055551234</phone>
      <ssn taborder="7">432548765</ssn>
      <primaryskill taborder="8">Welding</primaryskill>
</contact>
</applicants>
     
 


It is difficult to handle the xml in your case
You have to check attribute as they all have same xml element name.
Your xml is valid but not properly structure.

My Blog: DotNetError@BhatiaWorld

Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
0
BhatiaWorld
10/20/2005 6:38:44 AM
Reply:

Similar Artilces:

Load XMl file and read xml file
How do I load and read nodes from the xml file in c#.??? ThankYou Sample code: http://www.kirupa.com/net/reading_xml_directly_pg1.htmJack Yang.NET Developer Here is how you read xml file and loop and display nodesXmlDocument xDoc = new XmlDocument();xDoc.Load(xmlPath); foreach(XmlNode node in xDoc.SelectNodes("//nodeName you want to display")){Response.Write("name: " + node.Attributes["name"].InnerText + " value: " + node.Attributes["value"].InnerText);}...

Splitting XML file to different XML files
hi,I have xml file that represent a table , one of the element(column) of the xml represent category..I want to split the xml file to different xml files base on the categories (each xml file will represent different category).The question is , if it posible to split the original xml using one xslt file, or i must create different xslt file for each category?thanks in advance one xslt for each output.You can also do this with XmlDocument and save it to two seaprate paths.HTHRegards,Rob...

Replace a node from 1 xml file with a node from another xml file
Hi,  suppose i have these 2 xml files: File 1: <resultset morerecords="0" paging-cookie="1">accountid last="{D14D44AD-36D0-DC11-AA32-0003FF33509E}" first="{D14D44AD-36D0-DC11-AA32-0003FF33509E}" /></cookie>"> <result> ... <donotpostalmail name="Allow">0</donotpostalmail> <name>Adventure Works</name> <primarycontactid name="Abhijit Thakur" dsc="0" yomi="Abhijit Thakur">{0820590A-37D0-DC11-AA32-0003FF33509E}</primarycontactid>...

XML Transform to 1 XML file to another XML File
Hello All  I am a novice programmer. I want to transform 1 xml file to another xml file. I am looking for a example code where user will select source xml file and create another xml file in different file with different fields with some default validation of parsing date and default values.  Can anyone help me or let me know any available source code in C#/ASP.Net?  Ms Disha I am assuming you know xslt, if not, you would have to go look at that.  But if you do, then this document will help you out http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=...

XML Read issue with specific xml file
Hi Everyone! I wonder if you could help me, I'm desperately struggling to do something in ASP.NET 3.5 (VB) that I had working in Classic ASP. I am reading from various XML files without any trouble at all using code from CodeProject. An example of an XML file that's working correctly is: <family> <name gender="Male"> <firstname>Tom</firstname> <lastname>Smith</lastname> </name> <name gender="Female"> <firstname>Dale</firstname> <lastname>Smith</lastname> <...

How to read XML file that's not of .xml file type?
In my app, I'm getting an error because the XML file I'm accessing is not of the .xml file type. The file I'm accessing is: http://p.moreover.com/cgi-local/page?c=ASP%20news&o=xml_1 Is there anyway I can work around this to make the file accesible? The line of code I'm using to read the XML file is below FS = New FileStream("http://p.moreover.com/cgi-local/page?c=ASP%20news&o=xml_1",FileMode.Open,FileAccess.Read) 'prince I don't think you can open file via HTTP using FileStream. FileStream works with file system paths. Try HttpWebRequest instead (HttpWe...

After download a xml file, why my xml file has been changed?
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click        Dim fileName As String = Server.MapPath("~/Products.xml")        Response.Clear()         Response.ContentType = "text/xml"        Response.AddHeader("Content-Disposition", "attachment; filename=" & fileName)                Response.WriteFile(fileName)  ...

Create an XML file from another XML file
I am using VS 2005 with C#.  I would like to create/generate an xml file from another XML with a differnt structure.  Basically, I want to create the actual xml file for my users whenever they raise my web service method. This is the actual structure of my xml i would like to create the following <Education>  <mydata>    <year>1988 - 1995</year>    <reward>High School Diploma</reward>    <school>Miami Secondary</school>  </mydata>  ...</Education> The original ...

How can i add a xml file to an other xml file?
such as i have a xml file : <item1> <item2> <item3>aaa</item3> <item4>bbb</item4> </item2> <item1> an other one is: <item2> <item3>ccc</item3> <item4>ddd</item4> <item2> i wanted is: <item1> <item2> <item3>aaa</item3> <item4>bbb</item4> </item2> <item2> <item3>ccc</item3> <item4>ddd</item4> <item2> <item1> thanks. You ca...

XML reading from xml file but not from webpage
Hi, The following code works fine when reading from an xml file:    xmlfile = Server.MapPath("xml") & "\Jobs.xml" But when I try to read from an external xml source it gives an error: The given path's format is not supported. xmlfile = Server.MapPath("xml") & http://xxxxxxxxxxxxxxxxxxxxx/ Can anyone help? Thanks. Clare   Server.MapPath maps to local resources. In your case, it maps the physical path to the xml folder and looks for Jobs.xml inside that. To get data from an an external source, take a look at the XmlDocument class, specifically the Load()...

read XML tag in XML file
Is there a way to read the XML tags being sent in an XML file? I can import the data fine, but I need to check for a certain XML tag. ...

New to XML (how to read xml file)
I want to read the following XML file....could you give me the code how to do this....this will help me alot ..<siteMapNode1>    <siteMapNode2 url="url1" title="title1"  description="desc1" />    <siteMapNode2 url="url2" title="title2"  description="desc2" /></siteMapNode1>thanks a lot in advance...........  check this link, it might contain what you are looking for. http://samples.gotdotnet.com/quickstart/howto/doc/Xml/ReadXMLFile.aspx    thanks du...

xml read Error (while reading xml file with foriegn characters)
------=_Part_71356_21654157.1168239182303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Guru, I have a problem with reading xml file which has foriegn characters (like plut=F4t) using xml::Simple. I get xml read error. Then I included encoding=3Diso8859-1 at the top of xml file. I am able to read the xml file , but the characters are changed to plut?t instead of plut=F4t, Because of this my test fails. I need to change the file to UTF-8 format. If I include encoding=3D"U...

Any good example for write, read a specific node value from a xml file using C#.net
  Is there any good example for write, read a specific node value from a xml file using C#.netRegards Anu Palavila > using System.Xml; > using System.Xml.XPath; > Insertion: >         XmlDocument xmlDoc = new XmlDocument(); >         xmlDoc.Load(MapPath("~/App_Data/Users.xml")); >         XmlDocumentFragment docFrag = xmlDoc.CreateDocumentFragment(); >         string id = txt_ins_uid.Text; >         string name = txt_ins_uname.Text; >    ...

Web resources about - Reading a specific node off an XML file, then copying it into a different XML file. - asp.net.xml-datasource

Engadget giveaway: Win a 'Star Wars' prize pack courtesy of ThinkGeek!
In case you've been under a rock (or frozen in carbonite), Star Wars: The Force Awakens opens in theaters this Friday. There's been a massive ...

Rajon Rondo Refuses to Apologize for Calling Gay NBA Ref Bill Kennedy a ‘Faggot’
NBA player Rajon Rondo is refusing to apologize for calling gay referee Bill Kennedy a “motherf–king faggot” at a game last week in Mexico City. ...

No 3D Touch for iPad Air 3 Due in First Half of 2016, iPhone 7’s 3D Touch Tech Similar to iPhone 6s
KGI Securities analyst Ming-Chi Kuo has issued a research note obtained by MacRumors that predicts the iPad Air 3 will be released in the first ...

Saudi Arabia announces ‘Islamic military coalition’ with 34 nations to counter terrorism
State-run Saudi Press Agency released a statement that terrorism constitutes 'a serious violation of human dignity and rights, especially the ...

The Latest: San Bernardino Attack Influenced School Closure
The Latest: San Bernardino attack influenced decision to shut Los Angeles schools after threat

Seattle lets Uber drivers join union in US first
Seattle has passed a measure allowing drivers of smartphone-based taxi companies like Uber and Lyft to unionize over pay and other working conditions, ...

Cosby sues 7 accusers for defamation, seeks damages and retractions
wreg.com Cosby sues 7 accusers for defamation, seeks damages and retractions wreg.com NEW YORK CITY: Bill Cosby has struck back against some ...

Front page of the day: Is that drone registered?
Today’s front page of the day comes from the Omaha (Nebraska) World-Herald. On Tuesday, the World-Herald looked at drone regulation around the ...

Immigration Agents Legally Can’t Look at Visa Applicants’ Social Media, May Miss Obvious Evidence Of ...
Immigration officials are forbidden, by policy, from looking at the social media presence of visa applicants, a policy that may have allowed ...

Kim Kardashian is having her placenta freeze-dried & made into vitamin pills
I’m sort of “over” the placenta-eating conversation. The subject was strange/enchanting when January Jones talked about freeze-drying her placenta ...

Resources last updated: 12/15/2015 4:38:38 PM