Rendering XML to form and saving it back to XML

G

Guest

I have a XML file as below
----------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" standalone="yes"?>

<BorrowerContainer>
<ID_BorrowerID value = "BO_1"/>
<BOCO_REOPropertiesNo value = "1"/>
<BorrowerName>
<BN_LastName value = "TESTCO"/>
<BN_FirstName value = "NHI"/>
<BN_FullName value = "NHI TESTCO"/>
</BorrowerName>
<BorrowerContact>
<BC_HomePhoneNumber value = "5525235515"/>
</BorrowerContact>
<BorrowerProfile>
<BP_SSNo value = "SS000158634"/>
<BP_ApplicantType value = "Applicant"/>
<BP_Citizenship value = "USCitizen"/>
<BP_EntityType value = "Individual"/>
<BP_MaritalStatus value = "Married"/>
<BP_BorrowerAge value = "37"/>
<BP_DependentsNo value = "0"/>
<BP_IsPrimaryBorrower value = "Y"/>
<BP_YearsInCurrentProfession value = "0"/>
<BP_EmploymentGaps value = "0"/>
<BP_ResidualIncomeAmount value = "4363.74"/>
</BorrowerProfile>
<BorrowerDeclarations>
<BD_HasIntentToOccupy value = "Y"/>
<BD_HasDeclaredBankruptcy value = "N"/>
<BD_HasForeclosure value = "N"/>
<BD_HasOwnershipInterest value = "Y"/>
<BD_TypeOfPropertyOwned value = "Primary Residence"/>
<BD_HowTitleWasHeld value = "Sole"/>
<BD_HasSupportObligations value = "N"/>
<BD_HasJudgments value = "N"/>
<BD_IsPartyToLawSuit value = "N"/>
<BD_HasLoanObligations value = "N"/>
<BD_HasCurrentFederalDelinquency value = "N"/>
<BD_IsPartDownPaymentBorrowed value = "N"/>
<BD_IsEndorserOnAnyNote value = "N"/>
</BorrowerDeclarations>
<BorrowerResidence>
<BR_OwnOrRent value = "Rent"/>
<BR_ResidenceType value = "Current"/>
<BR_MonthsInResidency value = "84"/>
</BorrowerResidence>
<BorrowerComponentData>
<BorrowerIncome>
<ID_IncomeID value = "IN_1_1"/>
<IN_Type value = "Social Security"/>
<IN_MonthlyAmount value = "4500"/>
<IN_IsTaxFree value = "Y"/>
</BorrowerIncome>
<BorrowerEmployment>
<ID_IncomeReference value = "IN_1_1"/>
<EM_IsSelfEmployed value = "N"/>
<EM_IsWageEarner value = "N"/>
<EM_IsCurrentJob value = "Y"/>
<EM_IsPrimaryJob value = "Y"/>
<EM_MonthsOnJob value = "0"/>
</BorrowerEmployment>
</BorrowerComponentData>
</BorrowerContainer>
<PropertyContainer>
<ID_PropertyID value = "PR_1_1"/>
<PropertyData>
<PD_PropertyType value = "SF Detached"/>
<PD_PropertyStatus value = "Refinance"/>
<PD_IsCurrentResidence value = "Y"/>
<PD_IsSubjectProperty value = "Y"/>
</PropertyData>
<SubjectPropertyData>
<SU_Residency value = "Primary Residence"/>
<SU_UnitsNo value = "1"/>
<SU_AppraisedValue value = "320000"/>
<SU_AppraisedDate value = "10/1/2004"/>
<SU_EstimatedValue value = "320000"/>
<SU_EstateHeld value = "Fee Simple"/>
<SU_MonthlyExpenses value = "1716.26"/>
<SU_IsRural value = "N"/>
</SubjectPropertyData>
<PropertyAddress>
<AD_AddressOf value = "Subject"/>
<AD_Address value = "331 BOUNDARY S ST "/>
<AD_CityName value = "SAN DIEGO"/>
<AD_StateCode value = "CA"/>
<AD_ZipCode5 value = "92104"/>
<AD_Area value = "CA"/>
</PropertyAddress>
<LienContainer>
<ID_LienID value = "LN_1_1"/>
<LC_TradelineRef value = "1"/>
<LienProfile>
<LP_LienPosition value = "1"/>
<LP_IsNew value = "N"/>
<LP_LoanType value = "Conventional"/>
<LP_LoanNumber value = "3331191433682"/>
<LP_IsToBePaidOff value = "Y"/>
<LP_LienHolder value = "Test HOME"/>
</LienProfile>
<MortgageData>
<MD_LienAmount value = "0"/>
<MD_MonthlyPayment value = "855"/>
<MD_RemainingBalance value = "238750"/>
</MortgageData>
</LienContainer>
<PropertyOwnership>
<ID_BorrowerReference value = "BO_1"/>
</PropertyOwnership>
</PropertyContainer>
</Template>

