Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <TumorDetails>
  2. <personUpi>String</personUpi>
  3. <ageAtDiagnosis>3.14159E0</ageAtDiagnosis>
  4. <biopsyPathologyReportSummary>String</biopsyPathologyReportSummary>
  5. <primarySiteCollection>
  6. <tissueSite>
  7. <description>String1</description>
  8. <name>String1</name>
  9. </tissueSite>
  10. <tissueSite>
  11. <description>String2</description>
  12. <name>String2</name>
  13. </tissueSite>
  14. <tissueSite>
  15. <description>String3</description>
  16. <name>String3</name>
  17. </tissueSite>
  18. </primarySiteCollection>
  19. </TumorDetails>
  20.  
  21. use strict;
  22. use warnings;
  23. use XML::Compile::Schema;
  24.  
  25. my $node = {
  26. personUpi => 'String',
  27. ageAtDiagnosis => '3.14159E0',
  28. biopsyPathologyReportSummary => 'String',
  29. primarySiteCollection => {
  30. tissueSite => {
  31. description => 'String',
  32. name => 'String',
  33. },
  34. },
  35. };
  36.  
  37. my $schema = XML::Compile::Schema->new('sample.xsd');
  38. my $writer = $schema->compile(WRITER => 'TumorDetails');
  39. my $doc = XML::LibXML::Document->new(q(1.0), q(UTF-8));
  40.  
  41. print $writer->($doc, $node)->toString;
  42.  
  43. #!/usr/bin/perl
  44. use strict;
  45. use warnings;
  46.  
  47. use XML::Simple;
  48.  
  49. my $tissueSite = [
  50. {
  51. description => 'String',
  52. name => 'String',
  53. },
  54. {
  55. description => 'String2',
  56. name => 'String2',
  57. },
  58. ];
  59.  
  60. my $data = {
  61. tumorDetails => {
  62. personUpi => 'String',
  63. ageAtDiagnosis => '3.14159E0',
  64. biopsyPathologyReportSummary => 'String',
  65. primarySiteCollection => {
  66. tissueSite => $tissueSite,
  67. },
  68. },
  69. };
  70.  
  71. print XMLout($data, KeepRoot => 1, noAttr => 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement