Question

Header closing not correct in XML formation

  • 8 December 2014
  • 4 replies
  • 1 view

Badge +1
Hi,

 

I am working with XML creation and I am getting an issue with header closing. The ideal way for XML formation should be:

 

<TTSInput>

 

<TTSActionID>

 

<Dataset>S12</Dataset>

 

</TTSActionID>

 

</TTSINPUT>

 

 

<UPDATEROAD>

 

<ID>7</ID>

 

<FEATURE>ROAD</FEATURE>

 

<SPEED>60</SPEED>

 

</UPDATEROAD>

 

 

<FINALIZE 1111/>

 

</TTSINPUT>

 

 

Blank spaces denote sections of Header, Body and Footer respectively. The Bold and underlined part has issues i.e, </TTSINPUT>. It shoud cget close at the end of the whole XML (after FINALIZE) while it gets closed in the starting when header is getting closed (denoted by crossed).

 

There is just a minute error with it. Can someone help me with that. Thanks (:

4 replies

Userlevel 4
Hi,

 

 

looks like it's a grouping or sequence issue.

 

 

How are you generating the XML? Personally, I prefer the XMLTemplater and a Text File writer, as it gives complete control over every aspect of the result.

 

 

David
Userlevel 2
Badge +17
Hi,

 

 

I guess you are still fighting with the XML document that you posted a few days ago. (https://safecommunity.force.com/CommunityAnswers?id=906a0000000d6NzAAI)

 

Since you were able to remove unnecessary parts from the document, you can also remove "</TTSINPUT>" with the same process.

 

You can then append "<TTSINPUT>" to the end of the text.

 

Simple and effective, although it's low-tech.

 

 

Takashi
Badge +1

@David R. - I am generating XMLs through XMLTemplater. The writer is XML only (User Attribute Type xml_xml). I am getting everything correct but the closing header is creating a problem. Secondly, if I am taking txt file as writer, the sequence is not correct (even if I use FeatureHolder as used earlier in XML writer.)

 

@Takashi - I am dealing with the same WB as you mentioned :P. The comment issue is resolved by usingTester and StringSearcher. The only issue left is that the closing header should be at the last, so as to binf the XML in one.

 

 

I thing there might be a problem with Counter or ModuloCounter I am working with. I tried checking, but couldn't get the fault in the WB ):
Userlevel 2
Badge +17
Just an idea. If you are reading the file for each line using a Text File reader,

 

- if a line contains "</TTSINPUT>", remove it with the StringReplacer,

 

- if a line contains "<FINALIZE*", append "\\n</TTSINPUT>" to the line with the StringConcatenator.

Reply