From time to time, customers ask us for our "XML Schema" for our XMP/XML
annotations.. the serialized annotation data saved out from our SDK
The short answer is that we do not provide one, and that furthermore, manual
editing/ modification of serialized Atalasoft annotations is utterly
unsupported.
The longer answer is as follows:
Our XML / XMP annotations which are saved
out when exporting to XMP format is the direct result of serialization of our
AnnotationData objects. Those objects can change without notice as they're
internal to Atalasoft. We will not change our Public APIs without documentation/
notice and we work hard to ensure that our own components "round trip"
read/write annotation data correctly... and that furthermore that our current
components will properly understand older AnnotationData.
When a customer directly modifies our XMP or attempts to mimic our Annotation
object creation/serialization making their own XML / XMP, we have no way of
ensuring that it will properly round trip.. and worse yet, such manual
creation/modification can introduce subtle errors/issues into the annotation
data which could make for exceedingly difficult and time consuming
troubleshooting/debugging and can consume huge amounts of Atalasoft support and
engineering resources when customers report such bugs which are ultimately
caused my manual modification of our XML
For those reasons, we can not and will not provide an XML Schema. Also, if we
encounter an issue due to direct customer manipulation of our XML serialized
annotations, the official reply is that such modification is utterly
unsupported.
If you have a situation where you need to add custom data to annotations or
are unsure of how to modify serialized annotation data in a way that is
compliant with Atalasoft best practices, please feel free to create a support
case
If you need to make alterations to annotations, please load your annotation
data into an AnnotationController object and then use the AnnotationController
and our normal Annotation API
EXAMPLE
string inFile = @"C:\somePath\to\input.xml";
string outFile = @"C:\somepath\to\output.xml";
using (FileStream inStream = File.OpenRead(inFile))
{
// Create the controller and load annotation data to be
modified
AnnotationController ac = new AnnotationController();
ac.Load(inStream, new XmpFormatter());
// lets say you wan to go through all annotations and set RectangleAnnotation
objects to have a red fill
foreach (LayerAnnotation la in ac.Layers)
{
foreach (AnnotationUI anno in la.Items)
{
if
(anno.GetType() == typeof(RectangleAnnotation))
{
RectangleAnnotation ra = anno as RectangleAnnotation;
ra.Fill = new AnnotationBrush(Color.Red);
}
}
}
//Once you're done changing things .. save it out
ac.Save(outFile,
new XmpFormatter());
}
Original Article:
Q10455 - FAQ: Is there an XML Schema for Atalasoft Annotations