|
Thanks very much, i appreciated your effort.
cheers
Andie
|
|
|
|
|
I've been writing VST[^] plugins for the past year and a half or so.
Every VST plugin has a set of parameter values each having the range of [0, 1]. To be more specific, these parameter values are what the host in which the plugin is running understands. It's up to each plugin to transform these normalized parameter values into values it can use. For example, a plugin may have an amplitude parameter and want to transform it to a range of [0, 10] using an exponential curve. Another example is a plugin that needs to map parameter values to a set of choices, e.g. Sine, Cosine, Square, Sawtooth, etc...
With VST v2.4, Steinberg implemented vstxml for representing parameter data in XML. However, I find that the schema is not nearly rich enough to represent the wide range of VST parameter data. So I thought I'd take a stab at it myself. The end goal being one in which a plugin could read an XML file and configure its parameters accordingly.
The trouble is that I know very little about modeling data with XML. So I thought I'd throw out a couple of attempts and get some feedback, hopefully pointing me in the right direction.
Here's an example I came up with of a VST parameter represented in XML:
<parameter id="0" name="Waveform" type="selection">
<entry name="Sine"/>
<entry name="Cosine"/>
<entry name="Triangle"/>
</parameter>
The above declares a parameter with the id of 0, the name Waveform, and the type selection. The selection type indicates that the parameter represents a selection of choices. The entry element represents a choice.
A plugin parsing this would know to transform the normalized [0, 1] parameter value given to it by the host into an integer in the range of [0, 2], mapping each integer value to the appropriate element, e.g. a value of 0 would indicate the Sine waveform has been chosen.
Here's another example:
<parameter id="1" name="Level" curve="exponential" min="0" max="10" \>
This describes a parameter with an id of 1, the name Level, the curve exponential, and having the range of [0, 10].
A plugin parsing this would know to transform the normalized [0, 1] parameter value given to it by the host to a floating point number in the range of [0, 10] using an exponential curve (value * value * 10).
Does this seem to be a resonable approach?
|
|
|
|
|
is there any google webservice available to get the bulk geocoding? i need to get list of long/lat from the response
|
|
|
|
|
mkanna wrote: is there any google webservice available to get the bulk geocoding?
Welcome to CodeProject.com
Looks like you took a wrong turn in a router somewhere because I think you are looking for code.Google.com[^]
led mike
|
|
|
|
|
I'm trying to create a list containing subtypes of an abstract type in xml and validate it using an xml schema
I tried to use this as a schema but when i try to validate i get an error telling me that I cannot use transaction because it's marked abstract. Basically I'm trying to end up with a list that contains transaction nodes some of which are of type transaction1 and some are transaction2.
<pre><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="rootelement" type="docroot" />
<xs:complextype name="docroot">
<xs:sequence>
<xs:element name="transactions" type="transactions" />
</xs:sequence>
</xs:complextype>
<xs:complextype name="transactions">
<xs:sequence>
<xs:choice minoccurs="0" maxoccurs="unbounded">
<xs:element name="transaction" minoccurs="0" maxoccurs="unbounded" type="transaction" />
</xs:choice>
</xs:sequence>
</xs:complextype>
<xs:complextype name="transaction" abstract="true">
<xs:sequence>
<xs:element name="content" minoccurs="1" maxoccurs="1" />
<xs:element name="extracontent" minoccurs="0" maxoccurs="1" />
<xs:element name="noextracontent" minoccurs="0" maxoccurs="1" />
</xs:sequence>
<xs:attribute name="type" />
</xs:complextype>
<xs:complextype name="transaction1">
<xs:complexcontent>
<xs:restriction base="transaction">
<xs:sequence>
<xs:element name="content" minoccurs="1" maxoccurs="1" />
<xs:element name="extracontent" minoccurs="1" maxoccurs="1" />
<xs:element name="noextracontent" minoccurs="0" maxoccurs="0" />
</xs:sequence>
<xs:attribute name="type" fixed="1" />
</xs:restriction>
</xs:complexcontent>
</xs:complextype>
<xs:complextype name="transaction2">
<xs:complexcontent>
<xs:restriction base="transaction">
<xs:sequence>
<xs:element name="content" minoccurs="1" maxoccurs="1" />
<xs:element name="extracontent" minoccurs="0" maxoccurs="0" />
<xs:element name="noextracontent" minoccurs="1" maxoccurs="1" />
</xs:sequence>
<xs:attribute name="type" fixed="2" />
</xs:restriction>
</xs:complexcontent>
</xs:complextype>
</xs:schema></pre>
The code above is only for testing, I'm trying to get my head round how restriction etc works in schema.
Does anyone know how to do this?
Cheers,
Russell
|
|
|
|
|
From what I can see, you have a couple of problems:
* Everything is in lower-case, so complextype is not the same as the (correct) complexType. (This also applies to complexcontent/complexContent, etc)
* The complexType 'transactions' contains a sequence that contains a choice. You cannot limit a choice in this way. Here is the right way:
<xs:complexType name="transactions">
<xs:sequence >
<xs:element name="transaction" type="transaction" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
So I removed the choice to get it to work.
For reference, here is what the final schema looks like:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="rootelement" type="docroot" />
<xs:complexType name="docroot">
<xs:sequence>
<xs:element name="transactions" type="transactions" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="transactions">
<xs:sequence >
<xs:element name="transaction" type="transaction" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="transaction" abstract="true">
<xs:sequence>
<xs:element name="content" minOccurs="1" maxOccurs="1" />
<xs:element name="extracontent" minOccurs="0" maxOccurs="1" />
<xs:element name="noextracontent" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="type" />
</xs:complexType>
<xs:complexType name="transaction1">
<xs:complexContent>
<xs:restriction base="transaction">
<xs:sequence>
<xs:element name="content" minOccurs="1" maxOccurs="1" />
<xs:element name="extracontent" minOccurs="1" maxOccurs="1" />
<xs:element name="noextracontent" minOccurs="0" maxOccurs="0" />
</xs:sequence>
<xs:attribute name="type" fixed="1" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="transaction2">
<xs:complexContent>
<xs:restriction base="transaction">
<xs:sequence>
<xs:element name="content" minOccurs="1" maxOccurs="1" />
<xs:element name="extracontent" minOccurs="0" maxOccurs="0" />
<xs:element name="noextracontent" minOccurs="1" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="type" fixed="2" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Erik Westermann - wWorkflow.net - BizTalk Consulting Services
SOA * ESB * BPI * SaaS ... forget the alphabet soup - get the main course with our consulting services!
wWorkflow.net or +1 416-809-1453
|
|
|
|
|
Hi,
I have some variables
public string clientCase;
public string vmlCase;
public string caseDate;
public string caseType;
public string category;
public string testName = string.Empty;
public string comment;
public string orderdBy;
know i want to make a XML file from it using c#.net in this format.
<TestOrderd>
<CaseID> clientCase </caseID>
<Tests>
<Test>testname</test>
<Test>testname</test>
<Test>testname</test>
</Tests>
<Comments>comment</Comments>
<OrderOn>caseDate</OrderOn>
</TestOrder>
|
|
|
|
|
Use an xmldocument object and the createelement and appendchild methods to create your new elements and add them to the document tree.
you can output the contents of the xmldocument element using the xmldocument.xml method.
Russell
|
|
|
|
|
Check out the XmlSerializer class.
|
|
|
|
|
|
krishna, welcome to codeproject
Take the time to read this handy forum guidelines article[^]. Pay attention to item #6.
led mike
|
|
|
|
|
Hi All,
I have an unformatted xml string text which looks as below
<Value Name="Param1" Length="0" Type="System.Double">3</VALUE> <Value Name="Param2" Length="0" Type="System.Double">2</VALUE>
I want to read values from the above xml text. I have tried it to make it
XmlDocument object but it is giving error as illegal characters exist. Please give me advice how to read values from this text. If posible give me a small code snippet.
Thanks,
Aleem Mohammad.
NIIT technologies
abdul.aleem@niit-tech.com
|
|
|
|
|
This is not XML, therefore your question does not belong in this forum. Do you know why ? Do you know how XML is defined ?
1 - it has one root element
2 - it is case sensitive.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi, i need to convert a raw xml file into another xml file using xslt. I have no idea how to achieve the desire output. Can anyone provide an example? Thanks.
Input xml:
<root>
<header>
<row>
<entry>header</entry>
<entry>name1</entry>
<entry>result1</entry>
</row>
<row>
<entry>header</entry>
<entry>name2</entry>
<entry>result2</entry>
<entry>result22</entry>
</row>
<row>
<entry>reading</entry>
<entry>name3</entry>
<entry>result3</entry>
</row>
<row>
<entry>reading</entry>
<entry>name4</entry>
<entry>result4</entry>
<entry>result5</entry>
</row>
</header>
</root>
The final xml will be like this:
<root>
<header>
<row>
<name>name1</name>
<result>result1</result>
</row>
<row>
<name>name2</name>
<result>result2</result>
<result2>result2</result2>
</row>
</header>
<reading>
<row>
<name>name3</name>
<result>result3</result>
</row>
<row>
<name>name4</name>
<result>result4</result>
<value>result5</value>
</row>
</reading>
</root>
<div class="ForumMod">modified on Monday, August 25, 2008 11:25 AM</div>
|
|
|
|
|
Member 4703966 wrote: I have no idea how to achieve the desire output.
Anyone who is a beginner would be in that same situation. Rather than ask someone to do it for you, you should be learning the XML/XSLT technology, that's what a developer does.
Member 4703966 wrote: Can anyone provide an example?
There are many examples on the internet. Try the Top XML site and www.w3schools.com, both have great tutorials with sample/example code.
led mike
|
|
|
|
|
Since you voted my post down I guess that means you don't believe that as a developer you should learn the technology you need to work with.
Ok, good luck.
led mike
|
|
|
|
|
Hi All!
The advice I got from this forum in regards to using copy-of instead of value-of was excellent, my XSL is working almost perfectly, however there is one small problem.
This XSL:
<xsl:template match="/HTML/BODY//B">
<B ID="{@ID}" CLASS="{@CLASS}" TITLE="{@TITLE}" STYLE="{@STYLE}" DIR="{@DIR}" LANG="{@LANG}" ONFOCUS="{@ONFOCUS}" ONBLUR="{@ONBLUR}" ONCLICK="{@ONCLICK}" ONDBLCLICK="{@ONDBLCLICK}" ONMOUSEDOWN="{@ONMOUSEDOWN}" ONMOUSEUP="{@ONMOUSEUP}" ONMOUSEOVER="{@ONMOUSEOVER}" ONMOUSEMOVE="{@ONMOUSEMOVE}" ONMOUSEOUT="{@ONMOUSEOUT}" ONKEYPRESS="{@ONKEYPRESS}" ONKEYDOWN="{@ONKEYDOWN}" ONKEYUP="{@ONKEYUP}">
<xsl:copy-of select="."/>
</B>
</xsl:template>
Produces this output:
<B ONCLICK="" ONDBLCLICK="" ONMOUSEDOWN="" ONMOUSEUP="" ONMOUSEOVER="" ONMOUSEMOVE="" ONMOUSEOUT="" ONKEYPRESS="" ONKEYDOWN="" ONKEYUP="" ID="" CLASS="" TITLE="" STYLE="" DIR="" LANG="">
<B>
Hello World!
</B></B>
From this input:
<B>
Hello World!
</B><BR/>
The B tags are being duplicated due to my use of the "." Xpath syntax, however when I tried "child::*" the text inside all single level tags like:
<B>Hello World!</B>
is not displayed at all.
Can anybody suggest a soloution to this problem.
Thanks!
MrWolfy
|
|
|
|
|
Starting to feel sort of responsible for your project...
I'm not sure what the problem is this time though. What's the overall goal of your transformation?
Do you want to
a) copy all the B and EM tags of some HTML to a self defined XML( or HTML) structure,
or
b) reproduce a complete HTML with all B and EM tags having a set of attributes which may be missing in the original?
When a: what's your target structure?
When b: probably a little recursion is called for.
http://www.xmlplease.com/xsltidentity
might be a good link to start with.
|
|
|
|
|
Hi and Thanks!
Frank... Your help has been fantastic, clear and precise. If not for your help I'd still be trying to copy nodes with value-of .
The article you provided solved my problem completely and was exactly what I was looking for.
However there is just one more little nagging detail.
How would I only output attributes with a value, so that all attributes such as ONCLICK="" will not be displayed?
Thanks for all your help!
MrWolfy
|
|
|
|
|
In the article they suppress the id attributes with the help of a template
<xsl:template match="@id"/>
which matches them but does nothing.
I think you're looking for something like
<xsl:template match="@*[string-length(.)=0]"/>
Haven't tried it out though; could be faulty, but I hope you get the idea.
|
|
|
|
|
Hi and Thanks!
Thanks Frank! Problem solved, that template was just what I needed to complete my project!
Thanks Again!
MrWolfy
|
|
|
|
|
I have XML that I need to tranform to another structure of XML. The XML I need to transform is below:
<ArrayNode>
<Base>
<aa>1</aa>
<bb>text</bb>
<cc>
<ccc>
<cccc>text#1</cccc>
<cccc2>text#1</cccc2>
</ccc>
<ccc>
<cccc>text#2</cccc>
<cccc2>text#2</cccc2>
</ccc>
</cc>
<dd>text</dd>
</Base>
<Base>
<aa>2</aa>
<bb>text2</bb>
<cc>
<ccc>
<cccc>text#3</cccc>
<cccc2>text#3<cccc2>
</ccc>
<dd>text</dd>
</Base>
</ArrayNode>
This needs be tranformed to:
<ArrayNode>
<Base>
<aa></aa>
<bb></bb>
<cc>
<ccc>
<cccc>Text#1</cccc>
<cccc2>Text#1</cccc2>
</ccc>
</cc>
<dd></dd>
</Base>
<Base>
<aa></aa>
<bb></bb>
<cc>
<ccc>
<cccc>Text#2</cccc>
<cccc2>Text#2</cccc2>
</ccc>
</cc>
<dd></dd>
</Base>
<Base>
<aa></aa>
<bb><bb>
<cc>
<ccc>
<cccc>Text#3</cccc>
<cccc2>Text#3<cccc2>
</ccc>
<cc>
<dd></dd>
</Base>
</ArrayNode>
Wherever <ccc> exists, it needs to loop over each <ccc> and insert each individual <ccc> into the rest of the data for that <Base> group. So if there are 3 <ccc>'s, it should repeat the entire <Base> group and insert one of the <ccc> nodes.
Thanks in advance
|
|
|
|
|
Hi All!
After the success of the help I got on my earlier post I have run into another problem.
While all my tags now work anywhere in the document below the BODY tag, my xsl:value-of in my earlier post fails to output any tags below the first one, for instance:
<B>
<EM>
Hello World!
</EM>
</B>
Only Outputs:
<B ONCLICK="" ONDBLCLICK="" ONMOUSEDOWN="" ONMOUSEUP="" ONMOUSEOVER="" ONMOUSEMOVE="" ONMOUSEOUT="" ONKEYPRESS="" ONKEYDOWN="" ONKEYUP="" ID="" CLASS="" TITLE="" STYLE="" DIR="" LANG="">
Hello World!
</B>
The EM Tags are being ignored completely, and when the tags are swapped the B tags are ignored completely.
Does anyone know why this is happening, and if so, can anyone suggest a fix or workaround?
Thanks!
MrWolfy
|
|
|
|
|
Hi All!
It has just occurred to be that my original question could have been put far more simply:
How would I output unescaped HTML tags using the xsl:value-of element, I have tried disable-output-escaping="yes" but the html tags within are just ignored and seemingly not outputted at all.
Thanks!
MrWolfy
|
|
|
|
|
Have you tried copy-of instead of value-of?
|
|
|
|