|
Hello All.
I have xml file which has several tables, there are several users who will be accessing this file, before i was locking the whole file so that others can just read it cannot edit. Now i want to lock only the particular table which a particular client is accessing and the rest of the tables are free to be edited .. Is this possible using C#.net ??
Thanks in advance
Ron
|
|
|
|
|
Ron.S wrote: Is this possible using C#.net ??
No, it's not possible using anything because it's just part of a file and File Systems don't provide that feature. At least none I have ever heard of.
led mike
|
|
|
|
|
No it's not possible to do this because the file system (NTFS) laks support for locking sections of files. AFAIK, there isn't a file system on this earth that supports this.
It sounds like you're treating an XML file as a small database, when in fact, you need full database support. It looks like in order to implement this requirement, you're going to have to rewrite your data access layer to use a full database, such as SQL Server Express or SQL Server Mobile.
|
|
|
|
|
I want to make a query that works like 'LIKE' in SQL
I want to retrive nodes that starts with 'X' or any starting string
Or containg 'X'
I write this XPath:
Message[Contains(@Title,'5')]
But it's wrong!!
how can I do??
plz help me
<code>
<Message MessageID="1" Title="Title1" Icon="Information" Buttons="Ok">
<Parts Part="part333333" />
<Parts Part="part333333" />
<Parts Part="part333333" />
</Message>
<Message MessageID="2" Title="Title2" Icon="Information" Buttons="Ok">
<Parts Part="part333333" />
</Message>
<Message MessageID="3" Title="Title3" Icon="Information" Buttons="Ok">
<Parts Part="part33XXXX3333" />
<Parts Part="YYpart53" />
</Message>
<Message MessageID="4" Title="Title4" Icon="Information" Buttons="Ok">
<Parts Part="YYpart53" />
</Message>
</code>
|
|
|
|
|
Masterhame wrote: how can I do??
Well you can only do what XPath supports. Also you might find that the latest XPath standards are not fully supported by many of the XPath implementations so you need to check the specific engine you are using to determine what standard it supports.
led mike
|
|
|
|
|
Hi,
I'm fairly new to using XML properly. I'm trying to write and XSD schema but I'm having trouble understanding namespaces.
Say my schema begins with...
< ?xml version="1.0"?>
< xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">
(without the spaces after the < signs)
and each element in the schema begins with < xs:whatever>
As I understand it, the xmlns:xs="" part identifies a source for what each of the fundamental identifiers mean, such as "element", "attribute", "simpleType", or whatever. targetNamespace="" identifies where the xsd i'm writing will be located, and xmlns="" identifies what the default namespace is (ie. if i dont put "xs:" at the beginning of things).
That's just my basic understanding that may be wrong. This is all very well, but what if the machine being used doesn't have an internet connection? How does it look up the basic types (element, attribute, etc)? Can I specify an offline source, maybe provided in Windows or the .NET framework (this is where I'm using the XML).
And once i've done this, how do I need to start an XML document that uses the schema (ie. what combination of "xmlns" things do i need to put in the root node tag?).
I realise I may have entirely missed the point of namespaces here. Any help would be greatly appreciated!
Thanks in advance!
Graeme
|
|
|
|
|
Hi all,
Assume we have 2 XML documents with the following contents:
1st
<vehicle type="car">
<doors>4</doors>
</vehicle>
2nd
<vehicle type="motorbike">
<wheels>2</wheels>
</vehicle>
Is there a way, to validate this 2 documents against a single XSD file, or I have to use seperate schemas? What I'm trying to accomplish is to determine each vehicle's elements according to vehicle's "type" attribute.
Thanks in advance,
|
|
|
|
|
Hello,
I am using a xml and xsd store data. My table will be very small no more than 10 rows.
However, I would like to start with zero records. However, I am finding I get an error with the following.
The ID element is auto incremented which is set and run time when the dataset reads the xsd schema.
My XSD:
<code>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="RedialNumbers">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="RecentNumber">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:unsignedInt" />
<xs:element name="Number" type="xs:string" />
<xs:element name="Name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</code>
My XML:
<code>
<?xml version="1.0" encoding="utf-8" ?>
<RedialNumbers>
<RecentNumber>
<ID></ID>
<Number></Number>
<Name></Name>
</RecentNumber>
</RedialNumbers>
</code>
However, I get a error under the </ID> attribute. "The 'ID' element is invalid - The value '' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:unsignedInt' - The string '' is not a valid UInt32 value."
However, If I add a <ID>0</ID> I don't get the error message. However, I get 1 row already created which is what I don't want. All the rows will be created and saved at run-time.
How is it possible to start off with a blank rows?
Many thanks for any suggestions,
Steve
|
|
|
|
|
i have loaded xml+xsl in html. but it only works for simple xml and xsl.when i have a large xml and slightly cmplex xsl and have dtd the code dosen't work.
here is the code for loading::
<title>
function loadXMLDoc(fname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation
&& document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}
function displayResult()
{
///////////////LOAD XML & XSL/////////////////
xml=loadXMLDoc("Book2006_Overview.xml");
xsl=loadXMLDoc("book2006.xsl");
// code for IE
if (window.ActiveXObject)
{
ex=xml.transformNode(xsl);
document.getElementById("example").innerHTML=ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation
&& document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}
can anyone send me the code works for all xml and xsl pls?
|
|
|
|
|
Member 4660724 wrote: the code dosen't work.
And you think we know what that means? Good luck
led mike
|
|
|
|
|
Do the xml namespaces in the more complex xml and those in the more complex xslt match? This often happens when moving from a test document to a real live one.
We can't see the problem unless you want to put up an example of the simple xml/xslt and then the more complex failing ones.
|
|
|
|
|
Hi,
the problem of loading xml+xsl is solved for mozilla.the problem was i ddin't know mozilla doesn't support external dtd.it works fine for internal dtd.But IE cannot load either external or internal.i used several alerts in several position.all are showed in output.but the transformed xml page does not show.
function loadXMLDoc(fname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
alert("LoadXML");
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation
&& document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}
function displayResult()
{
xml=loadXMLDoc("Book2006_Overview.xml");
xsl=loadXMLDoc("Book2006_manee.xsl");
// code for IE
if (window.ActiveXObject)
{
ex=xml.transformNode(xsl);
document.getElementById("example").innerHTML=ex;
alert("after innerHTML");
alert(ex);
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation
&& document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}
|
|
|
|
|
Hello together,
i wondered if there's a simple possibility to combine several xml schemata in one single file?
The schemas are connected using include-statements.
It would be nice instead of deploying several files at once to deploy just one.
I'm using Altova XML Spy 2008 for creating the schemas.
Thanks for any help!!
happy programming...
|
|
|
|
|
I’m a novice in XSD and not know some. I use MS Visual Studio 2005 to generate XML schema by dragging table from Server Explorer. Some column properties are not generated in xsd file. I want to add them but not know how to add them or whether they should be added or not. Pls help me.
1. I don’t know how to identify these column properties based on Microsoft SQL Server, in XML schema?
eg,
In SQL,
Create Table Employee(
EmpID int identity Not Null,
Constraint PK_Employee Primary Key (EmpID)
)
In XSD,
<xs:element name="“Employee”">
<xs:complex type="">
<xs:sequence>
<xs:element name="“EmpID”" type="“xs:int”/">
br mode="hold" />
2. In Sql, we can define variable length. But in xsd, there is no limit length. Is it all right?
Eg,
In sql,
EmpName varchar(20) Not Null
In xsd,
<xs:element name="”EmpName”" type="“xs:string”/">
3. How I can describe Derived attribute in XSD? Can I use DefaultValue?
Eg,
In sql,
Create Table Furniture(
FurnitureID smallint,
LowSize int,
HighSize int,
AvgSize As (LowSize + HighSize)/2
)
In xsd,
<xs:element name="“FurnitureID”" type="“xs:short”/">
<xs:element name="“LowSize”" type="“xs:int”/">
<xs:element name="“HighSize”" type="“xs:int”/">
<xs:element name="“AvgSize”" type="“xs:int”" msdata:defaultvalue="“(LowSize+HighSize)/2”/">
4. And also Default Constraint like below?
Eg,
State varchar(10) constraint DF_State Default ‘YK’
<xs:element name="“State”" type="”xs:string”" default="“YK”/">
Good Luck!
soclose
(oops xsd keyword are missed! why? )
modified on Monday, March 17, 2008 9:19 AM
|
|
|
|
|
Hi,
I'm wondering if anybody could help me with the following?
I have this XML:
<?xml version="1.0" encoding="utf-8"?>
<dataset xmlns="http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<!--
<dataset
xmlns="http://developer.cognos.com/schemas/xmldata/1/"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://developer.cognos.com/schemas/xmldata/1/ xmldata.xsd"
>
-->
<metadata>
<item name="Product type" type="xs:string" length="102"/>
<item name="Quantity" type="xs:int" precision="1"/>
</metadata>
<data>
<row>
<value>Binoculars</value>
<value>1075087</value>
</row>
<row>
<value>Climbing Accessories</value>
<value>5850251</value>
</row>
<row>
<value>Cooking Gear</value>
<value>13400351</value>
</row>
</data>
</dataset>
which I want to transform to the following using XSL (the number of row nodes is not fixed):
<?xml version="1.0" encoding="utf-8"?>
<data>
<row
ProductType="Binoculars"
Quantity="1075087"
/>
<row
ProductType="Climbing Accessories"
Quantity="5850251"
/>
<row
ProductType="Cooking Gear"
Quantity="13400351"
/>
</data>
Please notice that the metadata node (in the source XML) contains the names to be used in the resulting XML file as attribute names and that the name can contain one or more spaces (as indicated below in the name "Product yype").
<metadata>
<item name="Product type" type="xs:string" length="102"/>
<item name="Quantity" type="xs:int" precision="1"/>
</metadata>
Thank you very much in advance...
|
|
|
|
|
Hi! I want to know how is it possible to make a restriction the data to be just two letters, like the ISO code for the nation: UK, NL, FR??
Thanks ahead
|
|
|
|
|
yes, using regex-patterns:
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z]{2}"/>
</xsd:restriction>
|
|
|
|
|
|
Hi guys,
In C#, i have a
XmlNodeList nodelist1;
and another one (with different nodes form the same XmlDocument)
XmlNodelist nodelist2;
I want to combine these into 1 large XmlNodelist.
I tried the operators &= and +=, but neither works.
Can this be done
Life is what happens while you make other plans.
|
|
|
|
|
Not quite sure what your overall goal is but use the XML DOM API's to move nodes around or copy them etc.
XmlNode.CloneNode<br />
XmlNode.RemoveChild<br />
XmlNode.AppendNode
led mike
|
|
|
|
|
now i've a problem with the xml file....coz the main form from xml file is can open..but i want to show into gribview of the another form....but there's no way to do for me...
plz help me....i've already use this method (**)...when i use that method, there's no bind() function.... so im so
(**)
DataSet xml = new DataSet();
xml.ReadXml(ChooseFolder.filepath);
DataTable file = xml.Tables["file"];
gvXml.DataSource = file;
gvXml.(??????????)
ChooseFolder is the name of main form and filepath is file name;
|
|
|
|
|
Don't cross post, it's an abuse of the forum resources.
led mike
|
|
|
|
|
question as title.
thanks guys for helping
|
|
|
|
|
What do you mean reserve char? An entity?
Deserialize it to what?
Are you getting an error message? If so post it and the relevant code.
led mike
|
|
|
|
|
Hi there,
i create an Excel XML File with c#.
It works fine, but there is one problem left, that i cannot solve:
I can put strings with multiple lines in one single cell, but the autoheight funcion does not work!
I set it in the row-Tag (ss:AutoFitHeight="1"), but when a open the excel file, the cell has always the same height - if there is only a single line string in the cell or a multiline string.
Could you help me?
Bodo
|
|
|
|