public static System.IO.MemoryStream getStream(Document doc) { KXmlSerializer serializer = new KXmlSerializer(); System.IO.MemoryStream bos = new System.IO.MemoryStream(); //UPGRADE_TODO: Class 'java.io.DataOutputStream' was converted to 'System.IO.BinaryWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataOutputStream'" System.IO.BinaryWriter dos = new System.IO.BinaryWriter(bos); try { serializer.setOutput(dos, null); doc.write(serializer); serializer.flush(); return(bos); } catch (System.Exception e) { if (e is org.javarosa.core.io.StreamsUtil.DirectionalIOException) { ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)e).printStackTrace(); } else { SupportClass.WriteStackTrace(e, Console.Error); } return(null); } }
public static sbyte[] getUtfBytes(Document doc) { KXmlSerializer serializer = new KXmlSerializer(); System.IO.MemoryStream bos = new System.IO.MemoryStream(); try { //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Writer' and 'System.IO.StreamWriter' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'" //UPGRADE_TODO: Constructor 'java.io.OutputStreamWriter.OutputStreamWriter' was converted to 'System.IO.StreamWriter.StreamWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioOutputStreamWriterOutputStreamWriter_javaioOutputStream_javalangString'" System.IO.StreamWriter osw = new System.IO.StreamWriter(bos, System.Text.Encoding.GetEncoding("UTF-8")); serializer.setOutput(osw); doc.write(serializer); serializer.flush(); return(SupportClass.ToSByteArray(bos.ToArray())); } catch (System.Exception e) { if (e is org.javarosa.core.io.StreamsUtil.DirectionalIOException) { ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)e).printStackTrace(); } else { SupportClass.WriteStackTrace(e, Console.Error); } return(null); } }
public virtual XFormParser getXFormParser(Document form, Document instance) { XFormParser parser = new XFormParser(form, instance); init(parser); return(parser); }
public virtual XFormParser getXFormParser(Document doc) { XFormParser parser = new XFormParser(doc); init(parser); return(parser); }
public static System.String getString(Document doc) { System.IO.MemoryStream bos = getStream(doc); sbyte[] byteArr = SupportClass.ToSByteArray(bos.ToArray()); char[] charArray = new char[byteArr.Length]; for (int i = 0; i < byteArr.Length; i++) { charArray[i] = (char)byteArr[i]; } return(System.Convert.ToString(charArray)); }
/* * (non-Javadoc) * @see org.javarosa.core.model.utils.ITreeVisitor#visit(org.javarosa.core.model.DataModelTree) */ public virtual void visit(FormInstance tree) { theXmlDoc = new Document(); //TreeElement root = tree.getRoot(); TreeElement root = tree.resolveReference(rootRef); //For some reason resolveReference won't ever return the root, so we'll //catch that case and just start at the root. if (root == null) { root = tree.getRoot(); } for (int i = 0; i < root.NumChildren; i++) { TreeElement childAt = root.getChildAt(i); } if (root != null) { theXmlDoc.addChild(Node.ELEMENT, serializeNode(root)); } Element top = theXmlDoc.getElement(0); System.String[] prefixes = tree.NamespacePrefixes; for (int i = 0; i < prefixes.Length; ++i) { top.setPrefix(prefixes[i], tree.getNamespaceURI(prefixes[i])); } if (tree.schema != null) { top.setNamespace(tree.schema); top.setPrefix("", tree.schema); } }
private void init() { theXmlDoc = null; schema = null; dataPointers = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); }