コード例 #1
0
ファイル: NewsMLG2v217-PBL.cs プロジェクト: nitmws/NewsMLG2
        } // ParsePblPath

        // ******************************************************************************
        /// <summary>
        /// Checks if the node addressed by the PBL-Path exists in a NewsML-G2 Package Item
        /// </summary>
        /// <param name="pkgItem">The Package Item</param>
        /// <param name="pblPath">The PBL-Path</param>
        /// <returns>True if the node exists</returns>
        public static bool PblNodeExists(PackageItemPwrXml pkgItem, string pblPath)
        {
            if (string.IsNullOrEmpty(pblPath))
            {
                return(false);
            }
            var pblPathParsed = ParsePblPath(pblPath);

            if ((pblPathParsed.EndNodeType == PblNodeType.ParseError) ||
                (pblPathParsed.EndNodeType == PblNodeType.Undefined))
            {
                return(false);
            }
            // first check for the groups by their roles
            var groupFound    = true;
            var lastGroupRole = string.Empty;

            foreach (var groupRole in pblPathParsed.GroupRoles)
            {
                lastGroupRole = groupRole;
                if (!pkgItem.ExistsRelXN("/nar:groupSet/nar:group[@role='" + groupRole + "']"))
                {
                    groupFound = false;
                }
                if (!groupFound)
                {
                    break;
                }
            }
            if (!groupFound)
            {
                return(false);
            }

            // second: check for itemRef and contentRef - if included into the PBL-Path
            string[] refIdParts = { "" };
            if (!string.IsNullOrEmpty(pblPathParsed.RefId))
            {
                refIdParts = pblPathParsed.RefId.Split('='); // part[0] = attribute name, [1] = value
            }
            if (pblPathParsed.EndNodeType == PblNodeType.ItemRef)
            {
                if (!pkgItem.ExistsRelXN("/nar:groupSet/nar:group[@role='" + lastGroupRole
                                         + "']/nar:itemRef[@" + refIdParts[0] + "='" + refIdParts[0] + "']"))
                {
                    return(false);
                }
            }
            if (pblPathParsed.EndNodeType == PblNodeType.ContentRef)
            {
                if (!pkgItem.ExistsRelXN("/nar:groupSet/nar:group[@role='" + lastGroupRole
                                         + "']/nar:conceptRef[@" + refIdParts[0] + "='" + refIdParts[0] + "']"))
                {
                    return(false);
                }
            }

            return(true);
        } // PblNodeExists
