XML - Determine Basic Types Of Elements And Attributes From Schema
Feb 17, 2011
I have given the local name of an element or attribute and the schema for the document. What is the easiest way to determine the basic datatype of the element or attribute. By basic datatype I mean the xs:string, xs:date etc. (The built in data types for the xml schema.) One of the problems I face is that it is rare for the elements type to be one of the basic built in types. 99% of the time it is a complex type that 50% of the time refers to another complex type that refers to another complex type and so on.
A simple Example for this schema: I want to find the basic type for Employee/Person/Name/LastName (determine that LastName is xs:normalizedString).
In the schema Employee is defined as an xs:element and type="bns:EmployeeType"
EmplyeeType has a Person element defined but it is type "PersonType" and then Name in person is NameType which is a complex type that extends GeneralName type that is type BasicNameType and that type finally defines the LastName which is of type "LastNameType" and on and on. There also definitions etc. I am currently writing a parser using linq-to-xml to get at this but it isn't easy or pretty. I have searched for other solutions and haven't found any but I fully admit my XML/schema/XPath ignorance. Is there an easy way to get the basic type for elements?
View 2 Replies
ADVERTISEMENT
Aug 20, 2009
I have a dataset which I am populating via an Oracle SQL query:
SELECT col_id, col_desc
FROM table_data;
Then I generate the dataset, via the function
Dim ds as New DataSet
OracleDataAdapter.Fill(ds)
Now, when I get the XML of the generated dataset via:
Dim strXML as String
strXML = ds.GetXML()
When I read/display the string, it is showing as follows:
<NewDataSet>
<Table>
<COL_ID>ABC001</COL_ID>[code]....
How would I be able to accomplish this? I would read the rows from the table in the dataset and construct the string?
View 2 Replies
Jul 26, 2009
I'm trying to create a treeview in a VB 2008 project that shows all the elements and attributes of an XML Schema.The MSDN documentation for XML schemas seems to imply that by loading the schema into an XMLSchemaSet and compiling it I should get access to all the elements and attributes with their values but this doesn't seem to work in practice.
Using a for loop such as:For Each elem As XmlSchemaElement In compiledSchema.Elements.Values
I can use elem.Name to get the element name (and attribute name with a similar nested loop) for a simple type but this doesn't work for a complex type.Whenever (and however) I try to get values for complex types I hit a brick wall.
[Code]...
View 1 Replies
Aug 28, 2009
I'm trying to write a class that will be in charge of persisting application options. Since the options need to be persisted the values that I'm sent must be serialisable.
Initially I thought I've be able to write a method with a signature like this[code]...
View 4 Replies
Jul 26, 2010
I'm trying to create a web site that users can log into and self serve their user information ie name, address etc. I've set up a SQL server DB with a couple of table holding the data and accessing those using Linq. I'm selecting specific data from my datacontext then trying to assign it to a label, ideally I want to assign the value to a class attribute so I can use the users details on multiple pages.
I've simplified the code (removing WHERE statement etc for the purposes of this question):
Using CurrentUserDataContext
As
New UserDataDataContext()
[Code].....
View 2 Replies
Jun 18, 2012
I'm trying to use the .Except() method to determine if all elements in one set are in another set. My code looks something like this: If someParts(0).Conditions.Except(selections).Equals(Nothing) Then ' Using the first element for testing. Console.WriteLine("All elements from conditions are in selections!") End If The expression seems to always return false. I assume it's probably a problem with what I expect .Except() to return in this case.
View 8 Replies
May 20, 2011
I'm a little foggy on System.Type versus an actual class type (like Object or XmlDocument) in .NET... will this code correctly determine if the type of a particular object is equal to a class I specify?
// Given "myObject" (unknown type), and some class type (let's say "MyClass")...
If myObject.GetType.Equals(MyClass)
If TypeOf(myObject) Is MyClass[code].....
Which one is correct? Bonus points if you can provide some information on what a class identifier is versus what a System.Type is. :)
Note: The language doesn't matter here, VB.NET or C# is fine, the code above is pseudocode.
View 2 Replies
Sep 3, 2009
I am having some trouble with an array full of data which I am trying to process. The data has been picked out of an Excel spreadsheet and contains items such as phone numbers. The problem is that when I drop this array back into a spreadsheet, Excel being clever, decides that some of the phone numbers are numbers and removes the "+" from the front.[code]...
I know that adding a ' in front of the + will remedy this. What I need to do is find out which of the numbers in the array are actually numbers and which have spaces/characters in them. IS there a quick way of doing this without having to search through each individual character of each array position?
View 6 Replies
Nov 10, 2010
I have two user controls that need to add a class atribute to the body tag of my page, however they currently over write one another if I just use Body.Attributes.Add("class","value") So I need to check if the class attribute exsists and if it already contains the value Im going to add.
If Not Body.Attributes("class").Contains("value") Then Body.Attributes.add("class", Body.Attributes("class") + " " + "value") End If
EDIT: The contain constraint doesnt return the expected value, resulting the the class not been concatinated, Example: add class "dog" then I a different instance of the same control tries to add "dog" but the contains("dog") returns false
View 1 Replies
May 14, 2011
I have created a simple app to display a digital clock, it can create child windows (dialog boxes) to do various chores, one of those chores involves a lengthy background task, so I create it in a modeless manner, so it doesn't block the main program. It all works well... kind of took me awhile to figure it all out, but there is one little cosmetic issue.
[Code]...
View 5 Replies
Feb 6, 2011
I'm looking for a reference that tells you the proper way to name form elements in Visual Basic.
View 1 Replies
Jun 27, 2012
I have a php web service that I can call from a php client. I need to call this web service from a vb.net application. When I try to add a reference to this web service I get this error:The root element of a W3C XML Schema should be <schema>here is the top of my wsdl file:
<?xml version="1.0"?>
<!-- partie 1 : Definitions -->
<definitions name="raidService"
[code].....
View 1 Replies
Nov 12, 2010
I am extending some of the basic data types in vb.net for a large application. This includes integer, string, short, etc. As it stands, my new data type objects have names like MYInteger and MYString. Since these are the only types I'm using for my application and they are mostly compatible with the default types, is there a way I can override the defaults with mine so when you Dim iThing as Integer you're actually using my slightly customized integer type?
View 3 Replies
Apr 13, 2010
Ok, basically, I need to know what the current hard drive letter that the current user is using, along with the user's name, followed by Music. When using the command prompt, we can use a simple code that is just %currentuser%Music but, I guess Visual Basic is a bit more complicated. Haha.
If you're curious why I need this, it is because I am making a program for my company to help backup our music and documents from their computers before we get new computers.
When using the code above in the command prompt in Windows, you would get something like: C:UsersRobertMusic, but this does not work for Visual Basic 2008.
My current operating system is Windows 7. I can supply more information if needed.
View 4 Replies
Dec 7, 2009
I am having problems with these questions... 4. Private Sub btnCompute_Click(...) Handles btnCompute.Click
[Code]...
View 2 Replies
Sep 29, 2010
Sweet candy store currently has a special offering of heart shaped candy. It comes in two sizes: small and large. The company sells the large one for $29.50 and the small for $16.25.Design an application to calculate how much a costumer owes. When the user clicks the "Calculate" button, the program gets the number of large and small chocolate hearts ordered from the textboxes, calculates and displays the extended price for each type of the chocolate in a label. The program also calculates the weight of the chocolate to determine the shipping cost, displays the total weight, the shipping cost and the final total due. The large chocolate weighs 4 pounds 10 ounces, and the small one weighs 2 pounds 14 ounces. Shipping cost is 35 cents per pound and 3 cents for each additional ounce. Display all dollar amounts except the final total due with 2 decimal places. Display the FINAL TOTAL DUE with a leading dollar sign and 2 decimal places. Be sure to also include a CLEAR button that will remove all inputs/outputs from the form, and an EXIT button. Define the CALCULATE button as the accept button and the EXIT button as the cancel button.
View 4 Replies
Jul 14, 2009
I'm trying to save what the user types in the vb code Dim user as Inputbox("") for example in a .txt file i can save the textbox and listbox but i cnt figure out how to save the inputbox i really need this to be saved the most.
View 7 Replies
Dec 9, 2009
I am using: (copied from the/about vb studio window:
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
[code].....
View 6 Replies
Sep 17, 2010
I created a method and pass the element type, id, and any inner text that instantiates a new html element. The last statement: Me.Controls.Add(element) adds it to the end of the page, but I would like it to be inserted in a specific position (between 2 divs within a form). What I am describing is very similar to this post on SO here, although it was for javascript.
View 1 Replies
Nov 1, 2009
I have a class with a Property called 'Value' which is of type Object.Value can be of any type, a structure, a class, an array, IList etc.My problem is with the setter and determining whether the value has changed or not.This is simple enough for value types, but reference types and lists present a problem.For a class, would you assume that the Equals method has been implemented correctly, or just assume that the value has changed every time the setter is called?If I did assume it's changed, then perhaps I should assume it for value types as well, so that the behaviour is consistent.
View 2 Replies
Jan 2, 2010
Dim Document = XDocument.Load(FileName)
Dim findElement = Document.Elements("GradeProfile")
[code]....
View 4 Replies
Jun 23, 2012
I need to compare two dictionary values if the types stored are equal, this is what i have
if gettype(Args(key)) = gettype(argtypes(key)) then
'' do something
end if
[Code]....
View 1 Replies
Oct 20, 2009
the schema is created using VS, but when I try creating the schema using XSD.exe, the validation works, am I missing something here, like namespace or anything?
SCHEMA:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="EmployeeXML" targetNamespace="http://tempuri.org/EmployeeXML.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/EmployeeXML.xsd"
xmlns:mstns="http://tempuri.org/EmployeeXML.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="NameType">
[Code]...
View 7 Replies
Jul 23, 2010
I have an imported sql database using pa as the schema instead of the default dboThe problem is when I go into vs 2008 and create a gridview control, it won't recognize the from table object. I get "invalid object name" unless I go directly into the code and put the database name and schema name in front of it.
View 5 Replies
Apr 21, 2010
I have written a small XML validator, that takes in an XML file and an XML schema and validates the XML files against that schema. It works well, except for an XML file, with this content:
[Code]...
View 1 Replies
Nov 18, 2010
I would like to take data, from a dataset, and parse it out in XML. but, i would want the XML to be based on a particular XSD schema. The dataset is being filled from a database (wich i have no problems doing).
View 1 Replies
Jul 21, 2009
Are there any commands that make life easy with respect to this? I want to take the column schema of one datatable (.net datatable) and copy it to another new datatable.
View 2 Replies
May 25, 2009
I want to move a table schema from one database to another using vb.net or c#. How can I do that?
View 1 Replies
Jul 27, 2011
I am using microsoft access 2003 and visualbasic.net. I am trying desperately to add a database using the wizard, and it lets me go through with it, testing the connection is good, but when I try to finish it gives me an error: "<customers>Could not retrieve schema information for table or view customers." What am I doing wrong? I've added databases in the past without this problem using the same Access.
View 12 Replies
Mar 31, 2011
How do I create a .xsd Schema file from a given .xml file programatically?
Is there a .NET class representing XSD.exe ?
View 4 Replies