-------------------------------------------------------------------------------------------------------------------------


I want to render it in a form (like an editable form with textboxes) and the
save button at the bottom.
I am using c# any ideas ..... The above xml can be considered as name value
pair so the rendered form would have label for each field (non editable) and
the corresponding value as text box editable

Thanks
Ken.
 
M

Moe Green

Have you looked at XSL style sheets?
I have a XML file as below;
----------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" standalone="yes"?>

<BorrowerContainer>
<ID_BorrowerID value = "BO_1"/>
<BOCO_REOPropertiesNo value = "1"/>
<BorrowerName>
<BN_LastName value = "TESTCO"/>
<BN_FirstName value = "NHI"/>
<BN_FullName value = "NHI TESTCO"/>
</BorrowerName>
<BorrowerContact>
<BC_HomePhoneNumber value = "5525235515"/>
</BorrowerContact>
<BorrowerProfile>
<BP_SSNo value = "SS000158634"/>
<BP_ApplicantType value = "Applicant"/>
<BP_Citizenship value = "USCitizen"/>
<BP_EntityType value = "Individual"/>
<BP_MaritalStatus value = "Married"/>
<BP_BorrowerAge value = "37"/>
<BP_DependentsNo value = "0"/>
<BP_IsPrimaryBorrower value = "Y"/>
<BP_YearsInCurrentProfession value = "0"/>
<BP_EmploymentGaps value = "0"/>
<BP_ResidualIncomeAmount value = "4363.74"/>
</BorrowerProfile>
<BorrowerDeclarations>
<BD_HasIntentToOccupy value = "Y"/>
<BD_HasDeclaredBankruptcy value = "N"/>
<BD_HasForeclosure value = "N"/>
<BD_HasOwnershipInterest value = "Y"/>
<BD_TypeOfPropertyOwned value = "Primary Residence"/>
<BD_HowTitleWasHeld value = "Sole"/>
<BD_HasSupportObligations value = "N"/>
<BD_HasJudgments value = "N"/>
<BD_IsPartyToLawSuit value = "N"/>
<BD_HasLoanObligations value = "N"/>
<BD_HasCurrentFederalDelinquency value = "N"/>
<BD_IsPartDownPaymentBorrowed value = "N"/>
<BD_IsEndorserOnAnyNote value = "N"/>
</BorrowerDeclarations>
<BorrowerResidence>
<BR_OwnOrRent value = "Rent"/>
<BR_ResidenceType value = "Current"/>
<BR_MonthsInResidency value = "84"/>
</BorrowerResidence>
<BorrowerComponentData>
<BorrowerIncome>
<ID_IncomeID value = "IN_1_1"/>
<IN_Type value = "Social Security"/>
<IN_MonthlyAmount value = "4500"/>
<IN_IsTaxFree value = "Y"/>
</BorrowerIncome>
<BorrowerEmployment>
<ID_IncomeReference value = "IN_1_1"/>
<EM_IsSelfEmployed value = "N"/>
<EM_IsWageEarner value = "N"/>
<EM_IsCurrentJob value = "Y"/>
<EM_IsPrimaryJob value = "Y"/>
<EM_MonthsOnJob value = "0"/>
</BorrowerEmployment>
</BorrowerComponentData>
</BorrowerContainer>
<PropertyContainer>
<ID_PropertyID value = "PR_1_1"/>
<PropertyData>
<PD_PropertyType value = "SF Detached"/>
<PD_PropertyStatus value = "Refinance"/>
<PD_IsCurrentResidence value = "Y"/>
<PD_IsSubjectProperty value = "Y"/>
</PropertyData>
<SubjectPropertyData>
<SU_Residency value = "Primary Residence"/>
<SU_UnitsNo value = "1"/>
<SU_AppraisedValue value = "320000"/>
<SU_AppraisedDate value = "10/1/2004"/>
<SU_EstimatedValue value = "320000"/>
<SU_EstateHeld value = "Fee Simple"/>
<SU_MonthlyExpenses value = "1716.26"/>
<SU_IsRural value = "N"/>
</SubjectPropertyData>
<PropertyAddress>
<AD_AddressOf value = "Subject"/>
<AD_Address value = "331 BOUNDARY S ST "/>
<AD_CityName value = "SAN DIEGO"/>
<AD_StateCode value = "CA"/>
<AD_ZipCode5 value = "92104"/>
<AD_Area value = "CA"/>
</PropertyAddress>
<LienContainer>
<ID_LienID value = "LN_1_1"/>
<LC_TradelineRef value = "1"/>
<LienProfile>
<LP_LienPosition value = "1"/>
<LP_IsNew value = "N"/>
<LP_LoanType value = "Conventional"/>
<LP_LoanNumber value = "3331191433682"/>
<LP_IsToBePaidOff value = "Y"/>
<LP_LienHolder value = "Test HOME"/>
</LienProfile>
<MortgageData>
<MD_LienAmount value = "0"/>
<MD_MonthlyPayment value = "855"/>
<MD_RemainingBalance value = "238750"/>
</MortgageData>
</LienContainer>
<PropertyOwnership>
<ID_BorrowerReference value = "BO_1"/>
</PropertyOwnership>
</PropertyContainer>
</Template>