コード例 #2
0
        // ******************************************************************************
        /// <summary>
        /// Adds this instance of GroupStructProp as group element and its children 
        /// to a NewsML-G2 Package Item. The location in the group structure is
        /// defined by the PblPath property if this instance.
        /// </summary>
        /// <param name="pkgItem">The Package Item to which the group should be added</param>
        /// <returns>A PropProcStatus</returns>
        public virtual PropProcStatus AddGroupToPackage(PackageItemPwrXml pkgItem)
        {
            if (string.IsNullOrEmpty(PblPath))
                return PropProcStatus.ErrPkgNoPblPath;
            if (string.IsNullOrEmpty(CoreGroup.role))
                return PropProcStatus.ErrPkgNoGroupRole;

            var pblPathParsed = PblTools.ParsePblPath(PblPath);
            if ((pblPathParsed.EndNodeType == PblNodeType.ParseError)
                || (pblPathParsed.EndNodeType == PblNodeType.Undefined))
                return PropProcStatus.ErrPkgNoPblPath;

            string pblPath4Testing = string.Empty;
            // check if the hierarchical parent group(s) exist, skipped for the root group
            for (var idx = 0; idx < pblPathParsed.GroupRoles.Count - 1; idx++)
            {
                pblPath4Testing += "/" + pblPathParsed.GroupRoles[idx];
                if (!PblTools.PblNodeExists(pkgItem, pblPath4Testing))
                    return PropProcStatus.ErrPkgNoPblParentNode;
            }

            pkgItem.AddGroupSet(); // try to add it, skips action if it already exists

            if (string.IsNullOrEmpty(CoreGroup.id)) // take care that the group@id is not empty.
                CoreGroup.id = pkgItem.NewIdSequence.ToString();
            // adds the new group element
            pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet", "", CoreGroup);

            ReadFromItemResultEnum readResult;

            if (pblPathParsed.GroupRoles.Count == 1) // this is the root group!
            {
                // apply the id of the root group to the root attribute of groupSet
                XmlElement groupSetXe = null;
                pkgItem.GetElemAsXE("/nar:packageItem/nar:groupSet", out groupSetXe, out readResult);
                if (readResult == ReadFromItemResultEnum.ok)
                {
                    groupSetXe.SetAttribute("root", CoreGroup.id);
                }
                return PropProcStatus.ok; // exits here
            }

            // for groups below the root in the hierarchy: add a groupRef element to the parent group
            var parentRole = pblPathParsed.GroupRoles[pblPathParsed.GroupRoles.Count - 2];
            var newGroupRef = new GroupRef();
            newGroupRef.idref = CoreGroup.id;
            pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@role='" + parentRole + "']", "",
                newGroupRef);

            // add all the child elements of the new group
            foreach (var itemRef in ItemRefs)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                itemRef);
            }
            foreach (var conceptRef in ConceptRefs)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                conceptRef);
            }
            foreach (var title in Titles)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                title);
            }
            foreach (var signal in Signals)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                signal);
            }
            foreach (var edNote in EdNotes)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                edNote);
            }
            foreach (var groupExtProperty in GroupExtProperties)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                groupExtProperty);
            }

            return PropProcStatus.ok;
        }
コード例 #3
0
        // ******************************************************************************
        /// <summary>
        /// Checks if the node addressed by the PBL-Path exists in a NewsML-G2 Package Item
        /// </summary>
        /// <param name="pkgItem">The Package Item</param>
        /// <param name="pblPath">The PBL-Path</param>
        /// <returns>True if the node exists</returns>
        public static bool PblNodeExists(PackageItemPwrXml pkgItem, string pblPath)
        {
            if (string.IsNullOrEmpty(pblPath))
                return false;
            var pblPathParsed = ParsePblPath(pblPath);
            if ((pblPathParsed.EndNodeType == PblNodeType.ParseError)
                || (pblPathParsed.EndNodeType == PblNodeType.Undefined))
                return false;
            // first check for the groups by their roles
            var groupFound = true;
            var lastGroupRole = string.Empty;
            foreach (var groupRole in pblPathParsed.GroupRoles)
            {
                lastGroupRole = groupRole;
                if (!pkgItem.ExistsRelXN("/nar:groupSet/nar:group[@role='" + groupRole + "']"))
                    groupFound = false;
                if (!groupFound)
                    break;
            }
            if (!groupFound)
                return false;

            // second: check for itemRef and contentRef - if included into the PBL-Path
            string[] refIdParts = {""};
            if (!string.IsNullOrEmpty(pblPathParsed.RefId))
                refIdParts = pblPathParsed.RefId.Split('='); // part[0] = attribute name, [1] = value
            if (pblPathParsed.EndNodeType == PblNodeType.ItemRef)
            {
                if (!pkgItem.ExistsRelXN("/nar:groupSet/nar:group[@role='" + lastGroupRole
                    + "']/nar:itemRef[@" + refIdParts[0] + "='" + refIdParts[0] + "']"))
                    return false;
            }
            if (pblPathParsed.EndNodeType == PblNodeType.ContentRef)
            {
                if (!pkgItem.ExistsRelXN("/nar:groupSet/nar:group[@role='" + lastGroupRole
                    + "']/nar:conceptRef[@" + refIdParts[0] + "='" + refIdParts[0] + "']"))
                    return false;
            }

            return true;
        }
