Class XmiCasSerializer.XmiDocSerializer

    • Field Detail

      • ch

        private final org.xml.sax.ContentHandler ch
      • emptyAttrs

        private final org.xml.sax.helpers.AttributesImpl emptyAttrs
      • workAttrs

        private final org.xml.sax.helpers.AttributesImpl workAttrs
    • Method Detail

      • writeViewMembers

        private java.lang.StringBuilder writeViewMembers​(java.lang.StringBuilder sb,
                                                         java.util.Collection<java.lang.String> members,
                                                         boolean isPastFirstElement)
        version for out-of-type-system data being merged back in not currently supported for JSON
        Parameters:
        sb - - where output goes
        members - string representations of the out of type system ids
        isPastFirstElement - -
        Returns:
        -
      • writeViewMembers

        private boolean writeViewMembers​(java.lang.StringBuilder sb,
                                         java.util.Collection<TOP> members)
                                  throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • writeViewForDeltas

        private void writeViewForDeltas​(java.lang.String kind,
                                        java.util.Collection<TOP> deltaMembers)
                                 throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • writeNullObject

        void writeNullObject()
                      throws org.xml.sax.SAXException
        Writes a special instance of dummy type uima.cas.NULL, having xmi:id=0. This is needed to represent nulls in multi-valued references, which aren't natively supported in Ecore.
        Throws:
        org.xml.sax.SAXException - -
      • writeFsOrLists

        private void writeFsOrLists​(TOP fs,
                                    int typeCode,
                                    boolean isListAsFSs)
                             throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • endPrefixMappings

        private void endPrefixMappings()
                                throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • computeNamespaceDeclarationAttrs

        private void computeNamespaceDeclarationAttrs​(org.xml.sax.helpers.AttributesImpl workAttrs2)
                                               throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • serializeOutOfTypeSystemElements

        private void serializeOutOfTypeSystemElements()
                                               throws org.xml.sax.SAXException
        Serializes all of the out-of-typesystem elements that were recorded in the XmiSerializationSharedData during the last deserialization.
        Throws:
        org.xml.sax.SAXException
      • encodeFeatures

        private java.util.List<XmlElementNameAndContents> encodeFeatures​(TOP fs,
                                                                         org.xml.sax.helpers.AttributesImpl attrs,
                                                                         boolean insideListNode)
                                                                  throws org.xml.sax.SAXException
        Encode features of a regular (non-array) FS.
        Parameters:
        addr - Address of the FS
        attrs - SAX Attributes object, to which we will add attributes
        insideListNode - true iff this FS is a List type.
        Returns:
        a List of XmlElementNameAndContents objects, each of which represents an element that should be added as a child of the FS
        Throws:
        org.xml.sax.SAXException - passthru
      • arrayToString

        private java.lang.String arrayToString​(TOP fsIn,
                                               int arrayType)
                                        throws org.xml.sax.SAXException
        Not called for StringArray
        Parameters:
        fsIn - -
        arrayType - -
        Returns:
        -
        Throws:
        org.xml.sax.SAXException - -
      • stringArrayToElementList

        private void stringArrayToElementList​(java.lang.String featName,
                                              StringArray stringArray,
                                              java.util.List<? super XmlElementNameAndContents> resultList)
      • listToString

        private java.lang.String listToString​(CommonList fs)
                                       throws org.xml.sax.SAXException
        Converts a CAS List of Int, Float, or FsRefs to its string representation for use in multi-valued XMI properties. Only called if no sharing of list nodes exists. Only called for list nodes referred to by Feature value slots in some non-list FS.
        Parameters:
        curNode - address of the CAS ListFS
        Returns:
        String representation of the array, or null if passed in CASImpl.NULL
        Throws:
        org.xml.sax.SAXException - passthru
      • sendElementEvents

        private void sendElementEvents​(java.util.List<? extends XmlElementNameAndContents> elements)
                                throws org.xml.sax.SAXException
        Generate startElement, characters, and endElement SAX events. Only for StringArray and StringList kinds of things. Only called for XMI (not JSON)
        Parameters:
        elements - a list of XmlElementNameAndContents objects representing the elements to generate
        Throws:
        org.xml.sax.SAXException - passthru
      • startElement

        private void startElement​(XmlElementName name,
                                  org.xml.sax.Attributes attrs,
                                  int aNumChildren)
                           throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • endElement

        private void endElement​(XmlElementName name)
                         throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • addAttribute

        private void addAttribute​(org.xml.sax.helpers.AttributesImpl attrs,
                                  java.lang.String attrName,
                                  java.lang.String attrValue)
      • addAttribute

        private void addAttribute​(org.xml.sax.helpers.AttributesImpl attrs,
                                  java.lang.String attrName,
                                  java.lang.String attrValue,
                                  java.lang.String type)
      • addIdAttribute

        private void addIdAttribute​(org.xml.sax.helpers.AttributesImpl attrs,
                                    java.lang.String attrValue)
      • addText

        private void addText​(java.lang.String text)
                      throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • uimaTypeName2XmiElementName

        protected XmlElementName uimaTypeName2XmiElementName​(java.lang.String uimaTypeName)
        Converts a UIMA-style dotted type name to the element name that should be used in the XMI serialization. The XMI element name consists of three parts - the Namespace URI, the Local Name, and the QName (qualified name). Namespace URI = http:///uima/noNamespace.ecore or http:///uima/package/name/with/slashes.ecore
        Specified by:
        uimaTypeName2XmiElementName in class CasSerializerSupport.CasSerializerSupportSerialize
        Parameters:
        uimaTypeName - a UIMA-style dotted type name
        Returns:
        a data structure holding the three components of the XML element name