|
Ummm - well, what are you trying to do with it? XPath is useful for querying an XML document, but does nothing for the performance of the raw parser.
Think about how you're going to get information in and out of the XML file, then make your technology decisions based on those specific requirements.Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Hi
Working with ArcGIS catalog for map files you can create an XML file which contains info about the map.My intention is to gather this data in a DB (PostGreSQL) and create a searching system.The main thing is that searching for the info I want to get as a result the map corresponding to this XML data I searched.Anybody have any clues and give me any orientation because I have little experience with XML.
Thank you in advance
Best regards
Endri
|
|
|
|
|
Maybe [this] XLINQ(LINQ to xml) tutorial will help you get the data from the XML file.
|
|
|
|
|
Rather than use a database (which might well not be a good match for hierarchical XML data), you could consider using XQuery[^]?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
I am getting the data in xml file(microsoft office xml) . data is updating in xml file continously
I parsed the xml file to get the data display in my own gui . I get the data but problem is that
data is not updating . I see the different data in xml file and my gui. as I click save button of xml file
my gui get updated data. why it is happening . can I read the updated data without clicking the save button
note that xml file is microsoft office xml
Trioum
|
|
|
|
|
Hi There
I am new to XML and related technologies.
I would like to know if it is possible to store media files within an XML file?
From what I know, most data stored within an XML file is textural based.
If one converts a database file, Excel sheet, etc. into an XML file, it simply stores this data in a textural format.
Does this mean that if I store an image (for example) within the XML file, it stores it as the textural representation of that image, or as a link to that image? Or is there a way of storing it within the XML file? (also, does the same apply to video, audio - mp3, midi, wav, etc, and all other media files)
Thanks in advance
|
|
|
|
|
Hi,
it is possible to store media files within an XML file. As you already mentioned the textual representation of the file will be stored. A media file is a binary representation of the media itself. This binary representation can be stored on a sheet of paper, a database or an XML file. I suggest that you convert the binary representation of the file into a base64 encoded string (use Convert.ToBase64String) and place that string in an XML element.
Let me know if you need further details.
Regards
Sebastian
|
|
|
|
|
Thanks for the advice...much appreciated.
I found a program that can convert an image to base64 string, and I can then embed this within the XML file.
I tried programming this myself in order to be able to convert files of any media format (images, audio, video, etc.)
I am kinda stuck trying to use the Convert.ToBase64String. I am trying to get an array of bytes from the image file to put in as a parameter for the Convert method.
The only array I can get from the image in the form of 'Guid' type.
Is the any other way of converting an image (and other files) to base64 string format?
|
|
|
|
|
|
Hi Again
I managed to get it working...both the conversion to XML and back to it's original file.
Thanks for the help...much appreciated!
|
|
|
|
|
I am writing a program that will be processing XML files. There are roughly 5 schemas involved. I should tell you now that I'm not using C# but a language called ABAP (SAP), although I think that's largely irrelevant.
The pseudocode for how this works is as follows:
OPEN FILE file AS TEXT.<br />
<br />
WHILE NOT EOF<br />
<br />
APPEND LINE OF file INTO xml_string.<br />
<br />
END.<br />
<br />
CALL TRANSFORMATION my_transformation USING xml_string INTO my_table.
Originally, there was just one schema and one transformation (a transformation is a small program in SAP that is used to take the XML string and turn it into something called an "internal table" - think of it as a DataTable for you C# developers).
Now that we've got different schemas, however, I need a way to know which one to call based upon the type of file. I've thought of two ways but if someone else has a better idea I'd love to know!
1) Use something in the filename to indicate the type of schema
2) Use an attribute in the root element to indicate the file type:
<envelope ftype='terminations'>
...
</envelope>
Unfortunately, with this approach I'd have to parse the first line of the file manually in my program as ABAP doesn't natively handle XML files very easily so it would be less work to do that. So, I'm leaning that way but I wanted a second opinion.
Thanks in advance.
|
|
|
|
|
Ummm - there are various ways of inidicating the schema in use - usually use of different namespaces, on eper schema. The namespace declaration attribute is generally on the root node of the document.
Alternatively, there is a specific namespace and set of attributes[^] that can be used to show what schema is in use.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Hi,
Apologies if this in the wrong place but its the first time I've posted.
I've got a problem using the .net XMLSerializer object. My experience of this is limited and I haven't worked with XML much. I'm trying to something like the following:
<Record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Property1>blah</Property1>
<oai_dc:dc xmlns:oai_dc=http:
<dc:Property2>asdsd</dc:Property2>
<dc:Property3>asdasasdda</dc:Property3>
</oai_dc:dc>
</Record>
however the best I can get at the moment is
<Record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<Property1>blah</Property1>
<oai_dc:dc>
<dc:Property2>asdsd</dc:Property2>
<dc:Property3>asdasasdda</dc:Property3>
</oai_dc:dc>
</Record>
The namespaces are being declared in the root element, not on the dc element as I would like.
I'm attaching the XMLSerializerNamespaces as follows:
Dim XMLNamespaces As New XmlSerializerNamespaces()
XMLNamespaces.Add("oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/")
XMLNamespaces.Add("dc", "http://purl.org/dc/elements/1.1/")
XMLNamespaces.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance")
XMLSerializer.Serialize(XMLWriter, inputObject, XMLNamespaces)
and the objects I'm using are shown below:
<XmlRoot("Record")> _
Public Class Record
<XmlElement("Property1")> _
Public Property1 As String
<XmlElement("dc", Namespace:="http://www.openarchives.org/OAI/2.0/oai_dc/")> _
Public DCMetadata As DublinCore
Public Sub New()
DCMetadata = New DublinCore()
End Sub
End Class
<XmlRoot("dc", Namespace:="http://www.openarchives.org/OAI/2.0/oai_dc/")> _
Public Class DublinCore
<XmlElement("Property2", Namespace:="http://purl.org/dc/elements/1.1/")> _
Public Property2 As String
<XmlElement("Property3", Namespace:="http://purl.org/dc/elements/1.1/")> _
Public Property3 As String
Public Sub New()
End Sub
End Class
Is there any way to force the XMLSerializer to output the namespace declarations against an element further down the line?
Thanks for any input,
Andy
modified on Wednesday, January 27, 2010 9:17 AM
|
|
|
|
|
Hi,
this might not the answer you expected, but what is wrong with the namespaces declared within the root element? Both xml are correct, and express the same.
Regards
Sebastian
|
|
|
|
|
Thanks for that, my limited knowledge of XML is the problem here. I have found a way to render the XML as I had intended though. This might be useful to someone else at some point...
Declare an XmlSerializerNamespaces object within the class to be serialized.
<XmlNamespaceDeclarations()> _
Public xmlns As XmlSerializerNamespaces
Then add the namespaces to this collection instead of attaching it to the serializer directly. This has the desired effect of declaring the namespace where it is used.
xmlns = New XmlSerializerNamespaces()
xmlns.Add("oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/")
xmlns.Add("dc", "http://purl.org/dc/elements/1.1/")
xmlns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance")
Andrew
|
|
|
|
|
Hello All,
It's about 4:25 EST and I got in around 7:30am EST. I have scoured the Web for a SIMPLE tutorial or example to send and receive(process) SOAP messages in C#. At this moment, I have not found any full descriptive examples/tutorials to satisfy my goal.
My goal is simple and not in need of anything fancy. I have a web service that requires a SOAP message to be passed to it and I require a response. The closet I have come is to recreate an app that get's the time off of EBay's server which was a paramount step. But when I try the same for my WebService, I receive an error "Malformed SOAP request, SOAP-ENV:Envelope element not found in root". My sniffer, did show that SOAP-ENV was not included in the message, indicating to me that I have to find a way to edit the message.
So, I am now forced to you, my last hope to assist me with accessing my goal. What I am looking for is a tutorial or code example (mostly complete) that would show me how to create a soap message (manually would be better in this case) send it and read the response. Simple (to you) but a monster to me.
Any and I mean any help will be greatly appreciated.
|
|
|
|
|
Hi,
how did you created the client? Could you post the code? I guess the problem is the namespace. SOAP-ENV is the prefix for the soap namespace in your message. Does the message contain a "xmlns:SOAP-ENV=..." in the first element (which should have the local name 'envelope'). Or better, post the request message from your sniffer.
Regards
Sebastian
|
|
|
|
|
Thanks Sebastian for the time:
Below is a snippet of the code that creates and calls the service (simply).
Below the code is the sniffer section that shows that there is no SOAP-ENV namespace. So I guess my guestion is, how can I create a user specified SOAP message.
O
int rprocess;
int rErrors;
int sampAdded;
int sampMod;
int sampDeleted;
int aliAdded;
int aliModified;
int aliDeleted;
int[] recSent = {'1'};
string[] reqNum = {"C0772014121"};
string[] sampType = {"BLOOD"};
string[] sampID = {"07720141210"};
DateTime[] inputDate = {Convert.ToDateTime("2009-10-15")};
DateTime[] inputTime = {Convert.ToDateTime("17:12")};
int[] aliID = {100050};
WebReference.Freezerworks service = new WebReference.Freezerworks();
service.Url = @"http://172.32.2.102:8081/Freezerworks/Update/";
try
{
service.TestUpdate("ffowler",
"garrett1",
"TestUpdate",
1,
"Time Change",
reqNum,
sampType,
sampID,
inputDate,
inputTime,
aliID,
out rprocess,
out rErrors,
out sampAdded,
out sampMod,
out sampDeleted,
out aliAdded,
out aliModified,
out aliDeleted);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
Console.ReadLine();
}
***************************************************************************************************
SNIFFER OUTPUT
<?xml version="1.0" encoding="UTF-8"?>
<env:Header xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"></env:Header>
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<tns:TestUpdate xmlns:tns="http://www.dwdev.com/Webservices/Freezerworks/">
<UserName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">ffowler</UserName>
<Password xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">garrett1</Password>
<UpdateServiceName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">TestUpdate</UpdateServiceName>
<RecordsSubmitted xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:int">1</RecordsSubmitted>
<AuditTrailOverallReason xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">Time Change</AuditTrailOverallReason>
<SampleID href="#id1"/>
<AliquotType href="#id2"/>
<AccessionID href="#id3"/>
<CollectionDate href="#id4"/>
<CollectionTime href="#id5"/>
<UniqueAliquotID href="#id6"/>
</tns:TestUpdate>
<soapenc:Array id="id1" soapenc:arrayType="xsd:string[1]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item>C0772014121</Item>
</soapenc:Array>
<soapenc:Array id="id2" soapenc:arrayType="xsd:string[1]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item>BLOOD</Item>
</soapenc:Array>
<soapenc:Array id="id3" soapenc:arrayType="xsd:string[1]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item>07720141210</Item>
</soapenc:Array>
<soapenc:Array id="id4" soapenc:arrayType="xsd:dateTime[1]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item>2009-10-15T00:00:00</Item>
</soapenc:Array>
<soapenc:Array id="id5" soapenc:arrayType="xsd:dateTime[1]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item>2010-01-26T17:12:00</Item>
</soapenc:Array>
<soapenc:Array id="id6" soapenc:arrayType="xsd:int[1]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item>100050</Item>
</soapenc:Array>
</soap:Body>
|
|
|
|
|
I am quite new to XSLT and I want to add unique index to elements types to transform something like this:
<item1>
<item2>
<item3></item3>
<item3></item3>
</item2>
<item2>
<item3></item3>
<item3></item3>
</item2>
</item1>
<item1>
</item1>
into:
<item1 id="1">
<item2 id="1">
<item3 id="1"></item3>
<item3 id="2"></item3>
</item2>
<item2 id="2">
<item3 id="3"></item3>
<item3 id="4"></item3>
</item2>
</item1>
<item1 id="2">
</item1>
I tried using position() but it counts based on context and not globally on document.
Thanx.
|
|
|
|
|
I have got the answer from daniweb (thanks fpmurphy) :
1. <?xml version="1.0"?>
2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
3. <xsl:output method="xml" indent="yes"/>
4.
5. <xsl:template match="/">
6. <xsl:apply-templates/>
7. </xsl:template>
8.
9. <xsl:template match="*">
10. <xsl:variable name="name" select="name()" />
11. <xsl:element name="{name()}">
12. <xsl:attribute name="id">
13. <xsl:value-of select="count(preceding::*[name()=$name]) + 1" />
14. </xsl:attribute>
15. <xsl:apply-templates />
16. </xsl:element>
17. </xsl:template>
18.
19. </xsl:stylesheet>
|
|
|
|
|
Hello Guys
I am new to XML. I have started reading XML few days back.
I have a question. Consider a table calling "Catalog" and has following
column names "book" , "author", "title", "genre", "price", "publish_date"
"description".
XML representation of Catalog Table
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
<catalog>
Compressed format of catalog table
<?xml version="1.0"?>
<Table = "catalog" enum{ book = 1, author = 2, title = 3, genre = 4, price = 5, publish_date = 6, description = 7}> </Table>
<catalog>
<1 id="bk101">
<2>Gambardella, Matthew</2>
<3>XML Developer's Guide</3>
<4>Computer</4>
<5>44.96</5>
<6>2000-10-01</6>
<7>An in-depth look at creating applications
with XML.</7>
</1>
<1 id="bk102">
<2>Ralls, Kim</2>
<3>Midnight Rain</3>
<4>Fantasy</4>
<5>6.96</5>
<6>2000-12-16</6>
<7>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</7>
</1>
<catalog>
So compressed format requires 20% less memory. I know that XML is user readable also. But while transferring huge XML data over the network, compressed format could improve the performance. And at the end (destination) we can decompress the compressed XML data.
So my question is Why cant we use compressed XML???
I have no idea about this. Please let me correct if i am wrong.
Thanks
Bipin Dalbhide
|
|
|
|
|
As I recall there is no need to change the XML structure, you can just zip (rar or whatever) the original file, send it and unzip it after (compressing algorithms are optimized for that)! For example I think that is what "new" Microsoft Word docx is all about.
|
|
|
|
|
we can zip compressed file.
|
|
|
|
|
I need a program in PHP which can extract the hidden biders from ebay.I will have to insert the item number and the program must show me all bidders of the auction and their emails.
Also the same program must extract the registered contact information for any specified bidder specially the email address
I will pay for this
If someone can help please contact me at totos_back@yahoo.com
Thanks
|
|
|
|
|
totolcm wrote: I need a program in PHP
And why you post in XML / XSL?
|
|
|
|
|