필터 지우기
필터 지우기

Why can't standalone display when generating xml?

조회 수: 3 (최근 30일)
aijiangzhao aixuwu
aijiangzhao aixuwu 2021년 12월 18일
편집: per isakson 2021년 12월 18일
Why can't standalone display when generating xml?
code:
filename = 'ProductMetadata';
docNode = com.mathworks.xml.XMLUtils.createDocument('ProductMetadata');
docRootNode = docNode.getDocumentElement();
publicElement = docNode.createElement('PublicAttribute');
docRootNode.appendChild(publicElement);
SCIDNode = docNode.createElement('SCID');
SCIDNode.appendChild(docNode.createTextNode(sprintf('AD')));
publicElement.appendChild(SCIDNode);
APIDNode = docNode.createElement('APID');
APIDNode.appendChild(docNode.createTextNode(sprintf('APID')));
publicElement.appendChild(APIDNode);
DPIDNode = docNode.createElement('DPID');
DPIDNode.appendChild(docNode.createTextNode(sprintf('XFLX')));
publicElement.appendChild(DPIDNode);
DTTPNode = docNode.createElement('DTTP');
DTTPNode.appendChild(docNode.createTextNode(sprintf('SCI')));
publicElement.appendChild(DTTPNode);
RSFDNode = docNode.createElement('RSFD');
RSFDNode.appendChild(docNode.createTextNode(sprintf('SPEF')));
publicElement.appendChild(RSFDNode);
TSTRNode = docNode.createElement('TSTR');
TSTRNode.appendChild(docNode.createTextNode(sprintf('20211207000001')));
publicElement.appendChild(TSTRNode);
TENDNode = docNode.createElement('TEND');
TENDNode.appendChild(docNode.createTextNode(sprintf('20211207235958')));
publicElement.appendChild(TENDNode);
TaskNONode = docNode.createElement('TaskNO');
TaskNONode.appendChild(docNode.createTextNode(sprintf('0')));
publicElement.appendChild(TaskNONode);
FileNONode = docNode.createElement('FileNO');
FileNONode.appendChild(docNode.createTextNode(sprintf('0221')));
publicElement.appendChild(FileNONode);
ProdLevelNode = docNode.createElement('ProdLevel');
ProdLevelNode.appendChild(docNode.createTextNode(sprintf('L2')));
publicElement.appendChild(ProdLevelNode);
VERNode = docNode.createElement('VER');
VERNode.appendChild(docNode.createTextNode(sprintf('V1')));
publicElement.appendChild(VERNode);
EXTNode = docNode.createElement('EXT');
EXTNode.appendChild(docNode.createTextNode(sprintf('txt')));
publicElement.appendChild(EXTNode);
% PrivateAttribute
privateElement = docNode.createElement('PrivateAttribute');
docRootNode.appendChild(privateElement);
DataProcessingElement = docNode.createElement('DataProcessing');
privateElement.appendChild(DataProcessingElement);
SrcFileNode = docNode.createElement('SrcFile');
a='中国人';
b='北京\n';
SrcFileNode.appendChild(docNode.createTextNode(sprintf(a)));
SrcFileNode.appendChild(docNode.createTextNode(newline));
SrcFileNode.appendChild(docNode.createTextNode(sprintf(b)));
DataProcessingElement.appendChild(SrcFileNode);
ProcessAppNode = docNode.createElement('ProcessApp');
ProcessAppNode.appendChild(docNode.createTextNode(sprintf('XRAY-product-v1.0')));
DataProcessingElement.appendChild(ProcessAppNode);
ProcessStartTimeNode = docNode.createElement('ProcessStartTime');
ProcessStartTimeNode.appendChild(docNode.createTextNode(sprintf('20211208183700')));
DataProcessingElement.appendChild(ProcessStartTimeNode);
ProcessEndTimeNode = docNode.createElement('ProcessEndTime');
ProcessEndTimeNode.appendChild(docNode.createTextNode(sprintf('20211208183900')));
DataProcessingElement.appendChild(ProcessEndTimeNode);
QualityAssessmentElement = docNode.createElement('QualityAssessment');
privateElement.appendChild(QualityAssessmentElement);
IsCompleteNode = docNode.createElement('IsComplete');
IsCompleteNode.appendChild(docNode.createTextNode(sprintf('true')));
QualityAssessmentElement.appendChild(IsCompleteNode);
xmlFileName = [filename,'.xml'];
xmlwrite(xmlFileName,docNode)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Structured Data and XML Documents에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by