【问题标题】:How to convert ONIX xml Short tag-names into Reference tag-names?如何将 ONIX xml 短标记名转换为参考标记名?
【发布时间】:2016-08-30 21:18:44
【问题描述】:

我的 XML 短标签文件

    <product>
<a001>CRITICAL-62258</a001
><a002>01</a002>
<productidentifier>
<b221>03</b221>
<b244>9781911106050</b244>
</productidentifier>
<productidentifier>
<b221>15</b221>
<b244>9781911106050</b244>
</productidentifier>
<b012>DG</b012>
<b385>10</b385>
<b211>002</b211>
<series>
<seriesidentifier>
<b273>01</b273>
<b233>Publishers Code</b233>
<b244>181</b244>
</seriesidentifier>
<b018>Critical Teaching</b018>
</series>
<title>
<b202>01</b202>
<b203>Creative Approaches to the Curriculum in Primary Foreign Languages</b203>
</title>
<workidentifier>
<b201>01</b201>
<b233>critical.stisontest.co.uk Content ID</b233>
<b244>48452</b244>
</workidentifier>
<contributor>
<b034>1</b034>
<b035>A01</b035>
<b036>Louise Pagden</b036>
<b037>Pagden, Louise</b037>
<b039>Louise</b039>
<b040>Pagden</b040>
<personnameidentifier>
<b390>01</b390>
<b233>www.stisonbooks.com Author ID</b233>
<b244>44217</b244>
</personnameidentifier>
<b044><p><strong>Louise Pagden is a senior lecturer in teacher development at the University of Winchester where she lectures in primary languages. She has many years of experience in this field, first as a primary school teacher and languages subject leader and later as a primary languages consultant in Hampshire. During her time there she was involved in the implementation of primary languages in the 350 primary schools in the county. Louise has taught in Spain, Argentina, Mexico and India. Her research interests lie in immersion teaching and content and language integrated learning. </strong></p></b044>
</contributor>
<n386/>
<b061>192</b061>
<b064>EDU029000</b064>
<b200>2</b200>
<b065>JNU</b065>
<b066>2.1</b066>
<subject>
<b067>12</b067>
<b068>2.1</b068>
<b069>JNMT</b069>
<b070>Teacher training</b070>
</subject>
<subject>
<b067>12</b067>
<b068>2.1</b068>
<b069>JNT</b069>
<b070>Teaching skills & techniques</b070>
</subject>
<subject>
<b067>23</b067>
<b069>PFL</b069>
<b070>Primary Foreign Languages</b070>
</subject>
<subject>
<b067>23</b067>
<b069>ED</b069>
<b070>Education</b070>
</subject>
<subject>
<b067>23</b067>
<b069>PR</b069>
<b070>Primary</b070>
</subject>
<subject>
<b067>20</b067>
<b070>Primary languages; Language teaching; Foreign languages</b070>
</subject>
<b073>06</b073>
<b073>09</b073>
<othertext>
<d102>01</d102>
<d103>02</d103>
<d104><p>This book enables trainee and qualified teachers to embrace a more creative approach to primary language teaching. The first part of the book focuses on key language skills, including reading, writing, speaking, listening, grammar and phonics, while the second part examines a range of different pedagogical approaches to language teaching, including flipped learning, CLIL, ICT and overseas partnerships. Each chapter includes links to the national curriculum objectives and the Key Stage 2 framework for languages, notes on progression and assessment, implications for transition and a detailed case study demonstrating the skill or approach in practice. In addition the text critically explores up-to-date theory and research, making clear links between theory and practice. </p>
</d104></othertext>
<othertext><d102>02</d102><d103>02</d103><d104><p>An up to date text for trainee and qualified primary teachers promoting a more creative approach to primary language teaching. </p>
</d104></othertext>
<othertext>
<d102>04</d102><d104><p><em>Glossary</em></p>
<p><em>Introduction</em></p>
<p><strong>PART 1: Key skills</strong></p>
<p><span>1. Speaking and listening</span></p>
<p><span>2. Reading </span></p>
<p><span>3. Writing</span></p>
<p><span>4. Getting to grips with grammar</span></p>
<p><span>5. Phonics</span></p>
<p><strong>PART 2: Contexts for learning</strong></p>
<p><span>6. Cross-curricular links: music and arts; drama and role play</span></p>
<p><span>7. CLIL and immersion</span></p>
<p><span>8. Languages in the digital age</span></p>
<p><span>9. Enquiry based learning</span></p>
<p><span>10. Partnerships and exchanges</span></p>
<p><em>Key websites and sources of support</em></p>
<p><em>Bibliography</em></p>
<p><em>Index</em></p>
</d104>
</othertext>
<othertext>
<d102>18</d102>
<d104>
<p>This book enables trainee and qualified teachers to embrace a more creative approach to primary language teaching. The first part of the book focuses on key language skills, including reading, writing, speaking, listening, grammar and phonics, while the second part examines a range of different pedagogical approaches to language teaching, including flipped learning, CLIL, ICT and overseas partnerships. Each chapter includes links to the national curriculum objectives and the Key Stage 2 framework for languages, notes on progression and assessment, implications for transition and a detailed case study demonstrating the skill or approach in practice. In addition the text critically explores up-to-date theory and research, making clear links between theory and practice. </p>
</d104>
</othertext>
<productwebsite>
<b367>01</b367>
<f123>www.criticalpublishing.com</f123>
</productwebsite>
<imprint>
<b241>02</b241>
<b242>Proprietary</b242>
<b243>CPC</b243>
<b079>Critical Publishing</b079>
</imprint>
<publisher>
<b291>01</b291>
<b081>Critical Publishing</b081>
</publisher>
<b209>Northwich</b209>
<b083>GB</b083>
<b394>02</b394>
<b003>20170120</b003>
<salesrights>
<b089>01</b089>
<b388>WORLD</b388>
</salesrights>
<relatedproduct>
<h208>06</h208>
<productidentifier>
<b221>15</b221>
<b244>9781911106036</b244>
</productidentifier>
</relatedproduct>
<relatedproduct>
<h208>06</h208>
<productidentifier>
<b221>15</b221>
<b244>9781911106043</b244>
</productidentifier>
</relatedproduct>
<relatedproduct>
<h208>13</h208>
<productidentifier>
<b221>15</b221>
<b244>9781911106029</b244>
</productidentifier>
</relatedproduct>
<supplydetail>
<j137>NBN International</j137>
<j396>10</j396>
<j142>20170113</j142>
<price>
<j148>01</j148>
<j151>26.00</j151>
<j152>EUR</j152>
</price>
<price>
<j148>02</j148>
<j151>22.00</j151>
<j152>GBP</j152>
<j153>S</j153>
<j154>20.0</j154>
<j155>18.50</j155>
<j156>3.50</j156>
</price>
</supplydetail>
<supplydetail>
<j137>International Specialized Book Services</j137>
<j270>1-800-944-6190</j270><j272>customerservice@isbs.com</j272>
<j138>US</j138>
<j396>10</j396>
<j142>20170113</j142>
<price>
<j148>01</j148>
<j151>33.00</j151>
<j152>USD</j152>
</price>
</supplydetail>
</product>