-------------------------------------------------------------------------------------------------------------------------


I want to render it in a form (like an editable form with textboxes) and the
save button at the bottom.
I am using c# any ideas ..... The above xml can be considered as name value
pair so the rendered form would have label for each field (non editable) and
the corresponding value as text box editable

Thanks
Ken.
 
N

Nick Malik [Microsoft]

you wouldn't happen to have access to Infopath, would you? It is part of
Office 2003. If so, you are practically done already :)

If you have a schema for this document, that's better. If not, create one (I
think the XSD.exe utility that comes with the framework can do it).

Load the schema into Infopath as your data type, and simply drag the entire
structure to the drawing surface. you will have a completely viewable, (and
customizable) surface to make your form look good. Tweak it. Add text,
colors, etc. Save it as a template (.xsn). If your users have Infopath,
then you only need to add the infopath tag to the XML in order for them to
simply open the XML and it will use your template to display the data.

If your users don't have Infopath, then you can extract this template as a
style sheet (the easiest way to create a stylesheet, IMHO). Look in help
for File->Export.

Best developer tool around... and it's part of Office. Go figure.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
G

Guest

Thanks for the info . I do have infopath.
One thing though I was able to show the info in the form . How would i be
able to store the modified values from the textboxes back in the xml format?

Thanks
 
N

Nick Malik [Microsoft]

Couldn't be easier.
When the user clicks Save, an xml file is output with the modified values.

There is a cool feature that you can use in addition. If you want, you can
create a data source in Infopath and submit the entire XML document to a web
service.

Note: Make sure that you, when developing the form, have Office
2003 Service Pack 1 installed on your machine.
If you do, then any user opening the form will be prompted to
also install SP1. This is imperative if you plan to
submit to a web service.
http://support.microsoft.com/default.aspx?scid=kb;en-us;826989

On the other hand, if you are using Sharepoint as your data store (Windows
Sharepoint Services is a free download, as long as the server is running
Windows Server 2003), then the fact that the user clicks Save actually has
the effect of submitting the entire XML document to Sharepoint. (There are
no bugs in this functionality that requires a service pack, thank goodness).

so, a couple of options:
Save -> to file (works fine)
Save -> to Sharepoint (works fine)
Submit -> to Sharepoint (works fine)
Submit -> to Webservice (requires Office SP1 to fix a goofy design
decision)

Hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
Ken said:
Thanks for the info . I do have infopath.
One thing though I was able to show the info in the form . How would i be
able to store the modified values from the textboxes back in the xml format?

Thanks

Nick Malik said:
you wouldn't happen to have access to Infopath, would you? It is part of
Office 2003. If so, you are practically done already :)

If you have a schema for this document, that's better. If not, create one (I
think the XSD.exe utility that comes with the framework can do it).

Load the schema into Infopath as your data type, and simply drag the entire
structure to the drawing surface. you will have a completely viewable, (and
customizable) surface to make your form look good. Tweak it. Add text,
colors, etc. Save it as a template (.xsn). If your users have Infopath,
then you only need to add the infopath tag to the XML in order for them to
simply open the XML and it will use your template to display the data.

If your users don't have Infopath, then you can extract this template as a
style sheet (the easiest way to create a stylesheet, IMHO). Look in help
for File->Export.

Best developer tool around... and it's part of Office. Go figure.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
ken said:
I have a XML file as below;
--------------------------------------------------------------------------
--------------------------------------------
<?xml version="1.0" standalone="yes"?>

<BorrowerContainer>
<ID_BorrowerID value = "BO_1"/>
<BOCO_REOPropertiesNo value = "1"/>
<BorrowerName>
<BN_LastName value = "TESTCO"/>
<BN_FirstName value = "NHI"/>
<BN_FullName value = "NHI TESTCO"/>
</BorrowerName>
<BorrowerContact>
<BC_HomePhoneNumber value = "5525235515"/>
</BorrowerContact>
<BorrowerProfile>
<BP_SSNo value = "SS000158634"/>
<BP_ApplicantType value = "Applicant"/>
<BP_Citizenship value = "USCitizen"/>
<BP_EntityType value = "Individual"/>
<BP_MaritalStatus value = "Married"/>
<BP_BorrowerAge value = "37"/>
<BP_DependentsNo value = "0"/>
<BP_IsPrimaryBorrower value = "Y"/>
<BP_YearsInCurrentProfession value = "0"/>
<BP_EmploymentGaps value = "0"/>
<BP_ResidualIncomeAmount value = "4363.74"/>
</BorrowerProfile>
<BorrowerDeclarations>
<BD_HasIntentToOccupy value = "Y"/>
<BD_HasDeclaredBankruptcy value = "N"/>
<BD_HasForeclosure value = "N"/>
<BD_HasOwnershipInterest value = "Y"/>
<BD_TypeOfPropertyOwned value = "Primary Residence"/>
<BD_HowTitleWasHeld value = "Sole"/>
<BD_HasSupportObligations value = "N"/>
<BD_HasJudgments value = "N"/>
<BD_IsPartyToLawSuit value = "N"/>
<BD_HasLoanObligations value = "N"/>
<BD_HasCurrentFederalDelinquency value = "N"/>
<BD_IsPartDownPaymentBorrowed value = "N"/>
<BD_IsEndorserOnAnyNote value = "N"/>
</BorrowerDeclarations>
<BorrowerResidence>
<BR_OwnOrRent value = "Rent"/>
<BR_ResidenceType value = "Current"/>
<BR_MonthsInResidency value = "84"/>
</BorrowerResidence>
<BorrowerComponentData>
<BorrowerIncome>
<ID_IncomeID value = "IN_1_1"/>
<IN_Type value = "Social Security"/>
<IN_MonthlyAmount value = "4500"/>
<IN_IsTaxFree value = "Y"/>
</BorrowerIncome>
<BorrowerEmployment>
<ID_IncomeReference value = "IN_1_1"/>
<EM_IsSelfEmployed value = "N"/>
<EM_IsWageEarner value = "N"/>
<EM_IsCurrentJob value = "Y"/>
<EM_IsPrimaryJob value = "Y"/>
<EM_MonthsOnJob value = "0"/>
</BorrowerEmployment>
</BorrowerComponentData>
</BorrowerContainer>
<PropertyContainer>
<ID_PropertyID value = "PR_1_1"/>
<PropertyData>
<PD_PropertyType value = "SF Detached"/>
<PD_PropertyStatus value = "Refinance"/>
<PD_IsCurrentResidence value = "Y"/>
<PD_IsSubjectProperty value = "Y"/>
</PropertyData>
<SubjectPropertyData>
<SU_Residency value = "Primary Residence"/>
<SU_UnitsNo value = "1"/>
<SU_AppraisedValue value = "320000"/>
<SU_AppraisedDate value = "10/1/2004"/>
<SU_EstimatedValue value = "320000"/>
<SU_EstateHeld value = "Fee Simple"/>
<SU_MonthlyExpenses value = "1716.26"/>
<SU_IsRural value = "N"/>
</SubjectPropertyData>
<PropertyAddress>
<AD_AddressOf value = "Subject"/>
<AD_Address value = "331 BOUNDARY S ST "/>
<AD_CityName value = "SAN DIEGO"/>
<AD_StateCode value = "CA"/>
<AD_ZipCode5 value = "92104"/>
<AD_Area value = "CA"/>
</PropertyAddress>
<LienContainer>
<ID_LienID value = "LN_1_1"/>
<LC_TradelineRef value = "1"/>
<LienProfile>
<LP_LienPosition value = "1"/>
<LP_IsNew value = "N"/>
<LP_LoanType value = "Conventional"/>
<LP_LoanNumber value = "3331191433682"/>
<LP_IsToBePaidOff value = "Y"/>
<LP_LienHolder value = "Test HOME"/>
</LienProfile>
<MortgageData>
<MD_LienAmount value = "0"/>
<MD_MonthlyPayment value = "855"/>
<MD_RemainingBalance value = "238750"/>
</MortgageData>
</LienContainer>
<PropertyOwnership>
<ID_BorrowerReference value = "BO_1"/>
</PropertyOwnership>
</PropertyContainer>
</Template>
-------------------------------------------------------------------------- and
the
save button at the bottom.
I am using c# any ideas ..... The above xml can be considered as name value
pair so the rendered form would have label for each field (non
editable)
and
the corresponding value as text box editable

Thanks
Ken.
 
G

Guest

I am not sure whether I can use the INFOPATH Solution .
Reasons being
1) Looking for preferably web solution (the rendered xml can be opened in IE
and displaying all the form elements which are editable)
2) The Values in the XML file is going to change everytime since new XML
files with different values but with same attributes/element will be
avilable.. I need to create an application that will load this XML with its
values dynamically .
 
Top