Use of topicmeta in topic body - dita

I am starting to use DITA for writing product specifications. I use the "prodname" metadata to put the product number in the header. Now I am wondering how if at all I can use the same information in the body part of my document. Is there a DITA way to use this information for my purpose? Or is this not "proper" usage?

You can create a <keyword> element and reuse it via a key reference.
DITA Map
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<title><keyword keyref="product"/></title>
<keydef keys="product">
<topicmeta>
<keywords>
<keyword>my product</keyword>
</keywords>
</topicmeta>
</keydef>
<topicref href="topic.dita"/>
</map>
DITA Topic
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic">
<title>my topic</title>
<prolog>
<metadata>
<prodinfo>
<prodname>
<keyword keyref="product"/>
</prodname>
</prodinfo>
</metadata>
</prolog>
<body>
<p><keyword keyref="product"/></p>
</body>
</topic>

Related

Google Merchant throws warning "Unrecognized attribute"

I'm facing an issue I can not explain :
When I'm uploading a feed to Google Merchant in an other language than English, the reports tells me there is many "Unrecognized attribute" that should be valid, like title, link, description, gtin, etc.
In fact, all attributes are considered warning from Google.
But the issue only occurs if it's not in english so my feed seems correct.
What is wrong? Do you have any ideas?
Thank for your help.
Here's a dump of my export (strimed to one product) :
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Google Shopping export for PrestaShop</title>
<item>
<g:id xmlns:g="http://base.google.com/ns/1.0">12345</g:id>
<title>
<![CDATA[ Basic title ]]>
</title>
<link>
<![CDATA[
https://www.example.com/test
]]>
</link>
<description>
<![CDATA[
This is a basic product
]]>
</description>
<g:quantity xmlns:g="http://base.google.com/ns/1.0">39</g:quantity>
<g:availability xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[ in stock ]]>
</g:availability>
<g:price xmlns:g="http://base.google.com/ns/1.0">8.54 EUR</g:price>
<g:product_type xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[ Ofertas > Ofertas ]]>
</g:product_type>
<g:google_product_category xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[
AlimentaciĆ³n, bebida y tabaco > Bebidas > Vino
]]>
</g:google_product_category>
<g:shipping_weight xmlns:g="http://base.google.com/ns/1.0">1.4 kg</g:shipping_weight>
<g:online_only xmlns:g="http://base.google.com/ns/1.0">n</g:online_only>
<g:condition xmlns:g="http://base.google.com/ns/1.0">new</g:condition>
<g:brand xmlns:g="http://base.google.com/ns/1.0">Angove Family Winemakers</g:brand>
<g:mpn xmlns:g="http://base.google.com/ns/1.0">23500023</g:mpn>
<g:gtin xmlns:g="http://base.google.com/ns/1.0"/>
<identifier_exists>FALSE</identifier_exists>
<g:image_link xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[
http://example.com/test/images/1.jpg
]]>
</g:image_link>
<g:shipping xmlns:g="http://base.google.com/ns/1.0">
<g:country>ES</g:country>
<g:service>
<![CDATA[ ENVIALIA-72H ]]>
</g:service>
<g:price>24.2 EUR</g:price>
</g:shipping>
</item>
</channel>
</rss>
I presume you are uploading this as XML.
Are you encoding correctly your xml?
If you're submitting an XML file that uses either Latin-1 or UTF-16 encoding, please make sure you specify this information in your XML file. To do this, please change the first line of your data feed from to:
For Latin-1:
<?xml version="1.0" encoding="ISO-8859-1"?>
For UTF-16:
<?xml version="1.0" encoding="UTF-16"?>
I read this from here:
https://support.google.com/merchants/answer/160079
Also, have you tried to use a XML escape tool? Such as http://www.freeformatter.com/xml-escape.html
I hope this helps!
Have you tried changing the "feed type" to "product" instead of "online product inventory update"? There has been a change since 2015.
<identifier_exists>FALSE</identifier_exists>
should be
<g:identifier_exists>false</g:identifier_exists>
also you have excessive CDATA usage. I don't have any in my XML and it works jut fine. try to submit file without CDATA`s

approach for generating cluster of xpaths from html files in perl

