C# :: Generating And Populating XML File Based Off XSD Schema
Jan 14, 2014
The scenario is that I have an XSD schema; I have generated a C# class using the XSD tool in the Visual studio command line.
I have then created a basic console app, which will populate the first partial class in the generated C# class.
The program will then serialize this data and create an XML in a folder as a proof of concept.
The issue I'm having is working out the best way to populate and serialize all the data from the class, as the XSD it was generated from is quite large.
I would like to be able to randomise the data at a later stage once I have the basic populating and serializing working.
View 6 Replies
ADVERTISEMENT
Feb 1, 2013
I have this program for class where we just need to show that we can read, write to a text and binary file. We also need to populate an array from both a text and binary file. When the user first runs the program, the user is told that text/binary file does not work for reading because they do not exist. The user is then asked to start inpuyting integers into the console and at the same time creating and appending to a text/binary file. These values are also stored into an array as they are being inputted. Later in the program the array is run through a for loop and displayed to the screen. Displaying the array to the screen works fine here.
My problem is when the user runs the program for a second time. The text file is opened and an fgets is run to populate an array based on the numbers in the text file. That array is then used again for the user input and file writing section of the program. When the array is displayed at the end of the program the numbers do not make sense. Some appear to be correct bu most do not. When I do the similar actions to the binary file there is no problems. The text file is amended properly everytime the user runs the program. userInputText[MAXSIZE]is a char array (MAXSIZE is defined at 100000) and both textCount and textCounter are initialized to zero when the program is at this point.
Here is what the code where I believe the program resides. I have also attached the source file.
Code:
textPointer = fopen("textFile.txt", "r");
if (textPointer) {
while(fgets(userInputText, sizeof(int), textPointer) != NULL){
sscanf(userInputText, "%d", &textCount);
userInputText[textCounter] = textCount;
textCounter += 1;
}
View 4 Replies
View Related
Feb 17, 2013
say I have an xml-file. Now what my program does depends on the "element". Is it possible for xml schemas to define the action that the program should do? Ie is the following possible:
<xs:element name="test" hidden=true action=myActionOnTestElement>
And then when xerces' parser reads elements of name "test" it also stores the action & that this element is "hidden". If this is impossible with xerces, is it possible at all with XML parsers?
View 1 Replies
View Related
Jan 3, 2014
We want to generate dynamic resource file for VC++ where the data will come from database (Oracle).
For an example, When a user log in the system, at that time if User is an English User, then some data in english language needs to be loaded in vc++ resource file. If the user is French then French data will be loaded into the resource file.
Right now all the data are hard-coded in the resource file but we want to load it dynamically from database, based on the login-user language.
How to do this dynamic implementation as I am not able to find any such concept in google.
View 8 Replies
View Related
Aug 31, 2013
My question:
-I have a file of fixed length chatracter records each 30 bytes long.
-I want to read them into an array which is 30 (or 31, say to account for the record terminator) characters by 50.
-Is there a simple (possibly elegant, even) way to do this. On my reading of the tutorials so far any method I can come up with seems a bit clunky - rather like the assembler language I used in the 1970s.
View 3 Replies
View Related
Jun 10, 2014
I'm given a .cpp file (for homework), this file populates an array from a file, that contains only numbers, using the standard method of populating an array but I'm supposed to modify it so that the array gets populated using a pointer, pretty simple right? Not so for me, I think I'm still confused on the concept of pointers. Here's what I have so far...
int main()
{
const int MAX_SIZE = 10;
[Code].....
View 1 Replies
View Related
May 3, 2013
Your program will declare a 2-D array of dimensions 20 x 20. The array will be of type "character".
Functions: You will create several functions for this program.
1) One function will take the address of the array and initialize all cells to ' ' (a blank space).
If the 2-D array is odd, then you will create functions that make:
2) a triangle using '*', OR
3) a diamond using '*', OR
4) a bulls-eye using '*'. <=== this one is worth BONUS POINTS!! and is therefore optional.
If the 2-D array is even, then you will create functions that make:
5) checkerboard #1 using '*', OR
6) checkerboard #2 using '*', OR
7) a GIANT checkerboard using '*'. <=== this one is worth BONUS POINTS!! and therefore is optional.
These functions will be called from main, and return nothing. Your program will keep asking the user if they want a different kind of 2-D array and different shape. If not, then quit.
Here is what I have so far. I have only been able to get the triangle work. I have not attempted the bullseye or giant checkerboard as they are for extra credit and I can't get the main program to work.
#include <cstdlib>
#include <iostream>
void clear(char pattern[20][20]);
void triangle(char pattern[20][20], int size);
void diamond(char pattern[20][20], int size);
// void bullseye (char pattern[20][20], int size);
[code]....
View 3 Replies
View Related
Apr 3, 2014
I have two tables
Orders
ID, CreatedDate,CustomerID
1, 03/04/2014, test
OrderDetails
ID,ProductId, ProductName,Quantity,Price,Total
1, 5, Toy, 5, 1.99, 9.95
I have a gridview, im using its 'datasource dropdownlist' to populate it, i have the SQL statement
SELECT Orders.ID, OrderDetails.ProductId, OrderDetails.ProductName, OrderDetails.Quantity, OrderDetails.Price, OrderDetails.Total FROM (OrderDetails INNER JOIN Orders ON OrderDetails.ID = Orders.ID) WHERE (Orders.CustomerId = ?)
where the '?' is parameters source = QueryString, and QueryStringField= email
i have a session that is the customerEmailId, so
string CustomerEmailID = (string)Session["email"];
Response.Redirect("MyAccount.aspx?email=" + CustomerEmailID);//i have tested it and customerEmailid is test
however nothing loads in the GridView
View 1 Replies
View Related
Mar 31, 2014
I am trying to complete this program and as far as I am aware, the only thing not working correctly is populating the listview with my data. I've been stressing over this for a few days and achieving no success. I have to load data from two text files (incidents.txt and technicians.txt), then use a query to populate a listview with all incidents that have been closed. Also, I have to use LINQ for this assignment, so I cannot change anything that would alter my use of that. I'm thinking that perhaps the problem is with my code in form1.cs?Included are all my classes,txt files, etc.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IncidentsByTechnician {
[Code] ....
Incidents.txt
45|1089|LEAGD10 |12|7/9/2012|7/13/2012|Problem upgrading from League Scheduler 1.0|Program fails with error 303 when trying to install upgrade.
46|1016|TEAM10 |14|7/9/2012|7/12/2012|Unable to restore data from backup|Error 405 encountered while restoring backup: File not found.
47|1034|DRAFT10 |13|7/9/2012||Can't activate product|Product activation code invalid.
48|1049|TRNY20 |11|7/9/2012||Unable to print brackets|Program doesn't recognize printer.
Technicians.txt
11|Alison Diaz
12|Jason Lee
13|Andrew Wilson
14|Gunter Wendt
15|Gina Fiori
View 4 Replies
View Related
Sep 7, 2013
I have a program where I will read in a certain .txt file, such as "financial_data.txt" and I will be doing some sorting with this data.
I want my program to write out the sorted data to an output file and I want the name of the output file to be based off of the input name. For example, since my input file is "financial_data.txt", I want the output file name to be "financial_data_out.txt".
I am having a hard time finding examples online and in my reference manuals...
View 4 Replies
View Related
Dec 9, 2013
I am trying to fscanf a file and need to read the variable name 'f9' and 'a2' for example in the sample below and get their corresponding values '8' and '2' and then in my C program set the variables f9 and a2 accordingly (which I can declare as variables). Is this possible?
I making a Sudoku Solver and am thinking I would store the puzzle solution in a 2D array with a1=0, a2=1, etc... where 0, 1 are the array indices... then just print the array as the solution.
Note: The a1, a2, a3, etc... is my own numbering of the indices where the letter corresponds to the row and the number corresponds to the column (starting from 1) which I use when feeding to the solver.
I have a file that has the following format (output of Z3 SMT solver):
sat
(model
(define-fun f9 () Int
8)
(define-fun a2 () Int
2)
(define-fun c5 () Int
6)
)
View 1 Replies
View Related
Apr 24, 2013
I want to create a binary file based on some hex data :
Ex Input Hex :54313032202020303030
Out put like :6
View 2 Replies
View Related
Sep 1, 2014
New file_sorter.c:
#include <stdio.h>
#include <stdlib.h>
#include "sort.h"
#include <string.h>
[Code].....
My issue is now a segmentation fault in my sorting algorithm. In my assignment I was suppose to implement quick and insertion sort for the file, and organised strictly by ASCII values. We were allowed to look up generic algorithms for the sorts, but we have to convert them to comparing char arrays.
I haven't started trying to configure quick sort yet, but I'll supply the generic algorithm as well. keep in mind that the first line in the file contains the number of lines in the file. I'll try not to disappear this time!
sort.c :
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
[Code]....
View 4 Replies
View Related
Dec 4, 2013
I have two classes, productListType and buyerListType, that are each basically linked lists. To create the linked list for an object of productListType, I successfully wrote a non-class function createProductList to read the product data from a text file. The class definition for buyerListType has a data member productBoughtRecord that is of type productListType to aggregate the details of the products purchased by a particular buyer during transactions. I decided to make productBoughtRecord a pointer since the contents of this data member would wax and wane over the course of several transactions, depending on the amount and frequency of payments made by the buyer. I have provided a rough sketch of the class below:
class buyerListType
{
public:
setCustomerInfo( ....., productListType* p);
.
.
.
private:
productListType* productBoughtRecord;
.
.
};
I'm similarly trying to write a non-class function createBuyerList to load the record of customers from a text file. How do I determine what the value of the formal parameter p in member function setCustomerInfo is, in order to be able to set the data member productBoughtRecord? take into consideration that an object of class buyerListType would have multiple buyers with varying amounts of products purchased.
View 11 Replies
View Related
Nov 29, 2014
I'm trying to read a "pointer-based" maze .txt. The first letter in each row corresponds to the room letter...then the letters that follow are North node, East node, South node, and West node respectively. The asterisk indicates an empty room or not a valid option.
Here is what I have come up with, what is happening is after the file is parsed by read_maze it is calling my is_empty function indicating that there is no maze because it doesn't go into the else statement here.
I've attached a sample input file:
maze.txt (130bytes)
Number of downloads: 19
We can't assume the rooms will be in order alphabetically A - Z, We are expecting a maximum of 12 rooms and there is a space between each letter or asterisk.
void Maze::read_maze(string FileName){
string line;
ifstream inStream;
inStream.open(FileName.c_str());
int test = inStream.peek();
int i = 0;
if (!(inStream.fail())){
while (!inStream.eof() && test != EOF){
[code]....
View 5 Replies
View Related
Feb 14, 2013
i can't seem to get my program to save the Set.savv file and encrypt it and decrypt it when user logs back on to there virtual file on a CD and writing it to the disk its self and closing the session
View 8 Replies
View Related
Dec 22, 2014
I'm trying to make a Quiz program based on C++'s Data File Handling capablities. I've attached the code in .txt file and I wonder why I'm getting the error identifier bScience cannot have a type qualifier?
Attached Files QuizPro.txt (9.6 KB)
View 7 Replies
View Related
Mar 10, 2014
i want to display all the contents of a file excluding one based on user input say i have 4 records in the file numbered 1 to 4....the user chooses 2 to exclude it outputs records 1,3,4,4 when it should be records 1,3,4 what am i doing wrong here is the code.its basically displaying the last record in the file twice
void excludeRecord()
{
ifstream read;
read.open("Data.txt");
int recordC =0;
string fnameC = " ";
string lnameC = " ";
[Code]...
View 2 Replies
View Related
Nov 5, 2014
Here is the assignment... Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the student’s name (lastName, firstName middleName), id, number of credits earned as follows :
Doe, John K.
3460 25
Andrews, Susan S.
3987 72
Monroe, Marylin
2298 87
Gaston, Arthur C.
2894 110
Generate the output in the following format :
John K. Doe 3460 25 Freshman
Susan S. Andrews 3987 40 Sophomore
Marylin Monroe 2298 87 Junior
Arthur C. Gaston 2894 110 Senior
The program must be written to use the enum class_level :
enum class_level {FRESHMAN, SOPHOMORE, JUNIOR, SENIOR } ;
and define two namespace globalTypes (tys and fys) for the function :
class_level deriveClassLevel(int num_of_credits) ;
The function deriveClassLevel should derive the class_level of the student based on the number of credits earned.
The first namespace globalType tys should derive the class level based on a two year school policy. And the second namespace globalType fys should derive the class level based on a four year school policy.
Four Year School Policy:
Freshman 0-29 creditsSophomore 30-59 credits
Junior 60-89 creditsSenior 90 or more credits
Two Year School Policy:
Freshman 0-29 creditsSophomore 30 or more credits
and this is the code I have so far...
#include <cstdlib>
#include <iostream>
#include <cctype>
#include <fstream>
using namespace std;
enum class_level {FRESHMAN, SOPHOMORE,JUNIOR,SENIOR};
class_level classLevel;
[Code] .....
My main question is did I use the namespaces and enum correctly? And my second question is whats the best way to input the data from the text file? This is really where I get stuck.
View 3 Replies
View Related
Nov 7, 2014
Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the student’s name (lastName, firstName middleName), id, number of credits earned as follows :
Doe, John K.
3460 25
Andrews, Susan S.
3987 72
Monroe, Marylin
2298 87
Gaston, Arthur C.
2894 110
Generate the output in the following format :
John K. Doe 3460 25 Freshman
Susan S. Andrews 3987 40 Sophomore
Marylin Monroe 2298 87 Junior
Arthur C. Gaston 2894 110 Senior
The program must be written to use the enum class_level :
enum class_level {FRESHMAN, SOPHOMORE, JUNIOR, SENIOR } ;
and define two namespace globalTypes (tys and fys) for the function :
class_level deriveClassLevel(int num_of_credits) ;
The function deriveClassLevel should derive the class_level of the student based on the number of credits earned.
The first namespace globalType tys should derive the class level based on a two year school policy.
The second namespace globalType fys should derive the class level based on a four year school policy.
So I basically did it in parts and got everything working and then had to make the namespace so I had this:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
enum class_level { FRESHMAN, SOPHOMORE, JUNIOR, SENIOR };
[Code] ......
I know I have to clean it up and change it but it ran like it was suppose to. Then I tried adding the global namespaces and I this:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
enum class_level { FRESHMAN, SOPHOMORE, JUNIOR, SENIOR };
class_level classLevel;
[Code] ....
with this i keep getting an error saying tys::deriveClassLevel: must return a value and tys::fys::deriveClassLevel: must return a value. I have been messing around with this part and struggling I thought I used the namespace to run the if statements with the criteria for the years of school. Basically I have been stuck for awhile and trying to change things around but I cant seem to get it to work.
View 2 Replies
View Related
Nov 11, 2014
Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the student’s name (lastName, firstName middleName), id, number of credits earned as follows :
Doe, John K.
3460 25
Andrews, Susan S.
3987 72
Monroe, Marylin
2298 87
Gaston, Arthur C.
2894 110
Generate the output in the following format :
John K. Doe 3460 25 Freshman
Susan S. Andrews 3987 40 Sophomore
Marylin Monroe 2298 87 Junior
Arthur C. Gaston 2894 110 Senior
The program must be written to use the enum class_level :
enum class_level {FRESHMAN, SOPHOMORE, JUNIOR, SENIOR } ;
and define two namespace globalTypes (tys and fys) for the function :
class_level deriveClassLevel(int num_of_credits) ;
The function deriveClassLevel should derive the class_level of the student based on the number of credits earned.
The first namespace globalType tys should derive the class level based on a two year school policy.
and the second namespace globalType fys should derive the class level based on a four year school policy.
Four Year School Policy:
Freshman 0-29 creditsSophomore 30-59 credits
Junior 60-89 creditsSenior 90 or more credits
Two Year School Policy:
Freshman 0-29 creditsSophomore 30 or more credits
NOTE : use ignore() function with ifstream objects whenever you want to ignore the newline character.
For example :
ifstream transferSchoolFile ;
transferSchoolFile.open("student_status.txt", ios::in);
while( !transferSchoolFile.eof()) {
getline(transferSchoolFile,name) ;
transferSchoolFile >> id >> credits;
transferSchoolFile.ignore(); //Used here to ignore the newline character.
….
}
I did this in parts so I got it working with a four year criteria without the user defined name spaces.
include <iostream>
#include <fstream>
#include <string>
using namespace std;
enum class_level { FRESHMAN, SOPHOMORE, JUNIOR, SENIOR };
[Code] ....
So that worked fine then I tried with name spaces -
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
enum class_level { FRESHMAN, SOPHOMORE, JUNIOR, SENIOR };
class_level classLevel;
[Code] ....
I know I have some stuff to mess around with but I am currently stuck with two errors, first -
Error1error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartupC:UsersstephenDocumentsVisual Studio 2013ProjectsinputConsoleApplication1MSVCRTD.lib(crtexe.obj)ConsoleApplication1
then -
Error2error LNK1120: 1 unresolved externalsC:UsersstephenDocumentsVisual Studio 2013ProjectsinputDebugConsoleApplication1.exeConsoleApplication1
View 1 Replies
View Related
Nov 11, 2014
Program Description: Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the student's name (lastName, firstName middleName), id, number of credits earned as follows :
Doe, John K.
3460 25
Andrews, Susan S.
3987 72
Monroe, Marylin
2298 87
Gaston, Arthur C.
2894 110
Generate the output in the following format :
John K. Doe 3460 25 Freshman
Susan S. Andrews 3987 40 Sophomore
Marylin Monroe 2298 87 Junior
Arthur C. Gaston 2894 110 Senior
The program must be written to use the enum class_level :
enum class_level {FRESHMAN, SOPHOMORE, JUNIOR, SENIOR } ;
and define two namespace globalTypes (tys and fys) for the function :
class_level deriveClassLevel(int num_of_credits) ;
The function deriveClassLevel should derive the class_level of the student based on the number of credits earned.
The first namespace globalType tys should derive the class level based on a two year school policy.
and the second namespace globalType fys should derive the class level based on a four year school policy.
Four Year School Policy:
Freshman 0-29 creditsSophomore 30-59 credits
Junior 60-89 creditsSenior 90 or more credits
Two Year School Policy:
Freshman 0-29 creditsSophomore 30 or more credits
NOTE : use ignore() function with ifstream objects whenever you want to ignore the newline character. For example :
ifstream transferSchoolFile ;
transferSchoolFile.open("student_status.txt", ios::in);
while( !transferSchoolFile.eof()) {
getline(transferSchoolFile,name) ;
transferSchoolFile >> id >> credits;
[Code] ....
I know I have some stuff to mess around with but I am currently stuck with two errors, first -
Error1error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartupC:UsersstephenDocumentsVisual Studio 2013ProjectsinputConsoleApplication1MSVCRTD.lib(crtexe.obj)ConsoleApplication1
then -
Error2error LNK1120: 1 unresolved externalsC:UsersstephenDocumentsVisual Studio 2013ProjectsinputDebugConsoleApplication1.exeConsoleApplication1
View 2 Replies
View Related
Mar 9, 2013
I have this program for generating subsets, I need to run it with input n=23. It has been running for the past 5 hours, is it normal???
Code:
/*generate subsets */
int subsets(vector < bool > sub, int i)
{
if (i > n) {
return 0;
[Code] .....
View 2 Replies
View Related
Oct 19, 2014
I have a program that generates random numbers. After the random number is generated, the program asks if you want to generate another random number. However, if you generate another random number, it is always the same as the first random number. How can I fix this?
View 5 Replies
View Related
Feb 16, 2013
I want to generate big random numbers in C(not C++ please).By "big" I mean integers much bigger than srand(time(NULL)) and rand() functions' limit(32767).
I tried writing: (note:I am not able to see "code" tag button in this editor,so I am not using it)
//****
int randomnumber;
srand( time(NULL) );
randomnumber = (( rand() % 33 ) * ( rand() % 33 ) * ( rand() % 33) * ( rand() * 33) * (rand() % 33 )) + 1
//****
But I have doubts about it's randomness quality.Also there is another problem,the program can't know the maximum random number it should use before user input,so maximum random number may need to use much smaller maximum random number according to user input.
Is there a better algorithm to create big random numbers in C?
View 2 Replies
View Related
Jun 9, 2013
I'm creating a game in C++ and need to generate random numbers. I know about
int main()
{
srand(time(NULL)); //Initialises randomiser or sum' like that
int x=rand%10; //Generates from 0-9
cout<<x;
}
Now, I need the best way to generate random numbers. Do I call "srand(time(NULL));" every time I want to randomise? What is the best method to generate a nearly perfect random number?
I may need to call a randomiser more than once a second, so taking second as seed (I believe that's what srand(time(NULL)); does).
View 3 Replies
View Related