我想将此短标记名转换为引用标记名。为了转换为短标签名,我尝试了这个

我创建了一个文件夹,并将 xml 文件和 jar 文件放入其中。对于转换,我找到了一个名为 Saxon.jar 的 jar。我打开了我的命令提示符,因为我来到了我放置文件的任何地方。

E:\Arunselvan> java -jar saxon9.jar "criticalonix.xml" switch-onix-tagnames-2.0.xsl result-document="" dtd-path ="ONIX_BookProduct_3.0_reference.dtd" 如果我给出这个错误,我会遇到:Bad param = value pair on command line。 我用这个放置了命令提示符图像

我的截图在这里 Screenshot of short tag to reference tag conversion

我想要这样的输出文件参考标签名

<Product>
      <RecordReference>1512722278</RecordReference>
      <NotificationType>04</NotificationType>
      <ProductIdentifier>
         <ProductIDType>02</ProductIDType>
         <IDValue>1512722278</IDValue>
      </ProductIdentifier>
      <ProductIdentifier>
         <ProductIDType>03</ProductIDType>
         <IDValue>9781512722277</IDValue>
      </ProductIdentifier>
      <ProductIdentifier>
         <ProductIDType>15</ProductIDType>
         <IDValue>9781512722277</IDValue>
      </ProductIdentifier>
      <ProductForm>BC</ProductForm>
      <ProductFormDetail>B102</ProductFormDetail>
      <ProductFormFeature>
         <ProductFormFeatureType>02</ProductFormFeatureType>
         <ProductFormFeatureDescription>CRE</ProductFormFeatureDescription>
      </ProductFormFeature>
      <TitleDetail>
         <TitleType>01</TitleType>
         <TitleElement>
            <TitleElementLevel>01</TitleElementLevel>
            <TitleText>Everyday Evangelism</TitleText>
            <SubTitle> Practical Tips to Use Today</SubTitle>
         </TitleElement>
      </TitleDetail>
      <Contributor>
         <SequenceNumber>1</SequenceNumber>
         <ContributorRole>A01</ContributorRole>
         <PersonName>Laura Yang </PersonName>
         <PersonNameInverted>Yang, Laura</PersonNameInverted>
         <NamesBeforeKey>Laura </NamesBeforeKey>
         <KeyNames>Yang</KeyNames>
      </Contributor>
      <EditionVersionNumber>20160205204457</EditionVersionNumber>
      <Language>
         <LanguageRole>01</LanguageRole>
         <LanguageCode>eng</LanguageCode>
      </Language>
      <NumberOfPages>96</NumberOfPages>
      <Illustrations>
         <IllustrationType>01</IllustrationType>
         <IllustrationTypeDescription>1:B&amp;amp;W 5.5 x 8.5 in or 216 x 140 mm (Demy 8vo) Perfect Bound on Creme w/Gloss Lam</IllustrationTypeDescription>
      </Illustrations>
      <Subject>
         <MainSubject />
         <SubjectSchemeIdentifier>10</SubjectSchemeIdentifier>
         <SubjectCode>REL012070</SubjectCode>
         <SubjectHeadingText>Religion : Christian Life - Personal Growth</SubjectHeadingText>
      </Subject>
      <Subject>
         <SubjectSchemeIdentifier>10</SubjectSchemeIdentifier>
         <SubjectCode>REL012100</SubjectCode>
         <SubjectHeadingText>Religion : Christian Life - Relationships</SubjectHeadingText>
      </Subject>
      <Subject>
         <SubjectSchemeIdentifier>10</SubjectSchemeIdentifier>
         <SubjectCode>REL012120</SubjectCode>
         <SubjectHeadingText>Religion : Christian Life - Spiritual Growth</SubjectHeadingText>
      </Subject>
      <TextContent>
         <TextType>03</TextType>
         <ContentAudience>00</ContentAudience>
         <Text textformat="02"><![CDATA[<p>Written by an "everyday" Christian, this book contains simple, straightforward suggestions for sharing your faith.  Everyday Evangelism empowers you to tell others about Christ today.<p> 

<p>Discover new ideas and practical ways to share the gospel in your daily life.  Interspersed with scripture, the tips are grouped into eleven categories-for example:  "Super Simple," "Critical Conversation," and "Often-Forgotten."<p>

<p>Experience the exhilarating joy that God intends for you by sharing the gospel.  Use Everyday Evangelism as a tool to unleash the power of the Holy Spirit within you to "go and make disciples of all nations" (Matthew 28:19).</p>]]></Text>
      </TextContent>
      <SupportingResource>
         <ResourceContentType>01</ResourceContentType>
         <ContentAudience>00</ContentAudience>
         <ResourceMode>03</ResourceMode>
         <ResourceVersion>
            <ResourceForm>02</ResourceForm>
            <ResourceVersionFeature>
               <ResourceVersionFeatureType>01</ResourceVersionFeatureType>
               <FeatureValue>D502</FeatureValue>
            </ResourceVersionFeature>
         </ResourceVersion>
         <ResourceLink>http://image-hub.lightningsource.com/2011-04-01/Images/front_cover/x/sku/1512722278.jpg</ResourceLink>
      </SupportingResource>
      <SupportingResource>
         <ResourceContentType>02</ResourceContentType>
         <ContentAudience>00</ContentAudience>
         <ResourceMode>03</ResourceMode>
         <ResourceVersion>
            <ResourceForm>02</ResourceForm>
            <ResourceVersionFeature>
               <ResourceVersionFeatureType>01</ResourceVersionFeatureType>
               <FeatureValue>D502</FeatureValue>
            </ResourceVersionFeature>
         </ResourceVersion>
         <ResourceLink>http://image-hub.lightningsource.com/2011-04-01/Images/back_cover/x/sku/1512722278.jpg</ResourceLink>
      </SupportingResource>
      <PublishingDetail>
         <Imprint>
            <ImprintName>Westbow Press</ImprintName>
         </Imprint>
         <Publisher>
            <PublisherName>AuthorHouse</PublisherName>
         </Publisher>
      </PublishingDetail>
      <PublishingDate>
         <PublishingDateRole>01</PublishingDateRole>
         <DateFormat>00</DateFormat>
         <Date>20160205</Date>
      </PublishingDate>
      <Measure>
         <MeasureType>01</MeasureType>
         <Measurement>8.50</Measurement>
         <MeasureUnitCode>in</MeasureUnitCode>
      </Measure>
      <Measure>
         <MeasureType>02</MeasureType>
         <Measurement>5.50</Measurement>
         <MeasureUnitCode>in</MeasureUnitCode>
      </Measure>
      <Measure>
         <MeasureType>03</MeasureType>
         <Measurement>0.23</Measurement>
         <MeasureUnitCode>in</MeasureUnitCode>
      </Measure>
      <Measure>
         <MeasureType>08</MeasureType>
         <Measurement>0.294</Measurement>
         <MeasureUnitCode>lb</MeasureUnitCode>
      </Measure>
      <ProductSupply>
         <Market>
            <Territory>
               <CountriesIncluded>IN</CountriesIncluded>
            </Territory>
            <SupplyDetail>
               <Supplier>
                  <SupplierRole>07</SupplierRole>
                  <SupplierName>Lightning Source Inc.</SupplierName>
               </Supplier>
               <ReturnsConditions>
                  <ReturnsCodeType>02</ReturnsCodeType>
                  <ReturnsCode>N</ReturnsCode>
               </ReturnsConditions>
               <ProductAvailability>20</ProductAvailability>
               <SupplyDate>
                  <SupplyDateRole>08</SupplyDateRole>
                  <DateFormat>00</DateFormat>
                  <Date>20160205</Date>
               </SupplyDate>
               <Stock>
                  <PackQuantity>72</PackQuantity>
               </Stock>
               <Price>
                  <PriceType>01</PriceType>
                  <DiscountCoded>
                     <DiscountCodeType>02</DiscountCodeType>
                     <DiscountCodeTypeName>LSI</DiscountCodeTypeName>
                     <DiscountCode>36</DiscountCode>
                  </DiscountCoded>
                  <PriceAmount>9.95</PriceAmount>
                  <CurrencyCode>USD</CurrencyCode>
               </Price>
            </SupplyDetail>
         </Market>
      </ProductSupply>
   </Product>

