I'm trying to create an XML schema for a document that looks something like the example below.
Is this the right way to define and reference entities within an XML document?
How do I specify in my schema that the <palette> contains references to existing <color> entities, not definitions of new ones?
<!-- define some colors -->
<color name="red">#ff0000</color>
<color name="green">#00ff00</color>
<color name="blue">#0000ff</color>
<!-- define different groups of the colors defined above -->
<palette name="rg">
<color>red</color>
<color>green</color>
</palette>
<palette name="gb">
<color>green</color>
<color>blue</color>
</palette>
Thanks!
Define a key on the (standalone) color elements (where the name attribute defines the key) and then a key reference for the color child elements of the palette elements, see http://www.w3.org/TR/xmlschema-0/#specifyingKeysAndtheirRefs for details.
Related
I have declared my own custom theme xml and named it style
<style name="LightTheme.PSIProjectAPP" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
Then i tried to change the manifes theme, setTheme() and filled the paramater with android.R.style, but can't find my custom style.
How do i do it? or there is a way to do it properly?
If you want, you can apply the defined style to the activity or view that you want stylized like this:
in the manifest file:
<activity android:theme="#style/Theme.MyGreenTheme"/>
I'd like to create XML file from Excel sheet. But in my XML file there is multiple placement of same element, but always with different atributes (like element variable and atribute is that variable name).
<?xml version="1.0" encoding="utf-8"?>
<Configuration typical="Configurator1">
<TypicalInstance name="Typical1">
<Instance>
<ConfigurationVariables>
<ConfigurationVariable name="typical1Variable1">T1Value1</ConfigurationVariable>
<ConfigurationVariable name="typical1Variable2">T1Value2</ConfigurationVariable>
</ConfigurationVariables>
</Instance>
<Instance>
<ConfigurationVariables>
<ConfigurationVariable name="typical1Variable1">T1Value11</ConfigurationVariable>
<ConfigurationVariable name="typical1Variable2">T1Value12</ConfigurationVariable>
</ConfigurationVariables>
</Instance>
</TypicalInstance>
</Configuration>
So I have two properties named typical1Variable1 and 2. So I need two separated columns for filling data in. Each row should be done like another Instance element.
Is this even possible with native XML mapping?
Thanks for answers.
I made a vector graphic in Inkscape, including layers and sub-layers for further use in Processing. I named all the layers in the UI, and realized that the final SVG only creates an inkscape:label attribute with that name, but id remains generic:
<svg:g id="layer1" inkscape:label="My custom label">
I know I can manually edit the labels in the XML editor, but is there a setting somewhere to automatically use the layer name as id?
I recently came across this question, as I was looking for the same topic. As it turned out, Inkscape (v0.92) has functions for that purpose now.
You can set IDs, and Labels in the Inkscape GUI in Object Properties menu, and they will be applied to the XML code then.
Example
Inkscape GUI
Draw a yellow rectangle and select it
Click on Object -> Object Properties...
In the menu set ID to yellow_rect and Label to #yellow_rect
Apply changes by a click on Set
To complete this example, repeat the steps above to create red_rect, set Label and ID
Eventually, group both rectanbles and set identifiers for the group as well.
XML Code
When I open the SVG file, Inkscape put my identifiers to the appropriate XML tags.
<g
id="rect_group">
<rect
rx="0.11797347"
y="250.69791"
x="5.0270834"
height="18.785416"
width="30.427082"
id="yellow_rect1"
style="fill:#f4ff00;fill-opacity:1;stroke:#000000;stroke-width:0.52916667;stroke-linejoin:round;stroke-miterlimit:3.79999995;stroke-dasharray:none;stroke-opacity:1" />
<rect
rx="0.11797347"
y="258.89999"
x="24.606249"
height="16.933332"
width="33.602081"
id="red_rect1"
style="fill:#f40000;fill-opacity:1;stroke:#000000;stroke-width:0.52916664;stroke-linejoin:round;stroke-miterlimit:3.79999995;stroke-dasharray:none;stroke-opacity:1" />
</g>
I have the same requirement when I am creating a svg for Fritzing, because fritzing doesn't refer to the inkscape:label. In such circumstance, I can make sure that label holds the legit value for id. So I make a script to do saving myself out of the dirty and heavy job.
Please note that the script ONLY READ 'Plain SVG' format.
https://gist.github.com/TerrenceSun/972ef4eea97f331af1e6abfcafb7c6e5
I don't know about a setting to automatically use the layer name as id. But why not do it the other way round: if you remove the inkscape:label attribute, then the layer name automatically becomes the id of the svg:g in the inkscape UI.
The attribute inkscape:groupmode=layer is enough to make the svg:g a layer element.
i am new to KML and this should be simple but i can't figure it out.
In my KML i have several styles defined and can assign them easily to a specific placemark with the styleUrl-tag. My styles differ only in the background-color from each other but they also contain a rather complicated "BalloonStyle" which is the same for ALL of them.
Now i don't want to copy this same ballonstyle into every style i have and increase the size of my KML.
What i need is to assign to a placemark two styles like i would do in CSS:
<styleUrl>#greenArea #myBalloonStyle</styleUrl>
<styleUrl>#redArea #myBalloonStyle</styleUrl>
Or write into my style something that it "inherits" its balloon-style from a second style.
Thank you in advance
A KML feature can only contain a single styleUrl with a single style reference but the feature can also contain an inline Style element. This technique is called a "merged" style.
In the case where a feature has both a shared style and inline style, the shared style is applied first then the inline style overrides whatever is already specified in the former.
If you use the BallonStyle as a shared style then you can override specific elements such as color in the inline style.
<Placemark>
<styleUrl>#myBalloonStyle</styleUrl>
<Style>
<LabelStyle>
<color>ff0000cc</color>
</LabelStyle>
</Style>
</Placemark>
Here's a complete example with a global BalloonStyle. Click "Raw", save contents to a local file, then open in Google Earth.
I have a document created by Excel 2007:
<fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4506" codeName="{B7FE6334-C1A2-E50D-BD3D-5F4D41BBC2E3}"/>
... which contains the following color in a font definition in xl/styles.xml:
<color indexed="81"/>
I understand from the ECMA standard that this colour index refers to the <indexedColors> collection in xl/styles.xml if there is such a collection, otherwise it refers to the default palette shown in the standard. My problem is that this document contains no <indexedColors> element, and the default palette only has 66 entries, so I do not know what 81 refers to. Does anybody else?
Interestingly a google search for color indexed="81" returns some sample OpenXML snippets containing the same thing, but alas no explanation.
MSDN Documentation specifies the indexed property of class Color in OpenXML as:
Indexed color value. Only used for backwards compatibility. References a color in indexedColors.
The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.
It is part of the larger DocumentFormat.OpenXml.Spreadsheet namespace.
The file you're describing was built via source code which contained the 81 value. It probably looked something like this Java code, defining a Color() instance with 81U from an unrelated color index.
If you're needing to find out why, I'd create an account at MSDN and reply to Jack9999's post with an inquiry as to why he used that value. I'm guessing it's a bug on his part, being familiar with a separate and possibly JAVA-related color index.
Excel--not recognizing it--is just using their default comment color values.
Cheers
Index 0x51 is the system tooltip text color. (i.e. ::GetSysColor(COLOR_INFOTEXT) ).
NECRO answer:
From Vincent Tan's SpreadsheetOpenXmlFromScratch:
For colours, if you're dealing with the DocumentFormat.OpenXml.Color class,
there are 3 ways of setting the colour value:
Indexed colour
RGB colour
Themed colour
There's a property called Auto of the Color class. I didn't find a use for it, and you can probably ignore it. Excel won't choke on errors if you don't set it in any caseā¦
Indexed colours are for backwards compatibility, so I'm not going to teach you how. Basically it's an index value to the palette of colours stored within the spreadsheet's stylesheet. We'll deal with the Stylesheet class in the next chapter. You can explore the IndexedColors class on your own, which is a child class of the Colors class, which is in turn a child class of Stylesheet.