index.html 89 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html lang="en" dir="ltr">
<head>
    <title>Test cases for Canonical XML 2.0</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
     
     
   
    
    <style type="text/css">
table
{
border-collapse:collapse;
}
    
table,th,td
{
border:1px solid black;
}
td
{
 vertical-align: top;
 /* width:300px; */
}
pre 
 { 
  width:300px;
  overflow-x: scroll;
 /* 
  white-space: pre-wrap;       
  white-space: -moz-pre-wrap;  
  white-space: -pre-wrap;      
  white-space: -o-pre-wrap; 
  word-wrap: break-word;
 */      
}
</style>
  <style type="text/css">
/*****************************************************************
 * ReSpec CSS
 * Robin Berjon (robin at berjon dot com)
 * v0.05 - 2009-07-31
 *****************************************************************/


/* --- INLINES --- */
em.rfc2119 { 
    text-transform:     lowercase;
    font-variant:       small-caps;
    font-style:         normal;
    color:              #900;
}

h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    border: none;
}

dfn {
    font-weight:    bold;
}

a.internalDFN {
    color:  inherit;
    border-bottom:  1px solid #99c;
    text-decoration:    none;
}

a.externalDFN {
    color:  inherit;
    border-bottom:  1px dotted #ccc;
    text-decoration:    none;
}

a.bibref {
    text-decoration:    none;
}

code {
    color:  #ff4500;
}


/* --- WEB IDL --- */
pre.idl {
    border-top: 1px solid #90b8de;
    border-bottom: 1px solid #90b8de;
    padding:    1em;
    line-height:    120%;
}

pre.idl::before {
    content:    "WebIDL";
    display:    block;
    width:      150px;
    background: #90b8de;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

.idlType {
    color:  #ff4500;
    font-weight:    bold;
    text-decoration:    none;
}

/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID, .idlDictionaryID {
    font-weight:    bold;
    color:  #005a9c;
}

.idlSuperclass {
    font-style: italic;
    color:  #005a9c;
}

/*.idlAttribute*/
.idlAttrType, .idlFieldType, .idlMemberType {
    color:  #005a9c;
}
.idlAttrName, .idlFieldName, .idlMemberName {
    color:  #ff4500;
}
.idlAttrName a, .idlFieldName a, .idlMemberName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlMethod*/
.idlMethType {
    color:  #005a9c;
}
.idlMethName {
    color:  #ff4500;
}
.idlMethName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlParam*/
.idlParamType {
    color:  #005a9c;
}
.idlParamName {
    font-style: italic;
}

.extAttr {
    color:  #666;
}

/*.idlConst*/
.idlConstType {
    color:  #005a9c;
}
.idlConstName {
    color:  #ff4500;
}
.idlConstName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlException*/
.idlExceptionID {
    font-weight:    bold;
    color:  #c00;
}

.idlTypedefID, .idlTypedefType {
    color:  #005a9c;
}

.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
    color:  #c00;
    font-weight:    normal;
}

.excName a {
    font-family:    monospace;
}

.idlRaises a.idlType, .excName a.idlType {
    border-bottom:  1px dotted #c00;
}

.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
    width:  45px;
    text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }

.idlImplements a {
    font-weight:    bold;
}

dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
    margin-left:    2em;
}

.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
    font-weight:    normal;
}

.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
    font-weight:    bold;
    color:  #000;
    font-family:    monospace;
}

.attributes dt code, .fields dt code, .dictionary-members dt code {
    background:  #ffffd2;
}

.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
    color:  #005a9c;
    background:  transparent;
    font-family:    inherit;
    font-weight:    normal;
    font-style: italic;
}

.methods dt code {
    background:  #d9e6f8;
}

.constants dt code {
    background:  #ddffd2;
}

.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
    margin-bottom:  1em;
}

table.parameters, table.exceptions {
    border-spacing: 0;
    border-collapse:    collapse;
    margin: 0.5em 0;
    width:  100%;
}
table.parameters { border-bottom:  1px solid #90b8de; }
table.exceptions { border-bottom:  1px solid #deb890; }

.parameters th, .exceptions th {
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
    font-family:    initial;
    font-weight:    normal;
    text-shadow:    #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }

.parameters td, .exceptions td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
    vertical-align: top;
}

.parameters tr:first-child td, .exceptions tr:first-child td {
    border-top: none;
}

.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
    width:  100px;
}

.parameters td.prmType {
    width:  120px;
}

table.exceptions table {
    border-spacing: 0;
    border-collapse:    collapse;
    width:  100%;
}

/* --- TOC --- */
.toc a {
    text-decoration:    none;
}

a .secno {
    color:  #000;
}

/* --- TABLE --- */
table.simple {
    border-spacing: 0;
    border-collapse:    collapse;
    border-bottom:  3px solid #005a9c;
}

.simple th {
    background: #005a9c;
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
}

.simple th[scope="row"] {
    background: inherit;
    color:  inherit;
    border-top: 1px solid #ddd;
}

.simple td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
}

.simple tr:nth-child(even) {
    background: #f0f6ff;
}

/* --- DL --- */
.section dd > p:first-child {
    margin-top: 0;
}

.section dd > p:last-child {
    margin-bottom: 0;
}

.section dd {
    margin-bottom:  1em;
}

.section dl.attrs dd, .section dl.eldef dd {
    margin-bottom:  0;
}

/* --- EXAMPLES --- */
pre.example {
    border-top: 1px solid #ff4500;
    border-bottom: 1px solid #ff4500;
    padding:    1em;
    margin-top: 1em;
}

pre.example::before {
    content:    "Example";
    display:    block;
    width:      150px;
    background: #ff4500;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

/* --- EDITORIAL NOTES --- */
.issue {
    padding:    1em;
    margin: 1em 0em 0em;
    border: 1px solid #f00;
    background: #ffc;
}

.issue::before {
    content:    "Issue";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #f00;
    background: #fff;
    padding:    3px 1em;
}

.note {
    margin: 1em 0em 0em;
    padding:    1em;
    border: 2px solid #cff6d9;
    background: #e2fff0;
}

.note::before {
    content:    "Note";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #cff6d9;
    background: #fff;
    padding:    3px 1em;
}

/* --- Best Practices --- */
div.practice {
    border: solid #bebebe 1px;
    margin: 2em 1em 1em 2em;
}

span.practicelab {
    margin: 1.5em 0.5em 1em 1em;
    font-weight: bold;
    font-style: italic;
}

span.practicelab   { background: #dfffff; }

span.practicelab {
    position: relative;
    padding: 0 0.5em;
    top: -1.5em;
}

p.practicedesc {
    margin: 1.5em 0.5em 1em 1em;
}

@media screen {
    p.practicedesc {
        position: relative;
        top: -2em;
        padding: 0;
        margin: 1.5em 0.5em -1em 1em;
    }
}

/* --- SYNTAX HIGHLIGHTING --- */
pre.sh_sourceCode {
  background-color: white;
  color: black;
  font-style: normal;
  font-weight: normal;
}

pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; }           /* language keywords */
pre.sh_sourceCode .sh_type { color: #666; }                            /* basic types */
pre.sh_sourceCode .sh_usertype { color: teal; }                             /* user defined types */
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; }        /* strings and chars */
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; }     /* regular expressions */
pre.sh_sourceCode .sh_specialchar { color: 	#ffc0cb; font-family: monospace; }  /* e.g., \n, \t, \\ */
pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; }         /* comments */
pre.sh_sourceCode .sh_number { color: purple; }                             /* literal numbers */
pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; }       /* e.g., #include, import */
pre.sh_sourceCode .sh_symbol { color: blue; }                            /* e.g., *, + */
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; }         /* function calls and declarations */
pre.sh_sourceCode .sh_cbracket { color: red; }                              /* block brackets (e.g., {, }) */
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; }   /* TODO and FIXME */

/* Predefined variables and functions (for instance glsl) */
pre.sh_sourceCode .sh_predef_var { color: #00008B; }
pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }

/* for OOP */
pre.sh_sourceCode .sh_classname { color: teal; }

/* line numbers (not yet implemented) */
pre.sh_sourceCode .sh_linenum { display: none; }

/* Internet related */
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }

/* for ChangeLog and Log files */
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }

