locked
Java Table API Exception retrieving entity (invalid XML character) RRS feed

  • Question

  • Using the java Table api, I'm retrieving entities and get an exception:

    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5663,78]

    Message: An invalid XML character (Unicode: 0x{2}) was foudn in the value of attribute "{1}" and element is "0"

    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
    at com.microsoft.windowsazure.services.table.client.AtomPubParser.parseEntity(AtomPubParser.java:105)
    at com.microsoft.windowsazure.services.table.client.AtomPubParser.parseResponse(AtomPubParser.java:257)
    at com.microsoft.windowsazure.services.table.client.CloudTableClient.executeQuerySegmentedCore(CloudTableClient.java:817)
    at com.microsoft.windowsazure.services.table.client.CloudTableClient$3.execute(CloudTableClient.java:955)
    at com.microsoft.windowsazure.services.table.client.CloudTableClient$3.execute(CloudTableClient.java:949)
    at com.microsoft.windowsazure.services.core.storage.utils.implementation.ExecutionEngine.executeWithRetry(ExecutionEngine.java:111)

    If I knew what "Attribute {1} and element 0" means, I could probably track down the problem, as it is, both VS 2012 Server Explorer and Azure Storage Explorer both allow viewing of the data stored without a problem.

    Is this a problem with the Java API or with my method for storing and retrieving data? Im using Azure Cloud Storage (remote).

    Friday, June 14, 2013 5:23 PM

All replies

  • can this be issue with your character encoding, meaning char is in certain encoding but when you read it you read it in a different encoding?

    Please mark as answered if it helped Vishal Narayan Saxena http://twitter.com/vishalishere http://www.ogleogle.com/vishal/

    Friday, June 14, 2013 5:37 PM
  • My main concern is which field is this? 

    I wrapped one of my data fields (the most likely culprit)  in Base64 encoding, and now this error has gone, but I'd like to know what "attribute {1} element 0" means.

    Friday, June 14, 2013 6:12 PM
  • sounds to me that in the xml you are trying to read you should peek into first element (meaning <tag>) and attribute {1} (meaning <tag attribute0="" attribute1="some value">)

    hope this helps


    Please mark as answered if it helped Vishal Narayan Saxena http://twitter.com/vishalishere http://www.ogleogle.com/vishal/

    Friday, June 14, 2013 6:19 PM
  • Im not reading XML, I'm using the Azure library

    CloudTableClient.execute(query).iterator()

    Sometimes  I run the query and the exception occurs, other times no exception occurs. The data in the table is the same.

    the exception occurs when I call either iterator.hasNext() or iterator.next().

    Why is this occuring?

    Monday, June 17, 2013 5:53 PM
  • My guess is that azure library is reading it as xml (reason being its reporting an invalid XML character)

    without seeing data i can not tell why exactly is it happening, 

    try following to isolate the issue

    1) Create a small java application that reads the data from your table, use the same encoding as you have while reading through azure library 

    2) debug through code and see what characters are present in db that are causing it,

    i know its painful exercise but unluckily there is no easy way out, i had to do it once from our customer database for 10mil records, it was time consuming but was worth to know what caused it and avoided me some sleepless nights


    Please mark as answered if it helped Vishal Narayan Saxena http://twitter.com/vishalishere http://www.ogleogle.com/vishal/


    Monday, June 17, 2013 10:11 PM
  • Are you kidding? Step through my data one by one to find out where the bad data is?

    Why is this crash occurring randomly? Same call to get the same data? It feels more like a breakdown in comms causing some corruption of data. Is that possible?

    Monday, June 17, 2013 11:10 PM
  • it may be the cause.. not sure.. i am not a java guy :( i still feel its the data that may be causing it, is there a way for you to identify what records are present in the dataset when problem happens?

    Please mark as answered if it helped Vishal Narayan Saxena http://twitter.com/vishalishere http://www.ogleogle.com/vishal/

    Wednesday, June 19, 2013 9:04 PM