Hello! I'm a Flare n00b (been using Flare for 2 weeks now) with a sample XML question. I'm working on an API document and need to place some sample XML in a topic. However, Flare seems to think that I'm trying to create a new XML document, and when I try to save the file I get this error message:
The file <filename> contains invalid XML:
Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 44, position 3.
Do you want to open it as text?
I've been using a pre.codeblock style for the sample C# and VB.NET code and it's been working fine (although seems like a kludge to this experienced RH user!). But it's not working for this sample XML. What do I need to do to make this happen?
Thanks to all in advance for any suggestions...
Matso Limtiaco
Everett WA USA
Placing sample XML in a Flare topic?
-
- Sr. Propeller Head
- Posts: 210
- Joined: Mon Sep 19, 2011 2:06 am
- Location: Netherlands - Zoetermeer
- Contact:
Re: Placing sample XML in a Flare topic?
Hi,
Use this "feature":
Create a snippet that contains the XML.
Add the snippet to the TOC.
when the snippet is not used in a topic, but directly in the TOC it will render as XML.
Greetings,
Rene Severens.
Use this "feature":
Create a snippet that contains the XML.
Add the snippet to the TOC.
when the snippet is not used in a topic, but directly in the TOC it will render as XML.
Greetings,
Rene Severens.
"The numbers are strange today; they somehow do not seem to add up."
Re: Placing sample XML in a Flare topic?
I think if you place the XML code inside <pre> tags then it won't try to parse the code.MLimtiaco wrote:Hello! I'm a Flare n00b (been using Flare for 2 weeks now) with a sample XML question. I'm working on an API document and need to place some sample XML in a topic.
Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Re: Placing sample XML in a Flare topic?
@ Lisa - Yup, the content is in a <pre.codeblock> section:
<pre xml:space="preserve" class="Codeblock">
<?xml version="1.0" encoding="UTF=8"?>
<CaptureInfo>
<Image Type="SigCap">
<FilePath>/My Documents/Sigcap.jpg </FilePath>
</Image>
<Barcode>
<STC_IDENTIFIER>xx</ STC_IDENTIFIER>
<Data>QUJDRA==</Data>
</Barcode>
</CaptureInfo></pre>
...and I'm still getting that error. Any ideas?
<pre xml:space="preserve" class="Codeblock">
<?xml version="1.0" encoding="UTF=8"?>
<CaptureInfo>
<Image Type="SigCap">
<FilePath>/My Documents/Sigcap.jpg </FilePath>
</Image>
<Barcode>
<STC_IDENTIFIER>xx</ STC_IDENTIFIER>
<Data>QUJDRA==</Data>
</Barcode>
</CaptureInfo></pre>
...and I'm still getting that error. Any ideas?
Re: Placing sample XML in a Flare topic?
What if you remove the xml:space="preserve" from that pre tag?
Re: Placing sample XML in a Flare topic?
Nope - no effect.crdmerge wrote:What if you remove the xml:space="preserve" from that pre tag?
I can see how creating a separate topic file for just this XML content could work, but it doesn't seem like you should have to leave the API topic page just to see a few sample lines of XML.
Re: Placing sample XML in a Flare topic?
You shouldn't need to do this -- the <pre> tag should be doing it -- but you could try putting a CDATA tag around it. I don't think I've ever noticed a way to do it from within Flare's GUI (Flare puts it in itself sometimes), so you might have to open the topic in the Internal Text Editor and add it yourself.
More info on the CDATA tag is available at http://www.w3schools.com/xml/xml_cdata.asp.
More info on the CDATA tag is available at http://www.w3schools.com/xml/xml_cdata.asp.
Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Re: Placing sample XML in a Flare topic?
You could take a screenshot of the text from notepad or even Flare's internal text editor and insert the xml as an image. I realize there should be a better way...
Re: Placing sample XML in a Flare topic?
Aha! Looks like wrapping the sample XML content in the CDATA tags does the trick.
For those who are following along at home: place "<![CDATA[" immediately after the opening <pre> tag, and place "]]>" immediately before the closing </pre> tag. Works for me and looks like this:
<pre class="Codeblock">
<![CDATA[<?xml version="1.0" encoding="UTF=8"?>
<MyXMLTag>
<MoreXML>Some content goes here</MoreXML>
</MyXMLTag>]]></pre>
Thanks to all for the help!
Matso
For those who are following along at home: place "<![CDATA[" immediately after the opening <pre> tag, and place "]]>" immediately before the closing </pre> tag. Works for me and looks like this:
<pre class="Codeblock">
<![CDATA[<?xml version="1.0" encoding="UTF=8"?>
<MyXMLTag>
<MoreXML>Some content goes here</MoreXML>
</MyXMLTag>]]></pre>
Thanks to all for the help!
Matso