|
brijbmishra wrote: Yes, Actually I am working in Microsoft Dynamics NAV.
Ah. You have taken a wrong turn in some router. This is a CodeProject.com forum not the Microsoft Dynamics NAV[^] forums which are located here.[^]
And for the record, you now have two posts and ZERO questions.
Good luck.
led mike
|
|
|
|
|
led mike wrote: you now have two posts and ZERO questions.
|
|
|
|
|
I need java code that convert xsd into xml file
|
|
|
|
|
Hi!
Perhaps someone can give me a push in the right direction?
I've got an XML file I want to validate using an XMLSchema. One of the elements has an attribute that can be optional if another attribute has a certain value and that is required in other cases.
Is there a way to include such conditions into an XSD or do I have to validate this condition manually?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Interesting question.
You are asking about something called a co-occurrence constraint. XML Schema does not directly support co-occurrence constraints, but it is an area some people are researching.
A researcher, Fabio Vitali, has done some work in this area and has come up with a solution that pre-processes a special file that results in a new XML schema. The new XML schema is then used to validate instance documents.
Here's the link http://tesi.fabio.web.cs.unibo.it/Tesi/SchemaPath[^] - click the link "SchemaPathImplementations" for the stylesheets and other files you'll need.
A much simpler approach is to validate this manually, but Fabio Vitali offers a way using XSL and XML Schema - which is pretty cool!
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
|
|
|
|
|
Great, thanks for the reply!
I'll take a look at the link.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
How do I generate a < symbol using <xsl:text>?
I have the following:
<xsl:text disable-output-escaping="yes">
a < b
</xsl:text>
but this would generate an error, (unexpected token)
If I use:
<xsl:text disable-output-escaping="yes">
a < b
</xsl:text>
the text that is generated is
a < b
what would I need to do to have
a < b
to be generated?
thanks
|
|
|
|
|
Hi!
Hmmm... the last code example you provided works fine for me.
But if you're sure you're doing everything else right, try changing your output type to HTML:
<xsl:output method="html"/>
Add this just below your xsl:stylesheet tag if you don't already have an output type, change it to "html" if you do.
It could work but I can't replicate your problem so I have no way to be sure.
Hope This Helps!
MrWolfy
|
|
|
|
|
You can always use a CDATA section if the & escape is causing problems.
|
|
|
|
|
Just use entity references: < > and &
It might be messy to go through an entire XML doc to convert values containing these special characters so, in the past, I used to just load the XML into a XML DOM object and then get it again - the DOM object does the conversion for you!
(ignore the HTML tags in my sig - I turned off HTML so that the entity references show up)
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,
While calling the validate method I am getting the following error while validating the XML:
<b>"Validate failed because the document does not contain exactly one root node."</b>
The XMLDOM object i am creating is Msxml2.DOMDocument.4.0
I am having only one root but don't know why this error
Here is my XSD:
<xsd:schema id="XSDSchemaTest" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="DriverDetails">
<xsd:sequence>
<xsd:element name="VendorURLPath" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="DriverCureServerURLPath" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="MD5" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="ProductName" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="DriverVersionInfo" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="ContentWriterInfo" type="xsd:string" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="Drivers">
<xsd:complexType>
<xsd:choice>
<xsd:element name="Driver" type="DriverDetails" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
And here is the XML :
<?xml version="1.0" encoding="UTF-8" ?>
<Drivers xsd:SchemaLocation="F:\kuldeep\ProjectWork\XMLExtractorMFC\XMLSchema.xsd">
<Driver>
<VendorURLPath123>http://www.yahoo.com</VendorURLPath123>
<DriverCureServerURLPath>http://www.yahoo.com</DriverCureServerURLPath>
<MD5>12345678</MD5>
<ProductName123>abcd</ProductName123>
<DriverVersionInfo>Version No 1.1</DriverVersionInfo>
<ContentWriterInfo>Made By Microsoft</ContentWriterInfo>
</Driver>
</Drivers>
Anyone Please let me know what can be problem with this.
Kuldeep
|
|
|
|
|
The schema location attribute in the root node is wrong, since you don't have a namespace in your instance. Here is an instance that works:
<Drivers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="F:\kuldeep\ProjectWork\XMLExtractorMFC\XMLSchema.xsd">
<Driver>
<VendorURLPath/>
<DriverCureServerURLPath/>
<MD5/>
<ProductName/>
<DriverVersionInfo/>
<ContentWriterInfo/>
</Driver>
</Drivers>
Also make sure that your schema actually exists at the specified location and is valid.
Here's some more information:
http://msdn.microsoft.com/en-us/library/ms256139(VS.85).aspx
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
|
|
|
|
|
i have this xml here, and now i would like to use xsl to transform into sql statement like this:
update OrderDetails set Quantity = 2 where OrderID = 10248 and ProductID = 11
Here is the XML document:
<Order ID="10248">
<OrderItem ProductID="11">
<QuantityIncrease>2</QuantityIncrease>
</OrderItem>
</Order>
Here is a bit i did:
<?xml version="1.0" encoding="UTF-8">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:input href ="WriteXMLToDBTest_Order.xml"/>
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:apply-templates select="Order"/>
</xsl:template>
<xsl:tempalte match="Order">
<xsl:text>update</xsl:text>
<xsl:value-of select="Order Details"/>
</xsl:tempalte>
</xsl:stylesheet>
as i am still new in this field, can someone guide me through?
Many thanks
|
|
|
|
|
AndieDu wrote: as i am still new in this field, can someone guide me through?
Make sure the Database product you are using does not have it's own facility to import XML before you go creating SQL statements, most of the major products support that.
led mike
|
|
|
|
|
sorry mate, i am not quite get what do you mean, in here actually i need a example
cheers
|
|
|
|
|
|
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.
|
|
|
|