/* for Prolog, Perl... */
pre.sh_sourceCode .sh_variable { color: #006400; }

/* for LaTeX */
pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
pre.sh_sourceCode .sh_argument { color: #006400; }
pre.sh_sourceCode .sh_optionalargument { color: purple; }
pre.sh_sourceCode .sh_math { color: orange; }
pre.sh_sourceCode .sh_bibtex { color: blue; }

/* for diffs */
pre.sh_sourceCode .sh_oldfile { color: orange; }
pre.sh_sourceCode .sh_newfile { color: #006400; }
pre.sh_sourceCode .sh_difflines { color: blue; }

/* for css */
pre.sh_sourceCode .sh_selector { color: purple; }
pre.sh_sourceCode .sh_property { color: blue; }
pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }

/* other */
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
pre.sh_sourceCode .sh_paren { color: red; }
pre.sh_sourceCode .sh_attribute { color: #006400; }

</style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css" charset="utf-8"></head><body style="display: inherit; "><div class="head"><p><a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a></p><h1 class="title" id="title">Test cases for Canonical XML 2.0</h1><h2 id="w3c-working-draft-05-january-2012"><acronym title="World Wide Web Consortium">W3C</acronym> Working Draft 05 January 2012</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2012/WD-xml-c14n2-testcases-20120105/">http://www.w3.org/TR/2012/WD-xml-c14n2-testcases-20120105/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/xml-c14n2-testcases/">http://www.w3.org/TR/xml-c14n2-testcases/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://www.w3.org/2008/xmlsec/Drafts/c14n-20/test-cases/">http://www.w3.org/2008/xmlsec/Drafts/c14n-20/test-cases/</a></dd><dt>Editors:</dt><dd><span>Pratik Datta</span>,  <span class="ed_mailto"><a href="mailto:pratik.datta@oracle.com">pratik.datta@oracle.com</a></span> </dd>
<dd><span>Frederick Hirsch</span>,  <span class="ed_mailto"><a href="mailto:frederick.hirsch@nokia.com">frederick.hirsch@nokia.com</a></span> </dd>
</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2012 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr></div>
<div id="abstract" class="introductory section"><h2>Abstract</h2>
This document outlines test cases for Canonical XML 2.0 [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-C14N20">XML-C14N20</a></cite>].
</div><div id="sotd" class="introductory section"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports index</a> at http://www.w3.org/TR/.</em></p>
<p>
This document outlines test cases for Canonical XML 2.0
[<cite><a class="bibref" rel="biblioentry" href="#bib-XML-C14N20">XML-C14N20</a></cite>] and is intended to become a <acronym title="World Wide Web Consortium">W3C</acronym> Note.
</p>
<p>This document was published by the <a href="http://www.w3.org/2008/xmlsec/">XML Security Working Group</a> as a First Public Working Draft. If you wish to make comments regarding this document, please send them to <a href="mailto:public-xmlsec@w3.org">public-xmlsec@w3.org</a> (<a href="mailto:public-xmlsec-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-xmlsec/">archives</a>). All feedback is welcome.</p><p>Publication as a Working Draft does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>. The group does not expect this document to become a <acronym title="World Wide Web Consortium">W3C</acronym> Recommendation. <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a href="http://www.w3.org/2004/01/pp-impl/42458/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.</p></div><div id="toc" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#sec-Introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#sec-Canonical11" class="tocxref"><span class="secno">2. </span>Examples from Canonical XML 1.0</a><ul class="toc"><li class="tocline"><a href="#sec-Example-OutsideDoc" class="tocxref"><span class="secno">2.1 </span>PIs, Comments, and Outside of Document Element</a></li><li class="tocline"><a href="#sec-Example-WhitespaceInContent" class="tocxref"><span class="secno">2.2 </span>Whitespace in Document Content</a></li><li class="tocline"><a href="#sec-Example-SETags" class="tocxref"><span class="secno">2.3 </span>Start and End Tags</a></li><li class="tocline"><a href="#sec-Example-Chars" class="tocxref"><span class="secno">2.4 </span>Character Modifications and Character References</a></li><li class="tocline"><a href="#sec-Example-Entities" class="tocxref"><span class="secno">2.5 </span>Entity References</a></li><li class="tocline"><a href="#sec-Example-UTF8" class="tocxref"><span class="secno">2.6 </span>UTF-8 Encoding</a></li></ul></li><li class="tocline"><a href="#sec-Namespace" class="tocxref"><span class="secno">3. </span>Dealing with Namespaces</a><ul class="toc"><li class="tocline"><a href="#sec-PushDown" class="tocxref"><span class="secno">3.1 </span>Namespaces declarations are pushed down</a></li><li class="tocline"><a href="#sec-Default" class="tocxref"><span class="secno">3.2 </span>Default namespace declarations</a></li><li class="tocline"><a href="#sec-Sort" class="tocxref"><span class="secno">3.3 </span>Sorting namespace declarations</a></li><li class="tocline"><a href="#sec-Redecl" class="tocxref"><span class="secno">3.4 </span>Namespace Re-declarations</a></li><li class="tocline"><a href="#sec-Superfluous" class="tocxref"><span class="secno">3.5 </span>Superfluous Namespace declarations</a></li><li class="tocline"><a href="#sec-xmlattribs" class="tocxref"><span class="secno">3.6 </span>Special namespaces "xml", "xsi", "xsd"</a></li><li class="tocline"><a href="#sec-PrefixesInContent" class="tocxref"><span class="secno">3.7 </span>Prefixes in Element content</a></li></ul></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">A.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.2 </span>Informative references</a></li></ul></li></ul></div>

 <div id="sec-Introduction" class="section">
<!--OddPage--><h2><span class="secno">1. </span>Introduction</h2>
This document has various test cases for Canonical XML 2.0
[<cite><a class="bibref" rel="biblioentry" href="#bib-XML-C14N20">XML-C14N20</a></cite>]. All the test files are available in this directory: <a href="files/">files</a>. 
<br>
The test cases are organized as follows:
<ul>
 <li><b>Input file</b> All the input files are named starting with "in". 
 e.g. <a href="files/inNsPushdown.xml"><code>inNsPushdown.xml</code></a>.</li>
 <li><b>C14N parameter files</b>The C14n parameters files contain 
 a <code>&lt;CanonicalizationMethod&gt;</code> element containing
  canonicalization parameters. 
  <ul>
  <li><a href="files/c14nDefault.xml"><code>c14nDefault.xml</code></a>: Default canonicalization.</li>
  <li><a href="files/c14nComment.xml"><code>c14nComment.xml</code></a>: Canonicalization with comment removal.</li>
  <li><a href="files/c14nPrefix.xml"><code>c14nPrefix.xml</code></a>: Canonicalization with prefix rewriting.</li>
  <li><a href="files/c14nPrefixQname.xml"><code>c14nPrefixQName.xml</code></a>: Canonicalization with prefix rewriting 
    and a Qname aware attribute <code>xsi:type</code>.</li>
  <li><a href="files/c14nQname.xml"><code>c14nQname.xml</code></a>: Canonicalization with 
  a Qname aware attribute <code>xsi:type</code>, but not prefix rewriting.</li>
  <li><a href="files/c14nQnameElem.xml"><code>c14nQnameElem.xml</code></a>: Canonicalization with a 
  Qname aware element <code>&lt;a:bar&gt;</code>, but not prefix rewriting.</li>
  <li><a href="files/c14nQnameXpathElem.xml"><code>c14nQnameXpathElem.xml</code></a>: Canonicalization with a 
  Qname aware element <code>&lt;a:bar&gt;</code>, and Qname aware XPath element 
  <code>&lt;dsig2:IncludedXPath&gt;</code>, but not prefix rewriting.</li>
  <li><a href="files/c14nPrefixQnameXpathElem.xml"><code>c14nPrefixQnameXpathElem.xml</code></a>: Canonicalization with 
  prefix rewriting and a 
  Qname aware element <code>&lt;a:bar&gt;</code>, and Qname aware XPath element <code>&lt;dsig2:IncludedXPath&gt;</code>.</li>
  </ul>
 </li>
 <li><b>Output files</b> Each input file is run with each
 canonicalization parameter file to produce canonicalize 
 output files. These are named "out_" + &lt;input file name&gt; + "_"
 + &lt;c14n parameter file name&gt;,  
 e.g. <a href="files/out_inNsPushdown_c14nDefault.xml"><code>out_inNsPushdown_c14nDefault.xml </code></a>. </li>
</ul> 

In the tables below the file contents are embedded in the table, but you can download the actual file by
clicking on the hyperlink on the table header.
 
</div>

<div id="sec-Canonical11" class="section">
<!--OddPage--><h2><span class="secno">2. </span>Examples from Canonical XML 1.0</h2>

The examples in this section assume a non-validating processor,
primarily so that a document type declaration can be used to declare
entities as well as default attributes and attributes of various types
(such as ID and enumerated) without having to declare all attributes
for all elements in the document. As well, one example contains an
element that deliberately violates a validity constraint (because
it is still well-formed).

<div id="sec-Example-OutsideDoc" class="section">
<h3><span class="secno">2.1 </span>PIs, Comments, and Outside of Document Element</h3>
<b>Demonstrates:</b><br> 
<ul>
<li>Loss of XML declaration  <code>&lt;?xml version="1.0"?&gt;</code></li>
<li>Loss of DTD <code>&lt;!DOCTYPE doc SYSTEM "doc.dtd"&gt; </code></li>
<li>Normalization of whitespace outside of document element (first
character of both canonical forms is '&lt;'; single line breaks separate
PIs and comments outside of document element)</li>
<li>Loss of whitespace between PITarget and its data</li>
<li>Retention of whitespace inside PI data</li>
<li>Comment removal from uncommented canonical form, including delimiter
for comments outside document element (the last character in both
canonical forms is '&gt;')</li>
</ul>
<table>
<tbody><tr>
 <th><a href="files/inC14N1.xml">Original Data</a></th>
 <th><a href="files/out_inC14N1_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inC14N1_c14nComment.xml">After c14n with Comments</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_preproc">&lt;?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span><span class="sh_preproc">?&gt;</span>

<span class="sh_preproc">&lt;?xml</span><span class="sh_type">-stylesheet</span><span class="sh_normal">   </span><span class="sh_type">href</span><span class="sh_symbol">=</span><span class="sh_string">"doc.xsl"</span>
   <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"text/xsl"</span>   <span class="sh_preproc">?&gt;</span>

<span class="sh_preproc">&lt;!DOCTYPE</span> <span class="sh_type">doc</span><span class="sh_normal"> </span><span class="sh_type">SYSTEM</span><span class="sh_normal"> </span><span class="sh_string">"doc.dtd"</span><span class="sh_preproc">&gt;</span>

<span class="sh_keyword">&lt;doc&gt;</span>Hello, world!<span class="sh_comment">&lt;!-- Comment 1 --&gt;</span><span class="sh_keyword">&lt;/doc&gt;</span>

&lt;?pi-without-data     ?&gt;

<span class="sh_comment">&lt;!-- Comment 2 --&gt;</span>

<span class="sh_comment">&lt;!-- Comment 3 --&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_preproc">&lt;?xml</span><span class="sh_type">-stylesheet</span><span class="sh_normal"> </span><span class="sh_type">href</span><span class="sh_symbol">=</span><span class="sh_string">"doc.xsl"</span>
   <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"text/xsl"</span>   <span class="sh_preproc">?&gt;</span>
<span class="sh_keyword">&lt;doc&gt;</span>Hello, world!<span class="sh_keyword">&lt;/doc&gt;</span>
&lt;?pi-without-data?&gt;</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_preproc">&lt;?xml</span><span class="sh_type">-stylesheet</span><span class="sh_normal"> </span><span class="sh_type">href</span><span class="sh_symbol">=</span><span class="sh_string">"doc.xsl"</span>
   <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"text/xsl"</span>   <span class="sh_preproc">?&gt;</span>
<span class="sh_keyword">&lt;doc&gt;</span>Hello, world!<span class="sh_comment">&lt;!-- Comment 1 --&gt;</span><span class="sh_keyword">&lt;/doc&gt;</span>
&lt;?pi-without-data?&gt;
<span class="sh_comment">&lt;!-- Comment 2 --&gt;</span>
<span class="sh_comment">&lt;!-- Comment 3 --&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

<div id="sec-Example-WhitespaceInContent" class="section">
<h3><span class="secno">2.2 </span>Whitespace in Document Content</h3>
<b>"After c14n" Demonstrates:</b><br>
<ul>
<li>Retain all whitespace between consecutive start tags, clean or
dirty</li>
<li>Retain all whitespace between consecutive end tags, clean or dirty</li>
<li>Retain all whitespace between end tag/start tag pair, clean or
dirty</li>
<li>Retain all whitespace in character content, clean or dirty</li>
</ul> 


<p><b>Note:</b> For "After c14n", the input document and canonical
form are identical. Both end with '&gt;' character.</p>

<b>"After c14n with Trim whitespace" Demonstrates:</b><br>
<ul>
<li>Retain white space inside text, i.e. inbetween  <code>A</code> and <code>B</code> but remove
all leading and trailing whitespace </li>
</ul>

<table>
<tbody><tr>
 <th><a href="files/inC14N2.xml">Original Data</a></th>
 <th><a href="files/out_inC14N2_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inC14N2_c14nTrim.xml">After c14n with Trim whitespace</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;</span>
   <span class="sh_keyword">&lt;clean&gt;</span>   <span class="sh_keyword">&lt;/clean&gt;</span>
   <span class="sh_keyword">&lt;dirty&gt;</span>   A   B   <span class="sh_keyword">&lt;/dirty&gt;</span>
   <span class="sh_keyword">&lt;mixed&gt;</span>
      A
      <span class="sh_keyword">&lt;clean&gt;</span>   <span class="sh_keyword">&lt;/clean&gt;</span>
      B
      <span class="sh_keyword">&lt;dirty&gt;</span>   A   B   <span class="sh_keyword">&lt;/dirty&gt;</span>
      C
   <span class="sh_keyword">&lt;/mixed&gt;</span>
<span class="sh_keyword">&lt;/doc&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;</span>
   <span class="sh_keyword">&lt;clean&gt;</span>   <span class="sh_keyword">&lt;/clean&gt;</span>
   <span class="sh_keyword">&lt;dirty&gt;</span>   A   B   <span class="sh_keyword">&lt;/dirty&gt;</span>
   <span class="sh_keyword">&lt;mixed&gt;</span>
      A
      <span class="sh_keyword">&lt;clean&gt;</span>   <span class="sh_keyword">&lt;/clean&gt;</span>
      B
      <span class="sh_keyword">&lt;dirty&gt;</span>   A   B   <span class="sh_keyword">&lt;/dirty&gt;</span>
      C
   <span class="sh_keyword">&lt;/mixed&gt;</span>
<span class="sh_keyword">&lt;/doc&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;&lt;clean&gt;&lt;/clean&gt;&lt;dirty&gt;</span>A   B<span class="sh_keyword">&lt;/dirty&gt;&lt;mixed&gt;</span>A<span class="sh_keyword">&lt;clean&gt;&lt;/clean&gt;</span>B<span class="sh_keyword">&lt;dirty&gt;</span>A   B<span class="sh_keyword">&lt;/dirty&gt;</span>C<span class="sh_keyword">&lt;/mixed&gt;&lt;/doc&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

<div id="sec-Example-SETags" class="section">
<h3><span class="secno">2.3 </span>Start and End Tags</h3>

<b>"After c14n" Demonstrates:</b> 
<ul>
<li>Empty element conversion to start-end tag pair. 
  I.e. <code>&lt;e1   /&gt;</code> becomes <code>&lt;e1&gt;&lt;/e1&gt;</code></li>
<li>Normalization of whitespace in start and end tags.
  I.e.. <code>&lt;e2   &gt;&lt;/e2&gt;</code> becomes <code>&lt;e2&gt;&lt;/e2&gt;</code></li>
<li>Relative order of namespace and attribute axes, 
I.e. in <code>&lt;e5&gt;</code> the namespace declarations precede the attribute declarations.</li>
<li>Lexicographic ordering of namespace and attribute axes</li>
<li>Retention of namespace prefixes from original document</li>
<li>Elimination of superfluous namespace declarations</li>
<li>Addition of default attribute. I.e. <code>&lt;e9 attr="default"&gt;</code>. </li>
</ul> 

<p><b>Note:</b> Some start tags in the canonical form are very
long, but each start tag in this example is entirely on a single line.</p>
 
<p><b>Note:</b> In <code>e5</code>, <code>b:attr</code> precedes 
<code>a:attr</code> because the primary key is namespace URI not namespace
prefix, and <code>attr2</code> precedes <code>b:attr</code> because
the default namespace is not applied to unqualified attributes (so
the namespace URI for <code>attr2</code> is empty).</p> 

<table>
<tbody><tr>
 <th><a href="files/inC14N3.xml">Original Data</a></th>
 <th><a href="files/out_inC14N3_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inC14N3_c14nPrefix.xml">After c14n with PrefixRewrite</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_preproc">&lt;!DOCTYPE</span> <span class="sh_type">doc</span><span class="sh_normal"> </span><span class="sh_type">[&lt;!ATTLIST</span><span class="sh_normal"> </span><span class="sh_type">e9</span><span class="sh_normal"> </span><span class="sh_type">attr</span><span class="sh_normal"> </span><span class="sh_type">CDATA</span><span class="sh_normal"> </span><span class="sh_string">"default"</span><span class="sh_preproc">&gt;</span>]&gt;
<span class="sh_keyword">&lt;doc&gt;</span>
   <span class="sh_keyword">&lt;e1</span>   <span class="sh_keyword">/&gt;</span>
   <span class="sh_keyword">&lt;e2</span>   <span class="sh_keyword">&gt;&lt;/e2&gt;</span>
   <span class="sh_keyword">&lt;e3</span>   <span class="sh_type">name</span><span class="sh_normal"> </span><span class="sh_symbol">=</span> <span class="sh_string">"elem3"</span>   <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem3"</span>   <span class="sh_keyword">/&gt;</span>
   <span class="sh_keyword">&lt;e4</span>   <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span>   <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span>   <span class="sh_keyword">&gt;&lt;/e4&gt;</span>
   <span class="sh_keyword">&lt;e5</span> <span class="sh_type">a:attr</span><span class="sh_symbol">=</span><span class="sh_string">"out"</span> <span class="sh_type">b:attr</span><span class="sh_symbol">=</span><span class="sh_string">"sorted"</span> <span class="sh_type">attr2</span><span class="sh_symbol">=</span><span class="sh_string">"all"</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"I'm"</span>
      <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span>
      <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org"</span>
      <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org"</span><span class="sh_keyword">/&gt;</span>
   <span class="sh_keyword">&lt;e6</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org"</span><span class="sh_keyword">&gt;</span>
      <span class="sh_keyword">&lt;e7</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span><span class="sh_keyword">&gt;</span>
         <span class="sh_keyword">&lt;e8</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org"</span><span class="sh_keyword">&gt;</span>
            <span class="sh_keyword">&lt;e9</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span><span class="sh_keyword">/&gt;</span>
         <span class="sh_keyword">&lt;/e8&gt;</span>
      <span class="sh_keyword">&lt;/e7&gt;</span>
   <span class="sh_keyword">&lt;/e6&gt;</span>
<span class="sh_keyword">&lt;/doc&gt;</span> 
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;</span>
   <span class="sh_keyword">&lt;e1&gt;&lt;/e1&gt;</span>
   <span class="sh_keyword">&lt;e2&gt;&lt;/e2&gt;</span>
   <span class="sh_keyword">&lt;e3</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem3"</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"elem3"</span><span class="sh_keyword">&gt;&lt;/e3&gt;</span>
   <span class="sh_keyword">&lt;e4</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span><span class="sh_keyword">&gt;&lt;/e4&gt;</span>
   <span class="sh_keyword">&lt;e5</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org"</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"I'm"</span> <span class="sh_type">attr2</span><span class="sh_symbol">=</span><span class="sh_string">"all"</span> <span class="sh_type">b:attr</span><span class="sh_symbol">=</span><span class="sh_string">"sorted"</span> <span class="sh_type">a:attr</span><span class="sh_symbol">=</span><span class="sh_string">"out"</span><span class="sh_keyword">&gt;&lt;/e5&gt;</span>
   <span class="sh_keyword">&lt;e6&gt;</span>
      <span class="sh_keyword">&lt;e7</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span><span class="sh_keyword">&gt;</span>
         <span class="sh_keyword">&lt;e8</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">""</span><span class="sh_keyword">&gt;</span>
            <span class="sh_keyword">&lt;e9</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"default"</span><span class="sh_keyword">&gt;&lt;/e9&gt;</span>
         <span class="sh_keyword">&lt;/e8&gt;</span>
      <span class="sh_keyword">&lt;/e7&gt;</span>
   <span class="sh_keyword">&lt;/e6&gt;</span>
<span class="sh_keyword">&lt;/doc&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:doc</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">""</span><span class="sh_keyword">&gt;</span>
   <span class="sh_keyword">&lt;n0:e1&gt;&lt;/n0:e1&gt;</span>
   <span class="sh_keyword">&lt;n0:e2&gt;&lt;/n0:e2&gt;</span>
   <span class="sh_keyword">&lt;n0:e3</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem3"</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"elem3"</span><span class="sh_keyword">&gt;&lt;/n0:e3&gt;</span>
   <span class="sh_keyword">&lt;n0:e4</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span><span class="sh_keyword">&gt;&lt;/n0:e4&gt;</span>
   <span class="sh_keyword">&lt;n1:e5</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org"</span> <span class="sh_type">xmlns:n2</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span> <span class="sh_type">xmlns:n3</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org"</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"I'm"</span> <span class="sh_type">attr2</span><span class="sh_symbol">=</span><span class="sh_string">"all"</span> <span class="sh_type">n2:attr</span><span class="sh_symbol">=</span><span class="sh_string">"sorted"</span> <span class="sh_type">n3:attr</span><span class="sh_symbol">=</span><span class="sh_string">"out"</span><span class="sh_keyword">&gt;&lt;/n1:e5&gt;</span>
   <span class="sh_keyword">&lt;n0:e6&gt;</span>
      <span class="sh_keyword">&lt;n2:e7</span> <span class="sh_type">xmlns:n2</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span><span class="sh_keyword">&gt;</span>
         <span class="sh_keyword">&lt;n0:e8&gt;</span>
            <span class="sh_keyword">&lt;n0:e9</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"default"</span><span class="sh_keyword">&gt;&lt;/n0:e9&gt;</span>
         <span class="sh_keyword">&lt;/n0:e8&gt;</span>
      <span class="sh_keyword">&lt;/n2:e7&gt;</span>
   <span class="sh_keyword">&lt;/n0:e6&gt;</span>
<span class="sh_keyword">&lt;/n0:doc&gt;</span></pre></td> 
</tr>
<tr>
 <th></th>
 <th><a href="files/out_inC14N3_c14nTrim.xml">After c14n with Trim whitespace</a></th>
 <th></th>
</tr>
<tr>
<td></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;&lt;e1&gt;&lt;/e1&gt;&lt;e2&gt;&lt;/e2&gt;&lt;e3</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem3"</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"elem3"</span><span class="sh_keyword">&gt;&lt;/e3&gt;&lt;e4</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"elem4"</span><span class="sh_keyword">&gt;&lt;/e4&gt;&lt;e5</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org"</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"I'm"</span> <span class="sh_type">attr2</span><span class="sh_symbol">=</span><span class="sh_string">"all"</span> <span class="sh_type">b:attr</span><span class="sh_symbol">=</span><span class="sh_string">"sorted"</span> <span class="sh_type">a:attr</span><span class="sh_symbol">=</span><span class="sh_string">"out"</span><span class="sh_keyword">&gt;&lt;/e5&gt;&lt;e6&gt;&lt;e7</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.ietf.org"</span><span class="sh_keyword">&gt;&lt;e8</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">""</span><span class="sh_keyword">&gt;&lt;e9</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"default"</span><span class="sh_keyword">&gt;&lt;/e9&gt;&lt;/e8&gt;&lt;/e7&gt;&lt;/e6&gt;&lt;/doc&gt;</span></pre></td> 
<td></td> 
</tr>
</tbody></table>
</div>


<div id="sec-Example-Chars" class="section">
<h3><span class="secno">2.4 </span>Character Modifications and Character References</h3>

<b>Demonstrates:</b> 
<ul>
<li>Character reference replacement</li>
<li>Attribute value delimiters set to quotation marks (double quotes)</li>
<li>Attribute value normalization</li>
<li>CDATA section replacement</li>
<li>Encoding of special characters as character references in attribute
values (&amp;amp;, &amp;lt;, &amp;quot;, &amp;#xD;, &amp;#xA;, &amp;#x9;)</li>
<li>Encoding of special characters as character references in text
(&amp;amp;, &amp;lt;, &amp;gt;, &amp;#xD;)</li>
</ul> 

<p><b>Note:</b> The last element, <code>normId</code>, is well-formed
but violates a validity constraint for attributes of type ID. For
testing canonical XML implementations based on validating processors,
remove the line containing this element from the input and canonical
form. In general, XML consumers should be discouraged from using this
feature of XML.</p> <p><b>Note:</b> Whitespace character references
other than &amp;#x20; are not affected by attribute value normalization 
[<cite><a class="bibref" rel="biblioentry" href="#bib-XML10">XML10</a></cite>].</p> 

<p><b>Note:</b> In the canonical form,
the value of the attribute named <code>attr</code> in the element 
<code>norm</code> begins with a space, an apostrophe (single quote), then 
<i>four</i> spaces before the first character reference.</p> 

<p><b>Note:</b> The <code>expr</code> attribute of the second 
<code>compute</code> element contains no line breaks.</p>

<table>
<tbody><tr>
 <th><a href="files/inC14N4.xml">Original Data</a></th>
 <th><a href="files/out_inC14N4_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inC14N4_c14nTrim.xml">After c14n with Trim whitespace</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_preproc">&lt;!DOCTYPE</span> <span class="sh_type">doc</span><span class="sh_normal"> </span><span class="sh_type">[</span>
<span class="sh_type">&lt;!ATTLIST</span><span class="sh_normal"> </span><span class="sh_type">normId</span><span class="sh_normal"> </span><span class="sh_type">id</span><span class="sh_normal"> </span><span class="sh_type">ID</span><span class="sh_normal"> </span><span class="sh_type">#IMPLIED</span><span class="sh_preproc">&gt;</span>
&lt;!ATTLIST normNames attr NMTOKENS #IMPLIED&gt;
]&gt;
<span class="sh_keyword">&lt;doc&gt;</span>
   <span class="sh_keyword">&lt;text&gt;</span>First line&amp;#x0d;&amp;#10;Second line<span class="sh_keyword">&lt;/text&gt;</span>
   <span class="sh_keyword">&lt;value&gt;</span>&amp;#x32;<span class="sh_keyword">&lt;/value&gt;</span>
   <span class="sh_keyword">&lt;compute&gt;</span>&lt;![CDATA[value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"]]&gt;<span class="sh_keyword">&lt;/compute&gt;</span>
   <span class="sh_keyword">&lt;compute</span> <span class="sh_type">expr</span><span class="sh_symbol">=</span><span class="sh_type">'value</span><span class="sh_keyword">&gt;</span>"0" <span class="sh_preproc">&amp;amp;&amp;amp;</span> value<span class="sh_preproc">&amp;lt;</span>"10" ?"valid":"error"'&gt;valid<span class="sh_keyword">&lt;/compute&gt;</span>
   <span class="sh_keyword">&lt;norm</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_type">'</span><span class="sh_normal"> </span><span class="sh_type">&amp;apos;</span><span class="sh_normal">   </span><span class="sh_type">&amp;#x20;&amp;#13;&amp;#xa;&amp;#9;</span><span class="sh_normal">   </span><span class="sh_type">&amp;apos;</span><span class="sh_normal"> </span><span class="sh_type">'/</span><span class="sh_keyword">&gt;</span>
   <span class="sh_keyword">&lt;normNames</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_type">'</span><span class="sh_normal">   </span><span class="sh_type">A</span><span class="sh_normal">   </span><span class="sh_type">&amp;#x20;&amp;#13;&amp;#xa;&amp;#9;</span><span class="sh_normal">   </span><span class="sh_type">B</span><span class="sh_normal">   </span><span class="sh_type">'/</span><span class="sh_keyword">&gt;</span>
   <span class="sh_keyword">&lt;normId</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_type">'</span><span class="sh_normal"> </span><span class="sh_type">&amp;apos;&amp;#x20;&amp;#13;&amp;#xa;&amp;#9;</span><span class="sh_normal"> </span><span class="sh_type">&amp;apos;</span><span class="sh_normal"> </span><span class="sh_type">'/</span><span class="sh_keyword">&gt;</span>
<span class="sh_keyword">&lt;/doc&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;</span>
   <span class="sh_keyword">&lt;text&gt;</span>First line&amp;#xD;
Second line<span class="sh_keyword">&lt;/text&gt;</span>
   <span class="sh_keyword">&lt;value&gt;</span>2<span class="sh_keyword">&lt;/value&gt;</span>
   <span class="sh_keyword">&lt;compute&gt;</span>value<span class="sh_preproc">&amp;gt;</span>"0" <span class="sh_preproc">&amp;amp;&amp;amp;</span> value<span class="sh_preproc">&amp;lt;</span>"10" ?"valid":"error"<span class="sh_keyword">&lt;/compute&gt;</span>
   <span class="sh_keyword">&lt;compute</span> <span class="sh_type">expr</span><span class="sh_symbol">=</span><span class="sh_string">"value&gt;&amp;quot;0&amp;quot; &amp;amp;&amp;amp; value&amp;lt;&amp;quot;10&amp;quot; ?&amp;quot;valid&amp;quot;:&amp;quot;error&amp;quot;"</span><span class="sh_keyword">&gt;</span>valid<span class="sh_keyword">&lt;/compute&gt;</span>
   <span class="sh_keyword">&lt;norm</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">" '    &amp;#xD;&amp;#xA;&amp;#x9;   ' "</span><span class="sh_keyword">&gt;&lt;/norm&gt;</span>
   <span class="sh_keyword">&lt;normNames</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"A &amp;#xD;&amp;#xA;&amp;#x9; B"</span><span class="sh_keyword">&gt;&lt;/normNames&gt;</span>
   <span class="sh_keyword">&lt;normId</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"' &amp;#xD;&amp;#xA;&amp;#x9; '"</span><span class="sh_keyword">&gt;&lt;/normId&gt;</span>
<span class="sh_keyword">&lt;/doc&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;&lt;text&gt;</span>First line&amp;#xD;
Second line<span class="sh_keyword">&lt;/text&gt;&lt;value&gt;</span>2<span class="sh_keyword">&lt;/value&gt;&lt;compute&gt;</span>value<span class="sh_preproc">&amp;gt;</span>"0" <span class="sh_preproc">&amp;amp;&amp;amp;</span> value<span class="sh_preproc">&amp;lt;</span>"10" ?"valid":"error"<span class="sh_keyword">&lt;/compute&gt;&lt;compute</span> <span class="sh_type">expr</span><span class="sh_symbol">=</span><span class="sh_string">"value&gt;&amp;quot;0&amp;quot; &amp;amp;&amp;amp; value&amp;lt;&amp;quot;10&amp;quot; ?&amp;quot;valid&amp;quot;:&amp;quot;error&amp;quot;"</span><span class="sh_keyword">&gt;</span>valid<span class="sh_keyword">&lt;/compute&gt;&lt;norm</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">" '    &amp;#xD;&amp;#xA;&amp;#x9;   ' "</span><span class="sh_keyword">&gt;&lt;/norm&gt;&lt;normNames</span> <span class="sh_type">attr</span><span class="sh_symbol">=</span><span class="sh_string">"A &amp;#xD;&amp;#xA;&amp;#x9; B"</span><span class="sh_keyword">&gt;&lt;/normNames&gt;&lt;normId</span> <span class="sh_type">id</span><span class="sh_symbol">=</span><span class="sh_string">"' &amp;#xD;&amp;#xA;&amp;#x9; '"</span><span class="sh_keyword">&gt;&lt;/normId&gt;&lt;/doc&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>


<div id="sec-Example-Entities" class="section">
<h3><span class="secno">2.5 </span>Entity References</h3>

<b>Demonstrates:</b> 
<ul>
<li>Internal parsed entity reference replacement</li>
<li>External parsed entity reference replacement (including whitespace
outside elements and PIs)</li>
<li>External unparsed entity reference</li>
</ul> 

<table>
<tbody><tr>
 <th><a href="files/inC14N5.xml">Original Data</a></th>
 <th><a href="files/out_inC14N5_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inC14N5_c14nTrim.xml">After c14n with Trim whitespace</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_preproc">&lt;!DOCTYPE</span> <span class="sh_type">doc</span><span class="sh_normal"> </span><span class="sh_type">[</span>
<span class="sh_type">&lt;!ATTLIST</span><span class="sh_normal"> </span><span class="sh_type">doc</span><span class="sh_normal"> </span><span class="sh_type">attrExtEnt</span><span class="sh_normal"> </span><span class="sh_type">CDATA</span><span class="sh_normal"> </span><span class="sh_type">#IMPLIED</span><span class="sh_preproc">&gt;</span>
&lt;!ENTITY ent1 "Hello"&gt;
&lt;!ENTITY ent2 SYSTEM "world.txt"&gt;
&lt;!ENTITY entExt SYSTEM "earth.gif" NDATA gif&gt;
&lt;!NOTATION gif SYSTEM "viewgif.exe"&gt;
]&gt;
<span class="sh_keyword">&lt;doc</span> <span class="sh_type">attrExtEnt</span><span class="sh_symbol">=</span><span class="sh_string">"entExt"</span><span class="sh_keyword">&gt;</span>
   <span class="sh_preproc">&amp;ent1;</span>, <span class="sh_preproc">&amp;ent2;</span>!
<span class="sh_keyword">&lt;/doc&gt;</span>

<span class="sh_comment">&lt;!-- Let world.txt contain "world" (excluding the quotes) --&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc</span> <span class="sh_type">attrExtEnt</span><span class="sh_symbol">=</span><span class="sh_string">"entExt"</span><span class="sh_keyword">&gt;</span>
   Hello, world!
<span class="sh_keyword">&lt;/doc&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc</span> <span class="sh_type">attrExtEnt</span><span class="sh_symbol">=</span><span class="sh_string">"entExt"</span><span class="sh_keyword">&gt;</span>Hello, world!<span class="sh_keyword">&lt;/doc&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>


<div id="sec-Example-UTF8" class="section">
<h3><span class="secno">2.6 </span>UTF-8 Encoding</h3>

<b>Demonstrates:</b> 
<ul>
<li>Effect of transcoding from a sample encoding to UTF-8</li>
</ul> 

<p class="Note"><b>Note:</b> The content of the doc element 
are two octets whose hexadecimal values are C2
and A9, which is the UTF-8 encoding of the UCS codepoint for the copyright
sign (©).</p>

<table>
<tbody><tr>
 <th><a href="files/inC14N6.xml">Original Data</a></th>
 <th><a href="files/out_inC14N6_c14nDefault.xml">After c14n</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_preproc">&lt;?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span> <span class="sh_type">encoding</span><span class="sh_symbol">=</span><span class="sh_string">"ISO-8859-1"</span><span class="sh_preproc">?&gt;</span>
<span class="sh_keyword">&lt;doc&gt;</span>&amp;#169;<span class="sh_keyword">&lt;/doc&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;doc&gt;</span>©<span class="sh_keyword">&lt;/doc&gt;</span></pre></td> 
</tr>
</tbody></table>

</div>

</div>

<div id="sec-Namespace" class="section">
<!--OddPage--><h2><span class="secno">3. </span>Dealing with Namespaces</h2>

<div id="sec-PushDown" class="section">
<h3><span class="secno">3.1 </span>Namespaces declarations are pushed down</h3>
In this example there are three prefixes declarations:  "a"  "b" and "c". 
Of these "c" is not visibly utilized at all, so it does not appear in the canonicalized output.
"b" is used but not by the top level "a:foo" element, but by each of its children, so 
canonicalization "pushes down" the declaration to where it is actually utilized. Note the three "b:bar"
elements utilize the "b" prefix in the element name, whereas the last "a:bar" element utilizes that declaration 
not in the element name , but in the "b:att" attribute.
<table>
<tbody><tr>
 <th><a href="files/inNsPushdown.xml">Original Data</a></th>
 <th><a href="files/out_inNsPushdown_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inNsPushdown_c14nPrefix.xml">After c14n with PrefixRewrite</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">xmlns:c</span><span class="sh_symbol">=</span><span class="sh_string">"http://c"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;b:bar/&gt;</span>
 <span class="sh_keyword">&lt;b:bar/&gt;</span>
 <span class="sh_keyword">&lt;b:bar/&gt;</span>
 <span class="sh_keyword">&lt;a:bar</span> <span class="sh_type">b:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span><span class="sh_keyword">/&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;b:bar</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span><span class="sh_keyword">&gt;&lt;/b:bar&gt;</span>
 <span class="sh_keyword">&lt;b:bar</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span><span class="sh_keyword">&gt;&lt;/b:bar&gt;</span>
 <span class="sh_keyword">&lt;b:bar</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span><span class="sh_keyword">&gt;&lt;/b:bar&gt;</span>
 <span class="sh_keyword">&lt;a:bar</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">b:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span><span class="sh_keyword">&gt;&lt;/a:bar&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;n1:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span><span class="sh_keyword">&gt;&lt;/n1:bar&gt;</span>
 <span class="sh_keyword">&lt;n1:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span><span class="sh_keyword">&gt;&lt;/n1:bar&gt;</span>
 <span class="sh_keyword">&lt;n1:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span><span class="sh_keyword">&gt;&lt;/n1:bar&gt;</span>
 <span class="sh_keyword">&lt;n0:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">n1:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span><span class="sh_keyword">&gt;&lt;/n0:bar&gt;</span>
<span class="sh_keyword">&lt;/n0:foo&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>


<div id="sec-Default" class="section">
<h3><span class="secno">3.2 </span>Default namespace declarations</h3>
In this example there are three prefixes declarations:  "a", "b", and also a default prefix.
Of these "a" is not visibly utilized at all, so it does not appear in the canonicalized output.
The "foo" element uses the default prefix. Note however the "att2" attribute does NOT use the 
default prefix, it is simply in the scope of the "b:bar" element. 
With prefix rewriting both the default prefix and the "b" prefix are rewritten.
<table>
<tbody><tr>
 <th><a href="files/inNsDefault.xml">Original Data</a></th>
 <th><a href="files/out_inNsDefault_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inNsDefault_c14nPrefix.xml">After c14n with PrefixRewrite</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;b:bar</span> <span class="sh_type">b:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span> <span class="sh_type">att2</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span><span class="sh_keyword">/&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo&gt;</span>
 <span class="sh_keyword">&lt;b:bar</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">att2</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span> <span class="sh_type">b:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span><span class="sh_keyword">&gt;&lt;/b:bar&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">""</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;n1:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">att2</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span> <span class="sh_type">n1:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val"</span><span class="sh_keyword">&gt;&lt;/n1:bar&gt;</span>
<span class="sh_keyword">&lt;/n0:foo&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

<div id="sec-Sort" class="section">
<h3><span class="secno">3.3 </span>Sorting namespace declarations</h3>
<p>In this example there are four prefixes declarations:  "a", "b", "c" and "d". 
They map to namespace URIs "http://z3", "http://z2", "http://z1" and "http://z0" respectively.
</p>
<p>
Notice the following things in the default canonicalization ("After
c14n"):
</p>
<ul>
<li>In "a:foo" all the namespace declarations appear before the attribute declarations, even though 
they were mixed up in the original document.</li>
<li>In "a:foo" the attributes are sorted in this order - "c:att3",
  "b:att1", "b:att2".   
This is because attributes are sorted by namespaceURI as primary key
  and localName as secondary key. 
Since "c" is http://z1 and "b" is http://z2, all the "c" attributes
  appear before "b" attributes. Note that within the "b" attributes "att1"
  appears before "att2". </li>  
<li>In "a:foo" all the namespace declarations are sorted by prefixes
  i.e. "a", "b", "c", and  
NOT by namespace URIs.</li>
</ul>

And notice these things in canonicalization with prefix rewriting ("After c14n with PrefixRewrite"):
<ul>
<li>New prefixes are assigned in the order in which they are visibly utilized: 
<ol>
 <li> At first "a:foo" visibly utilizes 
prefixes "a", "b" and "c". These are then sorted by namespace URI, resulting in "c", "b", "a". Then they are 
assigned prefixes "http://z1"-&gt;"n0", "http://z2"-&gt;"n1" and
 "http://z3"-&gt;"n2"</li> 
 <li>After that "c:bar" visibly utilizes prefix "d". This gets assigned prefix "n3" </li>
</ol> 
</li>
<li>In "a:foo" all rewritten prefixes are sorted by prefixes i.e. "n0", "n1", "n2". </li>
</ul>

<table>
<tbody><tr>
 <th><a href="files/inNsSort.xml">Original Data</a></th>
 <th><a href="files/out_inNsSort_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inNsSort_c14nPrefix.xml">After c14n with PrefixRewrite</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">b:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">c:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span> <span class="sh_type">xmlns:c</span><span class="sh_symbol">=</span><span class="sh_string">"http://z1"</span> <span class="sh_type">xmlns:d</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;c:bar/&gt;</span>
 <span class="sh_keyword">&lt;c:bar</span> <span class="sh_type">d:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span><span class="sh_keyword">/&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">xmlns:c</span><span class="sh_symbol">=</span><span class="sh_string">"http://z1"</span> <span class="sh_type">c:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span> <span class="sh_type">b:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;c:bar&gt;&lt;/c:bar&gt;</span>
 <span class="sh_keyword">&lt;c:bar</span> <span class="sh_type">xmlns:d</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">d:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span><span class="sh_keyword">&gt;&lt;/c:bar&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n2:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">"http://z1"</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">xmlns:n2</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_type">n0:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span> <span class="sh_type">n1:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">n1:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;n0:bar&gt;&lt;/n0:bar&gt;</span>
 <span class="sh_keyword">&lt;n0:bar</span> <span class="sh_type">xmlns:n3</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">n3:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span><span class="sh_keyword">&gt;&lt;/n0:bar&gt;</span>
<span class="sh_keyword">&lt;/n2:foo&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

<div id="sec-Redecl" class="section">
<h3><span class="secno">3.4 </span>Namespace Re-declarations</h3>
<p>
In this example there are three prefixes "a", "b" and the default prefix.
The "foo" element defines them to be "http://z3", "http://z2" and ""
respectively. But the "bar" 
redeclares these prefixes to "http://z2", "http://z3" abd "http://z0"
respectively. 
</p>
<p>
Notice the following things in the default canonicalization ("After
c14n"):
</p>
<ul>
<li>In "a:foo" all the namespace declarations appear before the attribute declarations, even though 
they were mixed up in the original document.</li>
<li>In "a:foo" the attributes are sorted in this order - "c:att3", "b:att1", "b:att2".  
This is because attributes are sorted by namespaceURI as primary key and localName as secondary key.
Since "c" is http://z1 and "b" is http://z2, all the "c" attribute appear before "b" attributes. 
And between the "b" attributes "att1" appears before "att2". </li>
<li>In "a:foo" all the namespace declarations are sorted by prefixes
  i.e. "a", "b", "c", and  
NOT by namespace URIs.</li>
</ul>

And notice these things in canonicalization with prefix rewriting
("After c14n with PrefixRewrite"): 
<ul>
<li>New prefixes are assigned in the order in which they are visibly utilized: 
<ol>
 <li> At first "a:foo" visibly utilizes 
prefixes "a", "b" and "c". These are then sorted by namespace URI, resulting in "c", "b", "a". Then they are 
assigned prefixes "http://z1"-&gt;"n0", "http://z2"-&gt;"n1" and "http://z3"-&gt;"n2"</li>
 <li>After that "c:bar" visibly utilizes prefix "d". This gets assigned prefix "n3" </li>
</ol> 
</li>
<li>In "a:foo" all rewritten prefixes are sorted by prefixes i.e. "n0", "n1", "n2". </li>
</ul>

<table>
<tbody><tr>
 <th><a href="files/inNsRedecl.xml">Original Data</a></th>
 <th><a href="files/out_inNsRedecl_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inNsRedecl_c14nPrefix.xml">After c14n with PrefixRewrite</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">a:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span><span class="sh_keyword">&gt;</span> 
 <span class="sh_keyword">&lt;bar</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">a:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_keyword">/&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span> <span class="sh_type">a:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span><span class="sh_keyword">&gt;</span> 
 <span class="sh_keyword">&lt;bar</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_type">a:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span><span class="sh_keyword">&gt;&lt;/bar&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://z2"</span> <span class="sh_type">xmlns:n2</span><span class="sh_symbol">=</span><span class="sh_string">"http://z3"</span> <span class="sh_type">n1:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span> <span class="sh_type">n2:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span><span class="sh_keyword">&gt;</span> 
 <span class="sh_keyword">&lt;n3:bar</span> <span class="sh_type">xmlns:n3</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">n1:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">n2:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span><span class="sh_keyword">&gt;&lt;/n3:bar&gt;</span>
<span class="sh_keyword">&lt;/n0:foo&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

<div id="sec-Superfluous" class="section">
<h3><span class="secno">3.5 </span>Superfluous Namespace declarations</h3>
<p>In this example there are five prefixes "a", "b", "c", "d" and the default prefix and they are
all declared to the same namespace URI "http://z0".  The "a" prefix is defined twice, one in
the "foo" element, and then again in "c:bar" element; obviously the definition of "a" in "c:bar" 
is unnecessary. 
</p>
<p>
Notice the following things in the default canonicalization ("After
c14n"):
</p>
<ul>
<li>It does not attempt to recognize that "a", "b", "c", "d" and default are pointing to the 
same thing.</li>
<li>It removes the extra declaration of "xmlns:a" in the "c:bar" as that is superfluous.</li> 
</ul>

And notice these things in canonicalization with prefix rewriting ("After c14n with PrefixRewrite"):
<ul>
<li>All the file prefixes "a", "b", "c", "d" are rewritten to the same
  prefix - "z0". 
</li></ul>

<table>
<tbody><tr>
 <th><a href="files/inNsSuperfluous.xml">Original Data</a></th>
 <th><a href="files/out_inNsSuperfluous_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inNsSuperfluous_c14nPrefix.xml">After c14n with PrefixRewrite</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">a:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span><span class="sh_keyword">&gt;</span> 
 <span class="sh_keyword">&lt;c:bar</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xmlns:c</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">c:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span><span class="sh_keyword">/&gt;</span>
 <span class="sh_keyword">&lt;d:bar</span> <span class="sh_type">xmlns:d</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span><span class="sh_keyword">/&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">a:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">b:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span><span class="sh_keyword">&gt;</span> 
 <span class="sh_keyword">&lt;c:bar</span> <span class="sh_type">xmlns:c</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">c:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span><span class="sh_keyword">&gt;&lt;/c:bar&gt;</span>
 <span class="sh_keyword">&lt;d:bar</span> <span class="sh_type">xmlns:d</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span><span class="sh_keyword">&gt;&lt;/d:bar&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">n0:att1</span><span class="sh_symbol">=</span><span class="sh_string">"val1"</span> <span class="sh_type">n0:att2</span><span class="sh_symbol">=</span><span class="sh_string">"val2"</span><span class="sh_keyword">&gt;</span> 
 <span class="sh_keyword">&lt;n0:bar</span> <span class="sh_type">n0:att3</span><span class="sh_symbol">=</span><span class="sh_string">"val3"</span><span class="sh_keyword">&gt;&lt;/n0:bar&gt;</span>
 <span class="sh_keyword">&lt;n0:bar&gt;&lt;/n0:bar&gt;</span>
<span class="sh_keyword">&lt;/n0:foo&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

<div id="sec-xmlattribs" class="section">
<h3><span class="secno">3.6 </span>Special namespaces "xml", "xsi", "xsd"</h3>
<p>
In this example there are are three special namespace declaration the "xml" namespace used 
in the attribute <code>xml:id="23"</code> and also the "xsi" and "xsd" namespaces used in
<code>xsi:type="xsd:string"</code>.
</p>
<p>
Canonicalization only treats "xml" as a special namespace. It is never rewritten by prefix-rewriting. 
"xsi" and "xsd" are treated as regular namespaces.
</p>
<p>
Notice the following things in the default canonicalization ("After
c14n"):
</p>
<ul>
<li>It does not consider the "xsd" prefix as visibly utilized since it is embedded in the content.
That is why it removes the "xsd" namespace declaration completely.</li>
</ul>

Notice these things in canonicalization with prefix rewriting ("After c14n with PrefixRewrite"):
<ul>
<li>It also removes the "xsd" declaration completely.</li>
<li>It doesn't change the "xml" prefix to anything else, also it doesn't emit the namespace 
declaration for the "xml" prefix.</li>
<li>But it does rewrite the "xsi" prefix to "ns1".</li> 
</ul>

Notice these things in canonicalization with QName awareness ("After c14n with QNameAware"):
<ul>
<li>Look at the <code>CanonicalzationMethod</code> in <a href="files/c14nQname.xml">c14nQname.xml</a>. 
it lists "xsi:type" as a Qualified Attribute in the QNameAware element. </li> 
<li>So now the canonicalization looks into the "xsi:type" for prefixes. It finds the "xsd" element
and considers it visibly utilized, and hence emits the "xsd" namespace declaration.
</li></ul>

Notice these things in canonicalization with QName awareness ("After c14n with QNameAware and PrefixRewrite"):
<ul>
<li>Look at the <code>CanonicalzationMethod</code> in <a href="files/c14nPrefixQname.xml">c14nPrefixQname.xml</a>. 
it lists "xsi:type" as a Qualified Attribute in the QNameAware element. It also PrefixRewite=sequential </li> 
<li>So now "xsd" is considered visibly utilized, and it is rewritten to "n1".  
I.e. <code>xsi:type="xsd:string"</code> changes
  to <code>n2:type="n1:string".</code> 
</li></ul>


<table>
<tbody><tr>
 <th><a href="files/inNsXml.xml">Original Data</a></th>
 <th><a href="files/out_inNsXml_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inNsXml_c14nPrefix.xml">After c14n with
 PrefixRewrite</a></th> 
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xml:id</span><span class="sh_symbol">=</span><span class="sh_string">"23"</span><span class="sh_keyword">&gt;</span>
  <span class="sh_keyword">&lt;bar</span> <span class="sh_type">xsi:type</span><span class="sh_symbol">=</span><span class="sh_string">"xsd:string"</span> <span class="sh_type">xmlns:xsi</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span> <span class="sh_type">xmlns:xsd</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span><span class="sh_keyword">&gt;</span>data<span class="sh_keyword">&lt;/bar&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xml:id</span><span class="sh_symbol">=</span><span class="sh_string">"23"</span><span class="sh_keyword">&gt;</span>
  <span class="sh_keyword">&lt;bar</span> <span class="sh_type">xmlns:xsi</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span> <span class="sh_type">xsi:type</span><span class="sh_symbol">=</span><span class="sh_string">"xsd:string"</span><span class="sh_keyword">&gt;</span>data<span class="sh_keyword">&lt;/bar&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xml:id</span><span class="sh_symbol">=</span><span class="sh_string">"23"</span><span class="sh_keyword">&gt;</span>
  <span class="sh_keyword">&lt;n0:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span> <span class="sh_type">n1:type</span><span class="sh_symbol">=</span><span class="sh_string">"xsd:string"</span><span class="sh_keyword">&gt;</span>data<span class="sh_keyword">&lt;/n0:bar&gt;</span>
<span class="sh_keyword">&lt;/n0:foo&gt;</span></pre></td> 
</tr>
<tr>
 <th></th>
 <th><a href="files/out_inNsXml_c14nQname.xml">After c14n with QNameAware</a></th>
 <th><a href="files/out_inNsXml_c14nPrefixQname.xml">After c14n with QNameAware and PrefixRewrite</a></th>
</tr>
<tr>
<td></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;foo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xml:id</span><span class="sh_symbol">=</span><span class="sh_string">"23"</span><span class="sh_keyword">&gt;</span>
  <span class="sh_keyword">&lt;bar</span> <span class="sh_type">xmlns:xsd</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span> <span class="sh_type">xmlns:xsi</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span> <span class="sh_type">xsi:type</span><span class="sh_symbol">=</span><span class="sh_string">"xsd:string"</span><span class="sh_keyword">&gt;</span>data<span class="sh_keyword">&lt;/bar&gt;</span>
<span class="sh_keyword">&lt;/foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">"http://z0"</span> <span class="sh_type">xml:id</span><span class="sh_symbol">=</span><span class="sh_string">"23"</span><span class="sh_keyword">&gt;</span>
  <span class="sh_keyword">&lt;n0:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span> <span class="sh_type">xmlns:n2</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span> <span class="sh_type">n2:type</span><span class="sh_symbol">=</span><span class="sh_string">"n1:string"</span><span class="sh_keyword">&gt;</span>data<span class="sh_keyword">&lt;/n0:bar&gt;</span>
<span class="sh_keyword">&lt;/n0:foo&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

<div id="sec-PrefixesInContent" class="section">
<h3><span class="secno">3.7 </span>Prefixes in Element content</h3>
<p>
Notice the following things in the default canonicalization ("After
c14n"):
</p>
<ul>
<li>It does not consider the "xsd", "soap-env" and "b" prefixes as visibly utilized since they are embedded in the content.
That is why it removes these namespace declarations completely.</li>
</ul>
<p>
Notice the following things in the default canonicalization ("After c14n with QNameAware &lt;a:bar&gt;"):
</p>
<ul>
<li>It considers the "xsd", as visbily utilized in element, but not "soap-env" and "b" prefixes as visibly utilized
 since they are embedded in the XPath content.</li>
</ul>
<p>
Notice the following things in the default canonicalization ("After c14n with QNameAware &lt;a:bar&gt; and &lt;dsig2:IncludedXPath&gt;"):
</p>
<ul>
<li>All three embedded prefixes  "xsd", "soap-env" and "b" prefixes as considered as visibly utilized.</li>
<li>prefix "c" is not considered visibly utilized since it is inside an XPath sring. Single and double quoted strings
inside an XPath expression are not searched for prefixes. </li>
<li> "child:" is not a prefix, it is an XPath axis, as indicated by the double colon. </li>
</ul>
<p>
Notice the following things in the default canonicalization ("After c14n with QNameAware &lt;a:bar&gt; and &lt;dsig2:IncludedXPath&gt; and PrefixRewrite"):
</p>
<ul>
<li>All three embedded prefixes  "xsd", "soap-env" and "b" prefixes as considered as visibly utilized.
They are rewritten to "n1", "n3" and "n2" respectively. </li>
<li>The text content is modified because of prefix rewriting. </li>
<li>Even though the "xsd" prefix is rewritten to "n1", the 'xsd:string' is left unchanged, as it inside a single quoted string.</li>
</ul>

<table>
<tbody><tr>
 <th><a href="files/inNsContent.xml">Original Data</a></th>
 <th><a href="files/out_inNsContent_c14nDefault.xml">After c14n</a></th>
 <th><a href="files/out_inNsContent_c14nQnameElem.xml">After c14n with QNameAware &lt;a:bar&gt;</a></th>
</tr>
<tr>
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">xmlns:child</span><span class="sh_symbol">=</span><span class="sh_string">"http://c"</span> <span class="sh_type">xmlns:soap-env</span><span class="sh_symbol">=</span><span class="sh_string">"http://schemas.xmlsoap.org/wsdl/soap/"</span> <span class="sh_type">xmlns:xsd</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;a:bar&gt;</span>xsd:string<span class="sh_keyword">&lt;/a:bar&gt;</span>
 <span class="sh_keyword">&lt;dsig2:IncludedXPath</span> <span class="sh_type">xmlns:dsig2</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2010/xmldsig2#"</span><span class="sh_keyword">&gt;</span>/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']<span class="sh_keyword">&lt;/dsig2:IncludedXPath&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span>
</pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;a:bar&gt;</span>xsd:string<span class="sh_keyword">&lt;/a:bar&gt;</span>
 <span class="sh_keyword">&lt;dsig2:IncludedXPath</span> <span class="sh_type">xmlns:dsig2</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2010/xmldsig2#"</span><span class="sh_keyword">&gt;</span>/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']<span class="sh_keyword">&lt;/dsig2:IncludedXPath&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;a:bar</span> <span class="sh_type">xmlns:xsd</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span><span class="sh_keyword">&gt;</span>xsd:string<span class="sh_keyword">&lt;/a:bar&gt;</span>
 <span class="sh_keyword">&lt;dsig2:IncludedXPath</span> <span class="sh_type">xmlns:dsig2</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2010/xmldsig2#"</span><span class="sh_keyword">&gt;</span>/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']<span class="sh_keyword">&lt;/dsig2:IncludedXPath&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span></pre></td> 
</tr>
<tr>
 <th></th>
 <th><a href="files/out_inNsContent_c14nQnameXpathElem.xml">After c14n with QNameAware &lt;a:bar&gt; and &lt;dsig2:IncludedXPath&gt;</a></th>
 <th><a href="files/out_inNsContent_c14nPrefixQnameXpathElem.xml">After c14n with QNameAware &lt;a:bar&gt; and &lt;dsig2:IncludedXPath&gt; and PrefixRewrite</a></th>
</tr>
<tr>
<td></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;a:foo</span> <span class="sh_type">xmlns:a</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;a:bar</span> <span class="sh_type">xmlns:xsd</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span><span class="sh_keyword">&gt;</span>xsd:string<span class="sh_keyword">&lt;/a:bar&gt;</span>
 <span class="sh_keyword">&lt;dsig2:IncludedXPath</span> <span class="sh_type">xmlns:b</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">xmlns:dsig2</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2010/xmldsig2#"</span> <span class="sh_type">xmlns:soap-env</span><span class="sh_symbol">=</span><span class="sh_string">"http://schemas.xmlsoap.org/wsdl/soap/"</span><span class="sh_keyword">&gt;</span>/soap-env:body/child::b:foo[@att1 != "c:val" and @att2 != 'xsd:string']<span class="sh_keyword">&lt;/dsig2:IncludedXPath&gt;</span>
<span class="sh_keyword">&lt;/a:foo&gt;</span></pre></td> 
<td><pre class="sh_xml sh_sourceCode"><span class="sh_keyword">&lt;n0:foo</span> <span class="sh_type">xmlns:n0</span><span class="sh_symbol">=</span><span class="sh_string">"http://a"</span><span class="sh_keyword">&gt;</span>
 <span class="sh_keyword">&lt;n0:bar</span> <span class="sh_type">xmlns:n1</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span><span class="sh_keyword">&gt;</span>n1:string<span class="sh_keyword">&lt;/n0:bar&gt;</span>
 <span class="sh_keyword">&lt;n4:IncludedXPath</span> <span class="sh_type">xmlns:n2</span><span class="sh_symbol">=</span><span class="sh_string">"http://b"</span> <span class="sh_type">xmlns:n3</span><span class="sh_symbol">=</span><span class="sh_string">"http://schemas.xmlsoap.org/wsdl/soap/"</span> <span class="sh_type">xmlns:n4</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2010/xmldsig2#"</span><span class="sh_keyword">&gt;</span>/n3:body/child::n2:foo[@att1 != "c:val" and @att2 != 'xsd:string']<span class="sh_keyword">&lt;/n4:IncludedXPath&gt;</span>
<span class="sh_keyword">&lt;/n0:foo&gt;</span></pre></td> 
</tr>
</tbody></table>
</div>

</div>
  
 
<div id="references" class="appendix section"><!--OddPage--><h2><span class="secno">A. </span>References</h2><p>Dated references below are to the latest known or appropriate edition of the referenced work.  The referenced works may be subject to revision, and conformant implementations may follow, and are encouraged to investigate the appropriateness of following, some or all more recent editions or replacements of the works cited. It is in each case implementation-defined which  editions are supported.</p><div id="normative-references" class="section"><h3><span class="secno">A.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-XML-C14N20">[XML-C14N20]</dt><dd>John Boyer; Glen Marcy; Pratik Datta; Frederick Hirsch. <a href="http://www.w3.org/TR/2011/WD-xml-c14n2-20110421/"><cite>Canonical XML Version 2.0.</cite></a> 21 April 2011. W3C Last Call Working Draft. (Work in progress) URL: <a href="http://www.w3.org/TR/2011/WD-xml-c14n2-20110421/">http://www.w3.org/TR/2011/WD-xml-c14n2-20110421/</a>
</dd><dt id="bib-XML10">[XML10]</dt><dd>C. M. Sperberg-McQueen; et al. <a href="http://www.w3.org/TR/2008/REC-xml-20081126/"><cite>Extensible Markup Language (XML) 1.0 (Fifth Edition).</cite></a> 26 November 2008. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2008/REC-xml-20081126/">http://www.w3.org/TR/2008/REC-xml-20081126/</a> 
</dd></dl></div><div id="informative-references" class="section"><h3><span class="secno">A.2 </span>Informative references</h3><p>No informative references.</p></div></div></body></html>