xml을 텍스트 상자 또는 서식있는 텍스트 상자로 가져오고 .xml 파일에서 텍스트 상자로 .xml 파일로 내보낼 수 있지만 텍스트 상자로 가져올 때 내부 데이터 태그뿐만 아니라 태그도 포함됩니다. 이것을 제거하는 방법이 있습니까? 10gez10C# 텍스트 상자에서 XML 태그 제거
-1
A
답변
0
가 나는 고객의 말에 .value 누락 된 밝혀,
많은 감사 : 여기
private void btnimport_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.CheckFileExists = true;
open.InitialDirectory = "@C:\\";
open.Filter = "XML Files (*.xml)|*.xml|All Files(*.*)|*.*";
open.Multiselect = false;
if (open.ShowDialog() == DialogResult.OK)
{
try
{
XDocument doc = XDocument.Load(open.FileName);
var query = from customer in doc.Descendants("Customer")
select new
{
Title = customer.Element("Title"),
Firstname = customer.Element("FirstName"),
Lastname = customer.Element("LastName"),
DateofBirth = customer.Element("DateofBirth"),
Email = customer.Element("Email"),
HouseNo = customer.Element("HouseNo"),
Street = customer.Element("Street"),
Postcode = customer.Element("Postcode"),
Town = customer.Element("Town"),
County = customer.Element("County"),
ContactNo = customer.Element("ContactNo"),
};
txtxml.Text = "";
foreach (var customer in query)
{
txttitle.Text = txttitle.Text + customer.Title;
txtfname.Text = txtfname.Text + customer.Firstname;
txtlname.Text = txtlname.Text + customer.Lastname;
txtdob.Text = txtdob.Text + customer.DateofBirth;
txtemail.Text = txtemail.Text + customer.Email;
txthouseno.Text = txthouseno.Text + customer.HouseNo;
txtstreet.Text = txtstreet.Text + customer.Street;
txtpostcode.Text = txtpostcode.Text + customer.Postcode;
txttown.Text = txttown.Text + customer.Town;
txtcounty.Text = txtcounty.Text + customer.County;
txtcontactno.Text = txtcontactno.Text + customer.ContactNo;
txtxml.Text = txtxml.Text + customer.Title + "\n";
txtxml.Text = txtxml.Text + customer.Firstname + "\n";
txtxml.Text = txtxml.Text + customer.Lastname + "\n";
txtxml.Text = txtxml.Text + customer.DateofBirth + "\n";
txtxml.Text = txtxml.Text + customer.Email + "\n";
txtxml.Text = txtxml.Text + customer.HouseNo + "\n";
txtxml.Text = txtxml.Text + customer.Street + "\n";
txtxml.Text = txtxml.Text + customer.Postcode + "\n";
txtxml.Text = txtxml.Text + customer.Town + "\n";
txtxml.Text = txtxml.Text + customer.County + "\n";
txtxml.Text = txtxml.Text + customer.ContactNo + "\n";
MessageBox.Show("XML has been imported");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
private void btnexport_Click(object sender, EventArgs e)
{
XDocument doc = new XDocument(
new XElement("Booking",
new XElement("Customer",
new XElement("Title", txttitle.Text),
new XElement("FirstName", txtfname.Text),
new XElement("LastName", txtlname.Text),
new XElement("DateofBirth", txtdob.Text),
new XElement("Email", txtemail.Text),
new XElement("HouseNo", txthouseno.Text),
new XElement("Street", txtstreet.Text),
new XElement("Postcode", txtpostcode.Text),
new XElement("Town", txttown.Text),
new XElement("County", txtcounty.Text),
new XElement("ContactNo", txtcontactno.Text)
)));
doc.Save("Bookings.xml");
MessageBox.Show("XML has been saved");
}
는 최종 결과입니다 : 여기
코드입니다 .elements, 예를 들면;
제목 = customer.Element ("제목"). 값
희망이 다른 사람
0
당신은 요소의 값을 선택합니다 아닌 요소
을하는 데 도움이관련 문제
- 1. 대화 상자에서 태그 제거
- 2. Powershell에서 XML 태그 제거
- 3. C# 텍스트 상자에서 마지막 두 문자 제거
- 4. 모든 숫자를 텍스트 상자에서 제거 C#
- 5. 열에서 xml 태그 제거
- 6. 텍스트 상자에서 명확한 URL 제거
- 7. 태그 사이의 텍스트 제거 regex
- 8. json 데이터에서 xml 태그 제거
- 9. 텍스트 영역에서 Html 태그 제거
- 10. 텍스트 서식 지정 태그 제거
- 11. Drupal : 기사에서 태그 텍스트 제거
- 12. 서식있는 텍스트 상자에서 스프레드 시트 서식 제거
- 13. C#으로 HTML 태그 제거
- 14. windows.h를 사용하여 마우스 클릭시 채팅 상자에서 텍스트 제거 (C++)
- 15. 버튼의 텍스트 상자에서 마지막 문자 제거
- 16. 첫 번째 텍스트 상자에서 포커스 제거
- 17. vb.net에서 텍스트 상자에서 특정 단어를 제거 vb.net
- 18. 목록 상자에서 항목 제거
- 19. xml 태그 요소 이름에서 공백 제거
- 20. std :: string에서 모든 xml 태그 제거
- 21. sed를 사용하여 "xml 태그 세트"제거
- 22. xsl을 사용하여 특정 xml 태그 제거
- 23. TestLink XML 파일의 CDATA에서 HTML 태그 제거
- 24. 는 XML 태그 외부 텍스트를 제거 - PHP
- 25. PHP를 통해 문자열에서 특정 XML 태그 제거
- 26. XML 파일에서 디지털 서명 태그 제거
- 27. C#의 리치 텍스트 상자에서 텍스트 선택
- 28. 텍스트 상자에서 XML 문서로 값 저장
- 29. 제거 중복 태그
- 30. C++ Expat XML 태그 지원