우선 XML 데이터를 포함하는 DOM(문서 객체 모델) 노드를 만드는 것으로 XML 파일 쓰기를 시작하십시오. 그런 다음 DOM 노드를 XML 파일에 씁니다. 최종 XML 파일은 다음 텍스트를 포함해야 합니다.
<?xml version="1.0" encoding="utf-8"?>
<toc version="2.0">
<tocitem target="upslope_product_page.html">Upslope Area Toolbox<!-- Functions -->
<tocitem target="demFlow_help.html">demFlow</tocitem>
<tocitem target="facetFlow_help.html">facetFlow</tocitem>
<tocitem target="flowMatrix_help.html">flowMatrix</tocitem>
<tocitem target="pixelFlow_help.html">pixelFlow</tocitem>
</tocitem>
</toc>
먼저 DOM 노드 객체와 루트 요소를 만든 다음 XML 데이터에 대응되는 노드의 요소와 특성을 채웁니다.
루트 요소를 식별하고 version 특성을 설정합니다.
제품 페이지에 대한 tocitem 요소 노드를 추가합니다. 이 파일의 각 tocitem 요소는 target 특성과 자식 텍스트 노드를 갖습니다.
주석을 추가합니다.
각 함수에 대해 tocitem 요소 노드를 추가합니다. 여기서 target의 형식은 function_help.html입니다.
마지막으로, DOM 노드를 XML 파일 infoUAT.xml로 내보내고, type 함수를 사용하여 파일을 확인합니다.