When I try to load mi sld style to a hillshade raster (tif format) it gives me the folllowing message:
line 21: cvc-complex-type.2.1:the element 'sld: normalize' must not have any characters or any [child] element information elements, because the type content type is empty.
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.0.0" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">
<UserLayer>
<sld:LayerFeatureConstraints>
<sld:FeatureTypeConstraint/>
</sld:LayerFeatureConstraints>
<sld:UserStyle>
<sld:Name>hill_22</sld:Name>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:Opacity>0.2</sld:Opacity>
<sld:ChannelSelection>
<sld:GrayChannel>
<sld:SourceChannelName>1</sld:SourceChannelName>
<sld:ContrastEnhancement>
<sld:Normalize>
<sld:VendorOption name="algorithm">StretchToMinimumMaximum</sld:VendorOption>
<sld:VendorOption name="minValue">1</sld:VendorOption>
<sld:VendorOption name="maxValue">181</sld:VendorOption>
</sld:Normalize>
</sld:ContrastEnhancement>
</sld:GrayChannel>
</sld:ChannelSelection>
<sld:ColorMap>
<sld:ColorMapEntry quantity="0" color="#000000"/>
<sld:ColorMapEntry quantity="255" color="#ffffff"/>
</sld:ColorMap>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</UserLayer>
</StyledLayerDescriptor>
This is caused because the GeoServer validator uses the OGC schema to validate the SLD, while specifying optional VendorOptions is not part of the standard. So as you know better than the computer you can ignore it and press apply and all will be fine.
If it really bothers you, you can submit a PR to update the schema used to accept this change.
Related
I have parameters stored in an XML file. Below is a sample of the file.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<terminal id="A">
<terminalCapacity>3</terminalCapacity>
<terminalMembers id="1">
<memberID>0001</memberID>
<memberCapacity>2</memberCapacity>
</terminalMembers>
</terminal>
<terminal id="B">
<terminalCapacity>4</terminalCapacity>
<terminalMembers id="1">
<memberID>0002</memberID>
<memberCapacity>1</memberCapacity>
</terminalMembers>
<terminalMembers id="2">
<memberID>0003</memberID>
<memberCapacity>3</memberCapacity>
</terminalMembers>
</terminal>
</root>
Each terminalID is associated to a type of simpleModule found in my NED file. The idea is to programmatically update these values throughout the simulation run. The current logic revolves around getting the current parameters in XML format and update the memberCapacity field.
From the Omnet cPar and cXMLElement documentation, I tried using the par("moduleParameter").xmlValue()->getXML() function, but this returns the XML as a string. I also tried using the getAttribute() function, but to no success.
Don't do this. par("moduleParameter").xmlValue() will give you the in memory object tree of the XML document, but that is not meant for modification. Your XML file seems to be just a hierarchical structure and modules and their parameters can mirror that exactly. There is absolutely no reason to reinvent the wheel when you can mirror that with INI file parameters.
I have a xml file that contains some tags, one is unique other are same tags. I'd like to get values from these tags and convert them to another xml tag. Here is example of xml file:
<?xml version="1.0" encoding="UTF-8"?>
<entry dataset="Swiss-Prot" created="2005-04-26" modified="2019-11-13" version="158" xmlns="http://uniprot.org/uniprot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<accession>Q96IY4</accession>
<accession>A8K464</accession>
<accession>Q15114</accession>
<accession>Q5T9K1</accession>
<accession>Q5T9K2</accession>
<accession>Q9P2Y6</accession>
<name>CBPB2_HUMAN</name>
<protein>
<recommendedName>
<fullName>Carboxypeptidase B2</fullName>
<ecNumber evidence="7">3.4.17.20</ecNumber>
</recommendedName>
<alternativeName>
<fullName>Carboxypeptidase U</fullName>
<shortName>CPU</shortName>
</alternativeName>
<alternativeName>
<fullName>Plasma carboxypeptidase B</fullName>
<shortName>pCPB</shortName>
</alternativeName>
<alternativeName>
<fullName>Thrombin-activable fibrinolysis inhibitor</fullName>
<shortName>TAFI</shortName>
</alternativeName>
</protein>...other tags
</entry>
I though of using EvaluateXQuery processor and EvaluateXPath. EvaluateXQuery is using for getting accession and alternativeName tags. EvaluateXPath is using for getting name, recommendedName (fullName) tags.
Is it possible to use both and combine them to only xml or hust necessary to use EvaluateXQuery processor, like this:
<accessions>Q96IY4, A8K464, Q15114,...</accessions>
<name>CBPB2_HUMAN</name>
<recommendedName>Carboxypeptidase B2</recommendedName>
<alternativeNames>Carboxypeptidase U-CPU, Plasma carboxypeptidase B-pCPB,...</alternativeNames>
Can you help me, please?
Thank you!
Hi you may use processor execute groovy script and parse xml with a script to get your values and put them into attributes.
I have two packages a and b having different rule files. Right now I am using two sessions to load the rules. Is there a way I can load rules from both the packages in a single session?
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules_a" packages="rules_a">
<ksession name="ksession1"/>
</kbase>
<kbase name="rules_b" packages="rules_b">
<ksession name="ksession2"/>
</kmodule>
Can I pass something like: packages = {"rules_a", "rules_b"} ??
As stated in this section of the documentation, you can pass a comma separated list of packages when building a KieBase.
Another possibility is to create a KieBase that includes others. That same section of the documentation shows how to do it.
Hope it helps,
There is a packages attribute of kiebase, below is an example of how to include the packages rules1, rules2 in kiebase.
<kbase name="rules_12" packages="rules1,rules2">
From drools documentation:
I went through various posts, regarding reading properties from external property files. Looks like there is a function - getProperty, which can read values from a property file, using a key. I am using saxon parser with spring integration. I am trying something like this, as described in the post :-
spring context file:
<int-xml:xslt-transformer id="xsltTransformer" input-channel="bulkStringInboundChannel"
output-channel="toBridgeChannel" result-type="StringResult" **transformer-factory-class="net.sf.saxon.TransformerFactoryImpl"**
xsl-resource="classpath:/META-INF/spring/integration/intake/intake-flow/bulkTransformer.xsl" />
XSL style sheet:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
....
<xsl:variable name="props" select="document('prop.xml')" />
<xsl:value-of select="f:getProperty('query1')"/>
....
Prop.xml:
query1 = /Batch/RequestID/text()
Error description:
XPST0003: XPath syntax error at char 23 on line 30 in {f:getProperty('query1')}:
XTSE0650: No template exists named getProperty
I now have two questions- first of all, how do I get rid of these errors?
Second, can I store xPath queries in property files? The post describes a method, to read a property file and use the value pertaining to its key. However, I am thinking that getProperty will just print the query's text equivalent instead of evaluating the query and processing it. Is there a way to achieve this?
Post - How to read a .properties file inside a .xsl file?
I can't help you with the Spring side of the question, but as for the Saxon side, you can call the JDK method System.getProperty() using code like this:
<xsl:value-of select="System:getProperty('user.dir')" xmlns:System="java:java.lang.System"/>
Java extensibility requires Saxon-PE or higher.
If the value of the property that you read is an XPath expression, you can then execute it using the XSLT 3.0 xsl:evaluate instruction - which also requires Saxon-PE or higher.
I would like to apply some java function on CQ5 dialogs. In the first step I search for dialog xml files in myComponent folder as follow:
NodeIterator tabRequiredFields = getQueryResult("/jcr:root/apps/myProject/pages/myComponent/dialog/jcr:root")
But this Query does not supply any results. crx Xpath tool does not show any result too see the follwoing picture:
my /jcr:root/apps/myProject/pages/myComponent/dialog.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
stateful="false"
title="Test"
.....>
<items
jcr:primaryType="cq:Widget"
xtype="panel">
...
......
</items>
.....
</jcr:root>
I can access items as follow
NodeIterator tabRequiredFields = getQueryResult("/jcr:root/apps/myProject/pages/myComponent/dialog/items")
This works fine. My Question is: why for jcr:root? how to check, if jcr:root exists?
XML element named jcr:root from the dialog.xml doesn't create jcr:root node in the repository. It's a special, reserved identifier and CRX Package Manager puts all properties and subnodes of this element into a node which name is the same as name of the file without extension (in your case it'll be dialog).
If it's not clear, use CRX DE, open /apps/myProject/pages/myComponent and see what you can find there. That's why you should add /dialog rather than /jcr:root to the end of your path.
If you want to find all dialogs, use the primary type cq:Dialog, as rakhi4110 suggests. Following query:
/jcr:root/apps/myProject/pages//element(*, cq:Dialog)
will return all dialogs from /apps/myProject/pages (and descendants).