コード例 #4
0
        // ******************************************************************************
        /// <summary>
        /// Adds this instance of GroupStructProp as group element and its children
        /// to a NewsML-G2 Package Item. The location in the group structure is
        /// defined by the PblPath property if this instance.
        /// </summary>
        /// <param name="pkgItem">The Package Item to which the group should be added</param>
        /// <returns>A PropProcStatus</returns>
        public virtual PropProcStatus AddGroupToPackage(PackageItemPwrXml pkgItem)
        {
            if (string.IsNullOrEmpty(PblPath))
            {
                return(PropProcStatus.ErrPkgNoPblPath);
            }
            if (string.IsNullOrEmpty(CoreGroup.role))
            {
                return(PropProcStatus.ErrPkgNoGroupRole);
            }

            var pblPathParsed = PblTools.ParsePblPath(PblPath);

            if ((pblPathParsed.EndNodeType == PblNodeType.ParseError) ||
                (pblPathParsed.EndNodeType == PblNodeType.Undefined))
            {
                return(PropProcStatus.ErrPkgNoPblPath);
            }

            string pblPath4Testing = string.Empty;

            // check if the hierarchical parent group(s) exist, skipped for the root group
            for (var idx = 0; idx < pblPathParsed.GroupRoles.Count - 1; idx++)
            {
                pblPath4Testing += "/" + pblPathParsed.GroupRoles[idx];
                if (!PblTools.PblNodeExists(pkgItem, pblPath4Testing))
                {
                    return(PropProcStatus.ErrPkgNoPblParentNode);
                }
            }

            pkgItem.AddGroupSet();                  // try to add it, skips action if it already exists

            if (string.IsNullOrEmpty(CoreGroup.id)) // take care that the group@id is not empty.
            {
                CoreGroup.id = pkgItem.NewIdSequence.ToString();
            }
            // adds the new group element
            pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet", "", CoreGroup);

            ReadFromItemResultEnum readResult;

            if (pblPathParsed.GroupRoles.Count == 1) // this is the root group!
            {
                // apply the id of the root group to the root attribute of groupSet
                XmlElement groupSetXe = null;
                pkgItem.GetElemAsXE("/nar:packageItem/nar:groupSet", out groupSetXe, out readResult);
                if (readResult == ReadFromItemResultEnum.ok)
                {
                    groupSetXe.SetAttribute("root", CoreGroup.id);
                }
                return(PropProcStatus.ok); // exits here
            }

            // for groups below the root in the hierarchy: add a groupRef element to the parent group
            var parentRole  = pblPathParsed.GroupRoles[pblPathParsed.GroupRoles.Count - 2];
            var newGroupRef = new GroupRef();

            newGroupRef.idref = CoreGroup.id;
            pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@role='" + parentRole + "']", "",
                                           newGroupRef);

            // add all the child elements of the new group
            foreach (var itemRef in ItemRefs)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                                               itemRef);
            }
            foreach (var conceptRef in ConceptRefs)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                                               conceptRef);
            }
            foreach (var title in Titles)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                                               title);
            }
            foreach (var signal in Signals)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                                               signal);
            }
            foreach (var edNote in EdNotes)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                                               edNote);
            }
            foreach (var groupExtProperty in GroupExtProperties)
            {
                pkgItem.AddNarPropertyToParent("/nar:packageItem/nar:groupSet/nar:group[@id='" + CoreGroup.id + "']", "",
                                               groupExtProperty);
            }

            return(PropProcStatus.ok);
        } // AddGroupToPackage