【问题讨论】:

    标签: java xml xslt saxon onix


    【解决方案1】:

    1) Windows 命令行中等号("=") 前后不能有空格。所以应该是

    dtd-path="ONIX_BookProduct_3.0_reference.dtd" 
    

    而不是

    dtd-path ="ONIX_BookProduct_3.0_reference.dtd" 
    

    这就是为什么您会收到“Bad param = value pair”错误

    2) 您的输入 XML 包含 & 符号,它是 XML 格式的保留字符。将其替换为&amp;amp; 实体

    3) 显然在此地址上找不到此 DTD。您应该下载所有必需的 DTD:

    • ONIX_BookProduct_3.0_reference.dtd
    • ONIX_BookProduct_CodeLists.dtd
    • ONIX_XHTML_Subset.dtd

    可以找到例如这里: http://www.editeur.org/files/ONIX%203/ONIX_BookProduct_DTDs+codes_Issue_33.zip

    然后您可以在 DTD 声明中指向本地文件。 我还认为您的输入文件应该包含 DTD 声明和 ONIX 发布信息:

    <?xml version=1.0 encoding=UTF-8"?>
    <!DOCTYPE ONIXmessage SYSTEM "ONIX_BookProduct_3.0_reference.dtd">
    <ONIXmessage release="3.0">
    ...
    (your original XML short tag input)
    ...
    </ONIXmessage>
    

    假设您将 DTD 解压缩到同一目录,则此声明是正确的。

    【讨论】:

      【解决方案2】:

      假设您想使用样式表http://www.editeur.org/files/ONIX%203/switch-onix-tagnames-2.0.xsl,那么它看起来好像需要一些参数,并且名为result-document 的那个应该是您的结果文件的名称,因此您需要决定该名称并通过它在。一个空字符串作为结果文件名将不起作用。

      那就试试吧

      java -jar saxon9.jar criticalonix.xml switch-onix-tagnames-2.0.xsl result-document=result.xml dtd-path=ONIX_BookProduct_3.0_reference.dtd
      

      【讨论】:

      • 我在控制台中尝试过这个。它显示消息为错误。 java.io.FileNotFoundException:editeur.org/onix/2.1/short/onix-international.dtd。转换失败:报告了运行时错误
      • 恐怕我不熟悉您正在使用的文档格式。样式表尝试根据输入 XML 中的参数和值构造 DTD URI,我不知道哪些值适合您拥有的格式或您想要的格式或需要这些值。我的回答主要是为了展示撒克逊语的使用,希望看到onyx标签的人可以帮助你正确的DTD,如果你自己想不通的话。
      • 您不能再使用 editeur.org 上托管的 DTD(自 2014 年底以来),但必须在本地服务器上设置您自己的 DTD。如何在这里找到说明:editeur.org/files/ONIX%202.1/…
      猜你喜欢
      • 2023-03-23
      • 1970-01-01
      • 2016-02-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多