Need help on Groovy script to changing all feature tags to features
<?XML version="1.0" encoding="UTF-8" standalone="yes"?>
<featureList>
<feature>
</feature>
<feature>
</feature>
<feature>
</feature>
<feature>`
</feature>
</featureList>
Related
I have below xml file which is coming form my vendor.
<?xml version="1.0" encoding="UTF-8"?>
<nm:MT_employee xmlns:nm="http://firstscenario.com"xmlns:tl="http://secondscenario.com">
<EMployeeDetails>
<Name>Janardhan</Name>
<id>1234</id>
<Address>India</Address>
</EMployeeDetails>
<tl:Extension>
<tl:Number>5678</tl:Number>
<tl:Salary>2345678</tl:Salary>
</tl:Extension>
</nm:MT_employee>
In the above xml I want to ignore the entire tl:Extension node. the final output should be like below
<?xml version="1.0" encoding="UTF-8"?>
<nm:MT_employee xmlns:nm="http://firstscenario.com"xmlns:tl="http://secondscenario.com">
<EMployeeDetails>
<Name>Janardhan</Name>
<id>1234</id>
<Address>India</Address>
</EMployeeDetails>
</nm:MT_employee>
I tried to with different XSLT codes but it's not working. Could you please suggest how can I achieve this?
Regards,
Janardhan
The general rule to "ignore" an element from the source XML
is to write an "empty" template for this element, in your case:
<xsl:template match="tl:Extension"/>
As this template refers to tl namespace, it must be specified
in the xsl:transform tag.
Of course, to copy the rest of the source content, your script
must include the identity template.
Below you have an example script:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tl="http://secondscenario.com" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="tl:Extension"/>
<xsl:template match="#*|node()">
<xsl:copy><xsl:apply-templates select="#*|node()"/></xsl:copy>
</xsl:template>
</xsl:transform>
Does any XSD edge case allow (unescaped) XML element content inside a text node? E.g. can you put a CDATA element inside a tag defined as xs:string and have it validate (without declaring mixed content)?
If you have an element that contains a string i.e.
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid Studio 2018 (https://www.liquid-technologies.com)-->
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root" type="xs:string" />
</xs:schema>
Then that can contain CDATA i.e.
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Studio 2018 (https://www.liquid-technologies.com) -->
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Temp\XSDFile2.xsd">
Optional Text
<![CDATA[
<someXmlData></someXmlData>
]]>
Optional Text
</Root>
As this passes though some parsers it may get escaped back to this, but both are valid and equivalent.
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Studio 2018 (https://www.liquid-technologies.com) -->
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XSDFile2.xsd">
Optional Text
<someXmlData></someXmlData>
Optional Text
</Root>
i have one wsdl file which have schhemas included in it, i want to generate java classes for each schema in different package,please help me.
i have used following code,its generating classes related to all schemas
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings version="1.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings schemaLocation="Event.xsd" node="/xsd:schema">
<jaxb:schemaBindings>
<jaxb:package name="com.event.dto" />
<jaxb:nameXmlTransform>
<jaxb:typeName suffix="CHASE"/>
</jaxb:nameXmlTransform>
For each shema file add xml like in your question, but with different name of
<jaxb:package name="com.event.dto" />
First off i am a big fat NOOB in regards to Sharepoint 2007 webpart development but i am working at it.
Now for the real problem, so i develop this webpart and follow the 'Loose' advise from various sites on how to setup the features.xml, .xml, manifest.xml, solution.ddf and solution.build files. Basically, i have a all-in-one solution where i build the webpart and then in post-build event compile all the source files into the WSP deployment package.
Problem i am having is that I can add the solution to the sharepoint site but when i go to Deploy it through CA-Operations-Solution management i get this great error:
Error as reported from Sharepoint
Failed to instantiate file "ChartPartWP.webpart" from module "ChartPartWP": Source path "ChartPartWP\ChartPartWP.webpart" not found.
When i looked at the file-system the folder ChartPart is present in TEMPLATE\FEATURES with the ChartPartWP.webpart and other support files.
What is not happening that i need to resolve.
Edit: 10/24/2011 # 11:36PM
Solution.ddf
.OPTION EXPLICIT
.Set CabinetNameTemplate=ChartPartWP.wsp
.Set DiskDirectoryTemplate=CDROM
.Set DiskDirectory1=Package
.Set CompressionType=MSZIP
.Set UniqueFiles="ON"
.Set Cabinet=On
.Set SourceDir="\\<fileserver>\common share\Software_Development\MPT\Sharepoint2007\ChartPart\"
Manifest.xml manifest.xml
; binary
bin\release\TCBOE.ChartPart.dll TCBOE.ChartPart.dll
; feature files
TEMPLATE\FEATURES\ChartPartWP\ChartPartWP.xml ChartPartWP\ChartPartWP.xml
TEMPLATE\FEATURES\ChartPartWP\feature.xml ChartPartWP\Feature.xml
; web part files
TEMPLATE\FEATURES\ChartPartWP\ChartPartWP.webpart ChartPartWP\ChartPartWP.webpart
TEMPLATE\FEATURES\ChartPartWP\LockedChartPartWP.webpart ChartPartWP\LockedChartPartWP.webpart
manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
SolutionId="{0C32EA7F-78C2-4814-A4C9-88256E49E371}">
<FeatureManifests>
<FeatureManifest Location="ChartPartWP\feature.xml" />
</FeatureManifests>
<Assemblies>
<Assembly Location="TCBOE.ChartPart.dll"
DeploymentTarget="GlobalAssemblyCache" />
</Assemblies>
</Solution>
ChartPartWP.xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="ChartPartWP"
List="113" Url="_catalogs/wp"
Path="ChartPartWP"
RootWebOnly="True">
<File Url="ChartPartWP.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="ChartParts" />
</File>
<File Url="LockedChartPartWP.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="ChartParts" />
</File>
</Module>
</Elements>
feature.xml
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="47D62F5E-B0E0-4f93-BCD1-081CA794527C" Version="3.5.1.0"
Title="TCBOE ChartPart"
Description="Provides a Chart Web object to be used in Sharepoint 2007."
AutoActivateInCentralAdmin="TRUE"
Scope="Site">
<ElementManifests>
<ElementManifest Location="ChartPartWP.xml" />
<ElementFile Location="ChartPartWP.webpart" />
<ElementFile Location="LockedChartPartWP.webpart"/>
</ElementManifests>
</Feature>
Would there be any receivers/handlers i need make are implemented for the installation to take hold? I didnt read anything about it but read something about a FeatureReceiver for a purpose, but cant remember for the life-of-it, why you need the FeatureReceiver (SPFeatureReceiver)
SPFeatureDefinition.AutoActivateInCentralAdmin Property
Gets a value that specifies whether the Feature is activated on the central administrative Web site, site collection, or Web application upon installation.
Without testing your entire samples, using this property sounds off to me. Try removing that.
update: you should post your .webpart also (it is a xml).
Try these configs: Feature.xml
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Id="47D62F5E-B0E0-4f93-BCD1-081CA794527C" Version="3.5.1.0" Title="TCBOE ChartPart" Description="Provides a Chart Web object to be used in Sharepoint 2007." Scope="Site">
<ElementManifests>
<ElementManifest Location="ChartPartWP\ChartPartWP.xml" />
<ElementFile Location="ChartPartWP\ChartPartWP.webpart" />
<ElementFile Location="ChartPartWP\LockedChartPartWP.webpart"/>
</ElementManifests>
</Feature>
webpart.xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="ChartPartWP" List="113" Url="_catalogs/wp">
<File Path="ChartPartWP.webpart" Url="ChartPartWP.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="ChartParts" />
</File>
<File Path="ChartPartWP.webpart" Url="LockedChartPartWP.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="ChartParts" />
</File>
</Module>
</Elements>
If nothing works, I would recommend installing and using the VSeWSS 1.3 from Microsoft, create a new webpart, hit F5, test it. If you can see it in the "Add Web Parts" dialog, move your files over. This is the closest you will get to the SharePoint 2010 experience (which is terribly improved).
Having to fiddle with these files, even more to a beginner, should not be your burden.
The 1.0.0.0 version of my Feature's Template.xml file looked like this:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
<Properties>
<Property Key="AvailableWebTemplates" Value="MPS#0;MPS#1;MPS#2;MPS#3;MPS#4" />
</Properties>
</Feature>
The new version 1.1.0.0 is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
<UpgradeActions>
<VersionRange BeginVersion="1.0.0.0" EndVersion="1.1.0.0">
<CustomUpgradeAction Name="UpgradeTo1v1"/>
</VersionRange>
</UpgradeActions>
<Properties>
<Property Key="AvailableWebTemplates" Value="MPS#0;MPS#1;MPS#2;MPS#3;MPS#4;STS#2" />
</Properties>
</Feature>
The value of templates is still MPS#0;MPS#1;MPS#2;MPS#3;MPS#4, when the following code runs in FeatureUpgrading:
SPFeatureProperty property = properties.Feature.Properties["AvailableWebTemplates"];
string templates = property.Value;
Why am I not getting the updated property value? Is this the way it is supposed to be?
This is indeed the way it is supposed to be:
A feature has 1 definition and n instances. The code in FeatureUpgrading is used to upgrade the instances.
The property in your xml updates the feature definition and not the running instances.
properties.Feature.Properties["MyProp"] gets the property value of the running instance properties.Definition.Properties["MyProp"] gets the value of the property in the feature definition.