As per one of project requirement, we have to come up with an approach and also suitable perl resource for fullfilling the following requirement.
Our requirement is that we get bulk of input data in html format and we have to write a parser to bring all the varities of input data into one generic formatted xml file.
now the challenge is that while writing parser we manually used to verify very few sample html files, that was failing for other sample html files, but is highly difficult to analyse all html files manually.
Due to the above we have come to a decision that we will have some analysis tool where all the variations in html structure can be monitored using xpaths.
Can you please any of you suggest which module is suitable for my work, I know HTML::TreeBuilder::Xpath will help me in giving xpaths, but any limitations in that module?
or else suggest me the best approach for understanding the analysis of the html file, most of us in our team are more familiar with perl, that's why prefer to go and write in perl.
Suggest me if any other technology can also be used more efficiently, or else within perl also what can be the best approach?
If the html files are guaranteed to be well-formed xhtml, I'd take a look into xslt for transforming the input.
I'd check the output for missing data, since the structure of the input file is unknown. After transforming you can check for the missing data at known paths in the document.
a example how xslt works:
the html input file
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div class="foo">1</div>
<div>
<div class="bar">2</div>
</div>
</body>
</html>
the stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes" />
<xsl:template match="/">
<!-- match the document root -->
<data>
<!-- apply all templates to the input document -->
<xsl:apply-templates />
</data>
</xsl:template>
<xsl:template match="/html/body/div[#class='foo']">
<!-- div with attribute class='foo' is expected only at /html/body/div -->
<foo-out><xsl:value-of select="."></xsl:value-of></foo-out>
</xsl:template>
<xsl:template match="//div[#class='bar']">
<!--div with attribute class=bar can be anywhere in the document-->
<bar-out><xsl:value-of select="."></xsl:value-of></bar-out>
</xsl:template>
</xsl:stylesheet>
the output
<?xml version="1.0"?>
<data>
<foo-out>1</foo-out>
<bar-out>2</bar-out>
</data>

what is the metadata attribute pair in MQFTE ? Why is it used?

I am working with wmqfte. While creating a transfer there is a parameter for metadata attribute pair. Why is this used for ?
One of the FTE engagements I worked on required email notifications of transfer status. Our approach to this was to add an email step in the transfer and the way we passed in the source and destination addresses was with metadata pairs. The transfer XML is provided below for an example:
<?xml version="1.0" encoding="UTF-8"?><request version="4.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FileTransfer.xsd">
<!DOCTYPE request>
<managedTransfer>
<originator>
<hostName>host.example.com</hostName>
<userID>me</userID>
</originator>
<sourceAgent QMgr="QMGR01" agent="AGENT01"/>
<destinationAgent QMgr="QMGR02" agent="AGENT02"/>
<transferSet priority="5">
<metaDataSet>
<metaData key="email.from">fteadmin#example.com</metaData>
<metaData key="email.to">"dept#example.com</metaData>
</metaDataSet>
<item checksumMethod="MD5" mode="binary">
<source disposition="delete" recursive="false">
<file>/root/path/file</file>
</source>
<destination exist="overwrite" type="directory">
<file>/root/path/</file>
</destination>
</item>
</transferSet>
<job>
<name>Your Job Name Here</name>
</job>
</managedTransfer>
</request>
A better way of sending status emails is to watch the transfer notifications published at the Coordination QMgr. However this example does show one possible use for the metadata pairs.

Xml parsing problem

I have an xml like this
<?xml version="1.0" encoding="UTF-8" ?>
<product>
<productname> ----->Dynamic node
</title>
</price>
</desc>
</productname>
<productname> ---->Dynamic node
</title>
</price>
</desc>
</productname>
</product>
productname node is dynamic depends on our request.
how to get the name of the element (productname) and the values of an element.
I use touch xml by Jonathan Wight.

How to add a colorized HTML code snippet in Sandcastle documentation?

I am using the Sandcastle Help File Builder and would like to include colorized HTML code snippets in the "Conceptual Content". Is this possible and if so, how?
I have tried <code>, <codeExample>, and <sampleCode language="HTML" />.
The best result so far is to HTML-encode the sample HTML and place it in a .snippets file like so.
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="HTML">
<span>My Html</span>
</sampleCode>
</item>
</examples>
Then reference it in the .aml file.
<codeReference>htmlSnippet</codeReference>
I would prefer to have it colorized, but I can't figure out a way to add the formatting.
According to the MAML Guide, the proper way of doing this is to use a <code> tag with a CDATA section:
<code language="xml" title="Example Configuration">
<![CDATA[
<span>My Html</span>]]>
</code>
The contents of the CDATA section will be treated as a literal string, and indentation will be preserved.
I know this is old, but Sandcastle supports html as xml. I figured I should comment in case anyone else comes across this post as I did.
This should work:
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="xml"><!CDATA[[
<span>My Html</span>
]]>
</sampleCode>
</item>
</examples>
If you're using Sandcastle Help File Builder, you may create your own syntax parser as described here and here, although xml is available by default... using the XAML filter's generator, which is defined here if you want to look at the config:
<generator type="Microsoft.Ddue.Tools.XamlUsageSyntaxGenerator"
assembly="{#SandcastlePath}ProductionTools\SyntaxComponents.dll">
<filter files="{#SandcastlePath}Presentation\Shared\configuration\xamlSyntax.config" />
</generator>
According to the SHFB documentation for the Code Block Component, you should be able to just use the <code>.
I got it to work without a problem; here's what I did:
test.html
<html>
<head>Something!</head>
<body>
<h1>Heading</h1>
<!-- #region myhtml -->
<p>Paragraph</p>
<div>Div for <strong>Good</strong> <em>measure</em>.</div>
<!-- #endregion -->
</body>
</html>
SomethingorOther.aml
<code language="html" source="../Examples/test.html" region="myhtml" />
Result:
Please note that in the preview, your sample will appear as unhighlighted XML, but when you build the documentation, everything should like just fine.