copy paste docbook

Questions about XML that are not covered by the other forums should go here.
ramjill
Posts: 16
Joined: Tue Nov 08, 2011 2:14 pm

copy paste docbook

Post by ramjill »

hi,

when i copy paste the html text from browser in docbook xml file it shows validation errors.


how to copy paste text from browser.

is there any setting to do in oxygen.

can you explain?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: copy paste docbook

Post by sorin_ristache »

Hi,

It is not always possible to paste a copied fragment in Author mode and keep the XML document valid after the paste operation. If the copied fragment cannot be placed at the paste location without creating a validation error you will see a dialog box in Author mode with some options with different ways of avoiding the validation error. Usually these options propose adding or removing a surrounding XML element or moving the paste location to the next or previous element relative to the current cursor location.

Please specify what is the document type in which you want to paste the copied fragment (DITA, Docbook, TEI, etc) and also give an example of the copied fragment and the paste location in the target document. What is the result of the paste operation in the target document? Does Oxygen display the dialog box with the paste strategies for avoiding a validation error?

If you want to paste plain text instead of XML markup of the target document you have to disable the option Convert external content on paste from menu Options -> Preferences -> Editor -> Edit modes -> Author -> Schema aware.


Regards,
Sorin
ramjill
Posts: 16
Joined: Tue Nov 08, 2011 2:14 pm

Re: copy paste docbook

Post by ramjill »

hi,

i used docbook xml and i copied content from browser. when i paste oxygen displays the error message dialogue.

i specify the content below.

refer url: http://en.wikipedia.org/wiki/Hyacinths

Hyacinth bulbs are poisonous; they contain oxalic acid.[4] Handling hyacinth bulbs can cause mild irritation to people with sensitive skin. Protective gloves may be worn to avoid irritation.
Contents
[hide]

* 1 Myth associated with Hyacinth
* 2 See also
* 3 References
* 4 External links


how i can paste html text without getting error. actually i am new to oxygen, i dnt know how to use properly.

please explain.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: copy paste docbook

Post by sorin_ristache »

We need more details for understanding the problem. What is the paste location? In what Docbook element is the cursor located in Author mode when you paste the fragment?

When you paste in Author mode does Oxygen display a dialog box with some options like split the current para element or paste at current location even if invalid? What option did you select in the dialog box?

Is it a validation error that was created by the paste operation, that is before the paste the Docbook document did not contain validation errors? What is the error message?


Regards,
Sorin
ramjill
Posts: 16
Joined: Tue Nov 08, 2011 2:14 pm

Re: copy paste docbook

Post by ramjill »

hi,

Oxygen author displays the below Error text in dialogue box.i choose first option and paste it. The paste location is within the SECTION tag.

1)inside the closest sec1 element, to the left of the current position
2)at current position as plain text
3)at current position even if invalid



i got error after i paste and also href tag is not pasted properly. see the below sample code.

i copy the content from : http://en.wikipedia.org/wiki/Hyacinths

The content is :

Hyacinth bulbs are poisonous; they contain oxalic acid.[4] Handling hyacinth bulbs can cause mild irritation to people with sensitive skin. Protective gloves may be worn to avoid irritation.
Contents
[hide]

* 1 Myth associated with Hyacinth
* 2 See also
* 3 References
* 4 External links


Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<info>
<title>Book Template Title</title>
<author>
<orgname>Organization Name</orgname>
<address>
<city>City</city>
<street>Street</street>
<postcode>000000</postcode>
<country>Country</country>
</address>
<email>user@example.com</email>
</author>
</info>
<part>
<title>First Part</title>
<subtitle>Subtitle of First Part</subtitle>
<chapter>
<title>Chapter Title</title>
<subtitle>Subtitle of Chapter</subtitle>
<sect1>
<title>Section1 Title</title>
<subtitle>Subtitle of Section 1</subtitle>
<para/>
<para>Hyacinth bulbs are poisonous; they contain <link
xlink:href="http://en.wikipedia.org/wiki/Oxalic_acid">oxalic
acid</link>.<link
xlink:href="http://en.wikipedia.org/wiki/Hyacinths#cite_note-3">[4]</link>
Handling hyacinth bulbs can cause mild irritation to people with sensitive skin.
Protective gloves may be worn to avoid irritation.</para>
<informaltable class="toc" xml:id="toc">
<tbody>
<tr>
<td rowspan="1" colspan="1"> Contents  [<link
xlink:href="http://en.wikipedia.org/wiki/Hyacinths#"
xml:id="togglelink">hide</link>]  <itemizedlist>
<listitem>
<para><link
xlink:href="http://en.wikipedia.org/wiki/Hyacinths#Myth_associated_with_Hyacinth"
>1 Myth associated with Hyacinth</link></para>
</listitem>
<listitem>
<para><link
xlink:href="http://en.wikipedia.org/wiki/Hyacinths#See_also"
>2 See also</link></para>
</listitem>
<listitem>
<para><link
xlink:href="http://en.wikipedia.org/wiki/Hyacinths#References"
>3 References</link></para>
</listitem>
<listitem>
<para><link
xlink:href="http://en.wikipedia.org/wiki/Hyacinths#External_links"
>4 External links</link></para>
</listitem>
</itemizedlist></td>
</tr>
</tbody>
</informaltable>
<para>
</para>
</sect1>
</chapter>
</part>
</book>
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: copy paste docbook

Post by sorin_ristache »

Hi,

After paste I get a Docbook validation error that itemizedlist element is not allowed in td element. Is that the error that you get? It is a case of structure of the copied fragment that is not pasted as a valid Docbook fragment. In the HTML page from the browser there is an itemized list inside a table which is converted by Oxygen Author to a Docbook informaltable element containing an itemizedlist. A simple way of fixing the error is edit the Docbook document and remove the table tags (informaltable, tbody, tr, td) if you don't need the table structure. Other way is move the itemizedlist outside the informaltable element.


Regards,
Sorin
ramjill
Posts: 16
Joined: Tue Nov 08, 2011 2:14 pm

Re: copy paste docbook

Post by ramjill »

Thank you for for your help.


but if i copy and paste from content from word document the format is missing entirely , paste it as a plain text.

how i can solve problem.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: copy paste docbook

Post by sorin_ristache »

If you copy from MS Word to Oxygen Author mode in a Docbook XML document the copied fragment should be pasted as plain text only if:
  • either a dialog box is displayed by the paste operation and you select the option paste as plain text
  • or you disable the option Convert external content on paste from menu Options -> Preferences -> Editor -> Edit modes -> Author -> Schema aware.
Otherwise the copied content should be converted to Docbook markup. Did you paste in a Docbook XML document in Author editing mode? If yes please send us a sample MS Word document and specify what fragment you copied from that Word document and pasted in Author editing mode.


Regards,
Sorin
Post Reply