|
It is a very large file, thousands of entries, and xpath queries, reading every node, every attribute.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
If the xml files are going to be huge - I would recommend running few tests. I've heard about speed difference processing elements and attributes - but tests are necessary to find out if this applies to your particular xml parser.
From the design prospective - I prefer to use attribute (rather that element) if I fee that the entity is not going to evolve in future to contain sub-entities.
If your example I would make all entities as attributes, except "Action" which I feel might require children in future (e.g. action parameters).
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
Hi Igor
Thanks for the time you've spent on this and the suggestion for the action tag. This is currently text, the action is handled elsewhere and this just shows the latest action - but I agree. The action should be a node, with its own parameters
<Action type="request" actionedby="J Smith" />
Thanks again.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Hello there
I am new in XSL and want to know how to get the current date in XSL-FO to be printed on report. Also how to get the page numbers like
1 of 10 , 2 of 10, I am able to print the page number but with total pages is my requirement.
Rizwan Bashir
|
|
|
|
|
My xsl:fo is a little rusty. But, the total page numbers is done by placing a marker with a page-number in it at the end of your stream so that it appears on the last page. Then, in your header/footer, you can write the value of that marker using retrieve-marker and it will come out as the total number of pages.
Logifusion[^]
|
|
|
|
|
For the current date, I don't believe there's anything in FO for it. FO is pretty static once it's written, so you're left with what's available in XSL. It will depend on what version of XSL you're dealing with, but there are some date functions. You might be able to put current-date() in an XPath expression. If that doesn't work, you can embed some VBScript or JavaScript into the XSL.
Take a look here for what's in XPath: http://www.w3schools.com/xpath/xpath_functions.asp#context[^]
Logifusion[^]
|
|
|
|
|
can i share my database amount different websites through XML, but the access should be limited. solution would be implement in every environment so i be very thankfull for giving me this solution and if any other way to do this please share.
Thx to all
Zahid Manzoor
cell no.03335167615
Zahid
-- modified at 11:24 Tuesday 27th June, 2006
|
|
|
|
|
I am writing a service desk application. I have an XML file that a c# webservice accesses.
I have 2 tables inside an xml document. I can read from the xml without any problems but writing back to the file causes errors. Here is an sample of the file:
<code><?xml version="1.0" standalone="yes"?>
<ServiceDesk xmlns="http://tempuri.org/ServiceDeskData.xsd">
<ServiceCategory>
<category>
<id>1</id>
<type>Hardware - PC</type>
</category>
<category>
<id>2</id>
<type>Hardware - Printer / Scanner</type>
</category>
</ServiceCategory>
<ServiceRequest>
<Call>
<id>PBS00001</id>
<User>Test</User>
<Category>2</Category>
<Description>Some text</Description>
</Call>
<Call>
<id>PBS00002</id>
<User>Someone</User>
<Category>1</Category>
<Description>gbhjbgjhb</Description>
</Call>
</ServiceRequest>
</ServiceDesk></code>
ServiceDesk is the root element and then ServiceCategory and ServiceRequest are the tables holding the data. The problem occurs when i try to write back a Call to the Service Request Table. If i write to the ServiceRequest table it says that the item (a string array of 4) is too big, and if i write to the Call table it puts it outside the </ServiceRequest> element which breaks the schema. Could anybody give me some suggestions?
The c# code i use is:
<code>
DataSet d = new DataSet();
d.ReadXml("http://localhost/ServiceDeskWS/ServiceDeskData.xml");
String [] s = new String[4];
s[0] = assignID();
s[1] = User;
s[2] = Category;
s[3] = Description;
d.Tables["Call"].Rows.Add(s);
d.WriteXml(Server.MapPath("ServiceDeskData.xml"));</code>
Thanks
-- modified at 9:10 Monday 26th June, 2006
|
|
|
|
|
Hi
I want to simply swap two attributes of different nodes over but can't seem to 'write' to the xml doc..
int swapPos1 = 8;
int swapPos2 = 9;
System.Xml.XPath.XPathDocument xml = new System.Xml.XPath.XPathDocument("myxml.xml");
System.Xml.XPath.XPathNavigator xmlNav = xml.CreateNavigator();
System.Xml.XPath.XPathExpression expr = xmlNav.Compile("/Tabs/Tab");
expr.AddSort("@position", System.Xml.XPath.XmlSortOrder.Ascending, System.Xml.XPath.XmlCaseOrder.None, "", System.Xml.XPath.XmlDataType.Text);
System.Xml.XPath.XPathNodeIterator iterator = xmlNav.Select(expr);
while (iterator.MoveNext())
{
int pos = int.Parse( iterator.Current.GetAttribute("position", "").ToString() );
if (pos == swapPos1)
{
iterator.Current.MoveToAttribute("position" , "");
iterator.Current.SetTypedValue( swapPos2.ToString() );
continue;
}
if (pos == swapPos2)
{
iterator.Current.MoveToAttribute("position", "");
iterator.Current.SetTypedValue ( swapPos1.ToString());
continue;
}
}
The SetTypeVAlue throws - not supported' exception. Basically, I want to swap the position attribute of two nodes.
Any help much appreciated. Not just new to XML, but to C# as well!
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
XPath is read only - doh!!!
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
to be more precise - XPathNavigator created by XPathDocuments are readonly (for performance reasons). However you might create XPathNavigator by XmlDocument.
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
hi..
I wanted to know that how to add constraints and restriction to xml schema?
thanks
|
|
|
|
|
can we convert from one structure of code to different one using xml technology...
suppose:
assembly code in xml form to c cod like in xml form
if its possible pls suggest me which xml technologies i should be looking into
thanx..
|
|
|
|
|
Hi, I have a windows application that calls a web service. Web service returns a string response like
<?xml version="1.0" encoding="utf-16"?>
<v1:ABCMerchant v1:tcid="11111" xmlns:v1="http://abc/2005/response">
<v1:ABCs>
<v1:ABC v1:ID="1" />
<v1:ABC v1:ID="2" />
</v1:ABCs>
</v1:ABCMerchant >
I have to parse this string and get the values returned in <v1:ABC V1:ID="1"
<v1:ABC v1:ID="2" /> etc.
Number of ids returned by web service will depend on ABC number being passed. if user passed let's say 10 as ABC number then 10 ID's will be returned with string <v1:ABC v1:ID="1" /> repeated 10 times with separatge Unique ID in each string.
I want to retrive these values from the string that I have up in this message.
How can I do that. Also, I am using vb.net. I would appreciate code sample in vb.net etc.
Thanks
Needy
|
|
|
|
|
Take the string that you get back and turn it into an XmlDocument:
Dim s as String = ...
Dim doc as XmlDocument = New XmlDocument()
doc.LoadXml(s)
The difficulty is in the namespace. You have to take a few extra steps to do an XPath:
Dim xnm as XmlNamespaceManager
xnm = new XmlNamespaceManager(doc.NameTable)
xnm.AddNamespace("v1", "http://abc/2005/response")
Dim nodes as XmlNodeList
nodes = doc.SelectNodes("//v1:ABCs/v1:ABC", xnm)
This gives you a collection of the "v1:ABC" nodes. Run that code and you'll see that nodes.Count is equal to the number of those "v1:ABC" nodes.
Logifusion[^]
|
|
|
|
|
it is giving me a null reference exception.
when i get a count on nodes selected, it gives me number of nodes correctly. However, when i try to loop through the node list i am not able to get the values of the nodes
Dim xNode As XmlNode
Dim ValuesString As String
For Each xNode In nodes
ValuesString = xNode.Attributes.GetNamedItem("v1:ABC").Value Next
I will want to receive these values and store them in database
Please let me know what is wrong with my code.
Line in bold is is where i am getting null reference exception.
Thanks
Needy
|
|
|
|
|
Instead of "v1:ABC", you should be asking for the attribute "v1:ID". That's the name of the attribute.
Logifusion[^]
|
|
|
|
|
I just found that out while debugging.
thank you so much for your response.
Out of curioucity, can I automatically fill up a datatable or dataset out of it? Because I will be calling a stored procedure to update the database with the ID values pulled from the xml string.
thanks a lot for your response.
I was stuck on this issue for a long time.
Thanks
Needy
-- modified at 16:38 Thursday 22nd June, 2006
|
|
|
|
|
Yes, you can create a DataSet off of the same string:
Dim ds As DataSet = New DataSet()
ds.ReadXml(New StringReader(s)) Where "s" is the string again. StringReader is in the System.IO namespace.
Just use the debugger to examine the contents of the DataSet . You'll see tables in there matching the XML elements.
|
|
|
|
|
<?xml version="1.0" encoding="utf-16"?>
<v1:ABCMerchant <b>v1:tcid="11111"</b> xmlns:v1="http://abc/2005/response">
<v1:ABCs>
<v1:ABC v1:ID="1" />
<v1:ABC v1:ID="2" />
</v1:ABCs>
</v1:ABCMerchant >
Hi, Dustin. I learned how to deal with node lists from your posts yesterday.
I apprecidate your help. I need to get the value in <b> </b> which is basically
v1:tcid="11111", Please shed the light again.
Thanks
Needy
|
|
|
|
|
Well, v1:ABCMerchant is your document element. You could either ask for the document element, or search for it with XPath.
doc.DocumentElement.Attributes("v1:tcid") -or- doc.SelectSingleNode("ABCMerchant", xnm).Attributes("v1:tcid")
You should do some reading up on XPath: http://www.w3schools.com/xpath/default.asp[^]
Logifusion[^]
|
|
|
|
|
i have a nested xml file and want this data in my database. but i read this xml file with the help of dataset
dataset.readxml("file path")
i got a error message
The same table (recordset) cannot be the child table in two nested relations.
I just want yo know how we manage this parent child relationship.
|
|
|
|
|
This is just the way that DataSets work. Let's say you have this XML:
<Company>
<Address>
...
</Address>
</Company>
<Customer>
<Address>
...
</Address>
</Customer>
This will throw an error because Address cannot be a child of both Company and Customer. You could change the table name from Address to Company_Address and Customer_Address and that will work.
Logifusion[^]
|
|
|
|
|
Hi,
iam new to xml.I have a xml document where i have to search for a string or keyword and display it in a datagrid.Plz help me
Regards,
david Boon.
|
|
|
|
|
When using DOM to process an XML file, I need to get hold of the attributes when present. Now I can get hold of them if I know there names, but what about when I do not know the attribute names?
Set objAttributes = objDOMNode.Attributes<br />
<br />
'check that there are attributes.<br />
If objAttributes.length > 0 Then<br />
<br />
'we know that we've named our id reference as<br />
''PERSONID', therefore tell the NameNodeListMap to get<br />
'this node by using the getNamedItem method<br />
Set objAttributeNode = objAttributes.getNamedItem("PERSONID")<br />
<br />
'store this value in the tag of the treeview<br />
tvwElement.Tag = objAttributeNode.nodeValue<br />
End If
The above code is OK for when you know the attribute name, but its the case when you dont know the number and names.
Any suggests please.
|
|
|
|