-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for XML 1.1 #29
Comments
Sorry for the late response. Thank you for the suggestion. I'll look into it! |
I'm not sure how invalid characters are sneaking in there. ez-vcard uses Java's XML API to create the XML document, so it should automatically escape any characters that are not supported by XML 1.0. Can you include a code sample? As for supporting XML 1.1, the code sample below might work for you. Although, apparently, this only works with certain JVMs (according to my testing) XCardDocument xcardDoc = ...
Document doc = xcardDoc.getDocument();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.VERSION, "1.1");
DOMSource source = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
transformer.transform(source, result);
String xml = writer.toString(); |
I posted a question on Stackoverflow about writing XML 1.1 document in Java. Apparently, the XML libraries bundled with the JDK are quite old, so you have to include a more up-to-date library to support 1.1. If you add the xalan-2.7.2 library to your classpath, then you can use the code that I wrote in the above post to output an XML 1.1 document. |
Added the ability to specify the XML version when writing xCards: 10e22e7 |
While investigating an issue with importing a .vcf file that was exported from OS X, we found ASCII characters that are not supported by the default XML 1.0 version generated when creating a new XCardDocument. The issue is revealed later when a backend component attempts to parse the generated XML using SAX.
I was looking for a way via ez-vcard to allow setting the XML version to 1.1 when generating the XCardDocument.
The text was updated successfully, but these errors were encountered: