I have a simple webservice which has one method which saves an xml 'string' as a blob.
Another method then reads this back in, attempts to parse it & then change a value in it.
Once this is done I want to pass this string on to another class. I do not want to create any files.
However when parsing the XML I have been getting constant errors, the latest of which is:
SAXParseException: XML document structures must start and end within the same entity.
This gets thrown by the line: Document doc = builder.parse(newInputStream);
I have read the input in as a string so I can see that the data looks ok & is all present.
So... at line 29 you read some, or perhaps all, of the bytes from the blob. Then you make them into a String which isn't referenced anywhere else.
Then at line 39 you pass the rest of the bytes, if there are any left, to the XML parser. This doesn't make much sense. Deleting lines 26 to 32 would make more sense; then you would just be passing the contents of the blob to the parser.
Joined: Oct 11, 2009
Lines 26 - 32 were there so I could print out as a string what I was reading back from the database to check if it was valid.
Line 33 introduced a new stream to read the data again as you cannot reuse the existing stream as it has already read the data, this was giving another error.
While aesthetically correct neither of these points are relevant to the issue at hand.
I did manage to fix this however by changing how I was reading the stream in & also by fixing up my data.
Thanks for the comments.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: SAXParseException: XML document structures must start and end within the same entity.