What is a striping error?

无人久伴 提交于 2019-12-13 15:52:29

问题


I'm trying to convert last.fm xml data into rdf using xslt and am getting this error: ERROR [http-8080-1] (RDFDefaultErrorHandler.java:40) - (line 3 column 24): {E202} Expecting XML start or end element(s). String data "Joseph Arthur" not allowed. Maybe a striping error.

Can anyone explain to me what a striping error is, or in general what I'm doing wrong.

The xslt code is here:

    <xsl:for-each select="/lfm/artists/artist">
        <lfm:name><xsl:value-of select="name"/></lfm:name>
    </xsl:for-each>

Here's the xml location: http://ws.audioscrobbler.com/2.0/?method=library.getartists&api_key=b25b959554ed76058ac220b7b2e0a026&user=joanofarctan

Thanks.


回答1:


It would really help to see the full xml produced by this, or at least the full xslt and input xml (which doesn't mention 'Joseph Arthur').

So setting all that aside, the rdf/xml you are producing is breaking an important feature called 'striping'. Dan Brickley wrote a useful explanation, but here's a very brief summary: when presented with rdf/xml

<a>
  <b>
    <c>
      <d>

you know that the odd tags (a, c) correspond to nodes in the rdf graph, whereas the even tags (c, d) represent edges, or properties. The syntax 'stripes' nodes and properties.

In addition, if an element contains text it must be a property (nodes elements only ever contain other elements, or nothing).

So the parser thought it was at a node, hence expected more elements, found text, and suggests you were using a property in the wrong place. My guess is your rdf looks like:

<rdf:RDF ...>
  <lfm:name>Joseph Arthur</lfm:name>
  ....

You've said something has the property name with value 'Joseph Arthur', but you haven't included a subject node, so we don't know what has this name.



来源:https://stackoverflow.com/questions/2188220/what-is-a-striping-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!