コード例 #5
0
ファイル: Form1.cs プロジェクト: mscullion/NewsMLG2
        /// <summary>
        /// This examples creates a NewsML-G2 News Item as shown in the QuickStart NewsML-G2 Package 
        /// document in this package http://www.iptc.org/std/NewsML-G2/2.15/documentation/IPTC-NewsML-G2-QuickStartGuides_2014.zip
        /// </summary>
        private void GenerateQuickStartPackageExample1()
        {
            // variables global only to this method
            XmlNode foundNode = null;

            // *** create an object for the NewsML-G2 News Item
            var g2PkgI = new PackageItemPwrXml();
            // * add the GUID and the version number to it
            g2PkgI.InitEmptyXMLDoc("tag:example.com,2008:UK-NEWS-TOPTEN:UK20081220098658", 18);
            g2PkgI.SetRootXmlLang("en-US");

            // * add the catalogRefs to it
            g2PkgI.AddCatalogRef("http://www.iptc.org/std/catalog/catalog.IPTC-G2-Standards_22.xml");
            g2PkgI.AddCatalogRef("http:/www.example.com/customer/cv/catalog4customers-1.xml");

            // ** add an itemMeta element as wrapper of properties
            g2PkgI.CheckAddNarWrapper1(NarDocXml.PropsWrapping1.ItemMeta);

            // ** add a sequence of properties as children of itemMeta
            // * property using the qcode attribute
            var itemClass = new ItemClass { qcode = "ninat:composite" };
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, itemClass);
            // * property using the uri attribute
            var provider = new Provider { qcode = "nprov:REUTERS" };
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, provider);
            var versionCreated = new VersionCreated("2012-11-07T12:30:00Z");
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, versionCreated);
            var firstCreated = new FirstCreated("2008-12-20T12:25:35Z");
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, firstCreated);
            var pubStatus = new PubStatus { qcode = "stat:usable" };
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, pubStatus);
            var profile = new Profile();
            profile.versioninfo = "1.0.0.2";
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, profile);
            var service = new Service();
            XmlElement serviceXe = null;
            service.qcode = "svc:uktop";
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, service, out serviceXe);
            var svcName = new ConceptStructProp();
            svcName.Names.Add(new Name("Top UK News stories hourly"));
            svcName.ApplyToElement(g2PkgI, serviceXe);
            var title = new Title("UK-TOPNEWS");
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, title);
            var edNote = new EdNote("Updates the previous version");
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, edNote);
            var signal2 = new Signal();
            signal2.qcode = "sig:update";
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ItemMeta, signal2);

            // ** add a contentMeta element as wrapper of properties
            g2PkgI.CheckAddNarWrapper1(NarDocXml.PropsWrapping1.ContentMeta);

            // ** add a sequence of properties as children of itemMeta
            var contentCreated = new ContentCreated("2013-11-21T15:21:06-05:00");
            var contributor = new Contributor();
            XmlElement contributorXe = null;
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ContentMeta, contributor, out contributorXe);
            var contribSp = new ConceptStructProp();
            var name1 = new Name("Maurice Dancer");
            contribSp.Names.Add(name1);
            var name2 = new Name("Chief Packaging Editor");
            contribSp.Names.Add(name2);
            var definition = new Definition("Duty Packaging Editor");
            definition.validto = "2008-12-20T17:30:00Z";
            contribSp.Definitions.Add(definition);
            var note = new Note("Available on +44 207 345 4567 until 17:30 GMT today");
            note.validto = "2008-12-20T17:30:00Z";
            contribSp.Notes.Add(note);
            contribSp.ApplyToElement(g2PkgI, contributorXe);
            var headline = new Headline("UK");
            headline.xmllang = "en";
            g2PkgI.AddNarPropertyToWrapper1(NarDocXml.PropsWrapping1.ContentMeta, headline);

            var irCtr = 1;
            // The package
            PropProcStatus procStatus;
            var newGroup = new GroupStructProp();
            newGroup.CoreGroup.role = "group:main";
            newGroup.CoreGroup.id = "G" + g2PkgI.NewIdSequence.ToString();
            newGroup.CoreGroup.mode = "pgrmode:seq";
            newGroup.PblPath = "/group:main";
            newGroup.AddGroupToPackage(g2PkgI);

            // Group 2
            newGroup = new GroupStructProp();
            newGroup.CoreGroup.role = "group:top";
            newGroup.CoreGroup.id = "G" + g2PkgI.NewIdSequence.ToString();
            newGroup.PblPath = "/group:main/group:top";
            var itemRef1 = new ItemRef();
            itemRef1.id = "IR0" + irCtr++.ToString();
            itemRef1.residref = "urn:newsml:iptc.org:20081007:tutorial-item-A";
            itemRef1.contenttype = "application/vnd.iptc.g2.newsitem+xml";
            itemRef1.size = "3452";
            newGroup.ItemRefs.Add(itemRef1);
            var itemRef2 = new ItemRef();
            itemRef2.id = "IR0" + irCtr++.ToString();
            itemRef2.residref = "urn:newsml:iptc.org:20081007:tutorial—item-B";
            itemRef2.contenttype = "application/vnd.iptc.g2.newsitem+xml";
            itemRef2.size = "230003";
            newGroup.ItemRefs.Add(itemRef2);
            newGroup.AddGroupToPackage(g2PkgI);
            // add children of itemRef 1
            var parentPath = "/nar:packageItem/nar:groupSet/nar:group[@id='"
                             + newGroup.CoreGroup.id + "']/nar:itemRef[@id='" + itemRef1.id + "']";
            itemClass = new ItemClass { qcode = "ninat:text" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", itemClass);
            provider = new Provider { qcode = "nprov:REUTERS" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", provider);
            pubStatus = new PubStatus { qcode = "stat:usable" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", pubStatus);
            title = new Title("Bank cuts interest rates to record low");
            g2PkgI.AddNarPropertyToParent(parentPath, "", title);
            var description = new Description("London (Reuters) - The Bank of England cut interest rates by half a percentage point on Thursday to a record low of  ....") { role = "drol:summary" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", description);
            // add children of itemRef 2
            parentPath = "/nar:packageItem/nar:groupSet/nar:group[@id='"
                 + newGroup.CoreGroup.id + "']/nar:itemRef[@id='" + itemRef2.id + "']";
            itemClass = new ItemClass { qcode = "ninat:picture" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", itemClass);
            provider = new Provider { qcode = "nprov:REUTERS" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", provider);
            pubStatus = new PubStatus { qcode = "stat:usable" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", pubStatus);
            title = new Title("BoE Rate Decision");
            g2PkgI.AddNarPropertyToParent(parentPath, "", title);

            // Group 3
            newGroup = new GroupStructProp();
            newGroup.CoreGroup.role = "group:two";
            newGroup.CoreGroup.id = "G" + g2PkgI.NewIdSequence.ToString();
            newGroup.PblPath = "/group:main/group:two";
            itemRef1 = new ItemRef();
            itemRef1.id = "IR0" + irCtr++.ToString();
            itemRef1.residref = "urn:newsml:iptc.org:20081007:tutorial-item-C";
            itemRef1.contenttype = "application/vnd.iptc.g2.newsitem+xml";
            itemRef1.size = "2345";
            newGroup.ItemRefs.Add(itemRef1);
            itemRef2 = new ItemRef();
            itemRef2.id = "IR0" + irCtr++.ToString();
            itemRef2.residref = "urn:newsml:iptc.org:20081007:tutorial—item-D";
            itemRef2.contenttype = "application/vnd.iptc.g2.newsitem+xml";
            itemRef2.size = "24065";
            newGroup.ItemRefs.Add(itemRef2);
            newGroup.AddGroupToPackage(g2PkgI);
            // add children of itemRef 1
            parentPath = "/nar:packageItem/nar:groupSet/nar:group[@id='"
                             + newGroup.CoreGroup.id + "']/nar:itemRef[@id='" + itemRef1.id + "']";
            itemClass = new ItemClass { qcode = "ninat:text" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", itemClass);
            provider = new Provider { qcode = "nprov:REUTERS" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", provider);
            pubStatus = new PubStatus { qcode = "stat:usable" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", pubStatus);
            title = new Title("Government denies it will print more cash");
            g2PkgI.AddNarPropertyToParent(parentPath, "", title);
            description = new Description("London (Reuters) – Chancellor Alistair Darling dismissed reports on Thursday that the government was about ...") { role = "drol:summary" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", description);
            // add children of itemRef 2
            parentPath = "/nar:packageItem/nar:groupSet/nar:group[@id='"
                 + newGroup.CoreGroup.id + "']/nar:itemRef[@id='" + itemRef2.id + "']";
            itemClass = new ItemClass { qcode = "ninat:picture" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", itemClass);
            provider = new Provider { qcode = "nprov:REUTERS" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", provider);
            pubStatus = new PubStatus { qcode = "stat:usable" };
            g2PkgI.AddNarPropertyToParent(parentPath, "", pubStatus);
            title = new Title("Sterling notes and coin");
            g2PkgI.AddNarPropertyToParent(parentPath, "", title);

            // Group 4, compressed C#
            newGroup = new GroupStructProp { CoreGroup = { role = "group:three", id = "G" + g2PkgI.NewIdSequence.ToString() } };
            newGroup.PblPath = "/group:main/group:three";
            itemRef1 = new ItemRef
            {
                id = "IR0" + irCtr++.ToString(),
                residref = "urn:newsml:iptc.org:20081007:tutorial-item-E",
                contenttype = "application/vnd.iptc.g2.newsitem+xml",
                size = "2345"
            };
            newGroup.ItemRefs.Add(itemRef1);
            itemRef2 = new ItemRef
            {
                id = "IR0" + irCtr++.ToString(),
                residref = "urn:newsml:iptc.org:20081007:tutorial—item-F",
                contenttype = "application/vnd.iptc.g2.newsitem+xml",
                size = "25346"
            };
            newGroup.ItemRefs.Add(itemRef2);
            newGroup.AddGroupToPackage(g2PkgI);
            // add children of itemRef 1
            parentPath = "/nar:packageItem/nar:groupSet/nar:group[@id='"
                             + newGroup.CoreGroup.id + "']/nar:itemRef[@id='" + itemRef1.id + "']";
            g2PkgI.AddNarPropertyToParent(parentPath, "", new ItemClass { qcode = "ninat:text" });
            g2PkgI.AddNarPropertyToParent(parentPath, "", new Provider { qcode = "nprov:REUTERS" });
            g2PkgI.AddNarPropertyToParent(parentPath, "", new PubStatus { qcode = "stat:usable" });
            g2PkgI.AddNarPropertyToParent(parentPath, "", new Title("Rugby's Mike Tindall banned for drink-driving"));
            g2PkgI.AddNarPropertyToParent(parentPath, "",
                new Description("London (Reuters) - England rugby player Mike Tindall was banned from driving for three years and fined £500 on Thursday ...") { role = "drol:summary" });
            // add children of itemRef 2
            parentPath = "/nar:packageItem/nar:groupSet/nar:group[@id='"
                 + newGroup.CoreGroup.id + "']/nar:itemRef[@id='" + itemRef2.id + "']";
            g2PkgI.AddNarPropertyToParent(parentPath, "", new ItemClass { qcode = "ninat:picture" });
            g2PkgI.AddNarPropertyToParent(parentPath, "", new Provider { qcode = "nprov:REUTERS" });
            g2PkgI.AddNarPropertyToParent(parentPath, "", new PubStatus { qcode = "stat:usable" });
            g2PkgI.AddNarPropertyToParent(parentPath, "", new Title("Mike Tindall in rugby action for England"));

            g2PkgI.SaveToFile("QS-Package_1.0-ExampleSequStruct1-generated.xml", true);
            qsPkgEx1Lbl.Text = "Example Package Item created.";
        }