示例#1
0
        private void StartElement(
            string uri,
            string localName,
            Attributes attlist)
        {
            FObj fobj;

            FObj.Maker fobjMaker = GetFObjMaker(uri, localName);

            PropertyListBuilder currentListBuilder =
                (PropertyListBuilder)this.propertylistTable[uri];

            bool foreignXML = false;

            if (fobjMaker == null)
            {
                string fullName = uri + "^" + localName;
                if (!this.unknownFOs.ContainsKey(fullName))
                {
                    this.unknownFOs.Add(fullName, "");
                    FonetDriver.ActiveDriver.FireFonetError("Unknown formatting object " + fullName);
                }
                if (namespaces.Contains(String.Intern(uri)))
                {
                    fobjMaker = new Unknown.Maker();
                }
                else
                {
                    fobjMaker  = new UnknownXMLObj.Maker(uri, localName);
                    foreignXML = true;
                }
            }

            PropertyList list = null;

            if (currentListBuilder != null)
            {
                list = currentListBuilder.MakeList(uri, localName, attlist, currentFObj);
            }
            else if (foreignXML)
            {
                list = null;
            }
            else
            {
                if (currentFObj == null)
                {
                    throw new FonetException("Invalid XML or missing namespace");
                }
                list = currentFObj.properties;
            }
            fobj = fobjMaker.Make(currentFObj, list);

            if (rootFObj == null)
            {
                rootFObj = fobj;
                if (!fobj.GetName().Equals("fo:root"))
                {
                    throw new FonetException("Root element must" + " be root, not " + fobj.GetName());
                }
            }
            else if (!(fobj is PageSequence))
            {
                currentFObj.AddChild(fobj);
            }

            currentFObj = fobj;
        }
示例#2
0
        private void StartElement(
            string uri,
            string localName,
            Attributes attlist)
        {
            FObj fobj;

            FObj.Maker fobjMaker = GetFObjMaker(uri, localName);

            PropertyListBuilder currentListBuilder =
                (PropertyListBuilder)this.propertylistTable[uri];

            bool foreignXML = false;
            if (fobjMaker == null)
            {
                string fullName = uri + "^" + localName;
                if (!this.unknownFOs.ContainsKey(fullName))
                {
                    this.unknownFOs.Add(fullName, "");
                    FonetDriver.ActiveDriver.FireFonetError("Unknown formatting object " + fullName);
                }
                if (namespaces.Contains(String.Intern(uri)))
                {
                    fobjMaker = new Unknown.Maker();
                }
                else
                {
                    fobjMaker = new UnknownXMLObj.Maker(uri, localName);
                    foreignXML = true;
                }
            }

            PropertyList list = null;
            if (currentListBuilder != null)
            {
                list = currentListBuilder.MakeList(uri, localName, attlist, currentFObj);
            }
            else if (foreignXML)
            {
                list = null;
            }
            else
            {
                if (currentFObj == null)
                {
                    throw new FonetException("Invalid XML or missing namespace");
                }
                list = currentFObj.properties;
            }
            fobj = fobjMaker.Make(currentFObj, list);

            if (rootFObj == null)
            {
                rootFObj = fobj;
                if (!fobj.GetName().Equals("fo:root"))
                {
                    throw new FonetException("Root element must" + " be root, not " + fobj.GetName());
                }
            }
            else if (!(fobj is PageSequence))
            {
                currentFObj.AddChild(fobj);
            }

            currentFObj = fobj;
        }