Why can't standalone display when generating xml?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Why can't standalone display when generating xml?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/837915/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/837915/image.png)
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 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!