 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers, Chris Maunder
The Code Project Co-founder Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 4.40/5 (2 votes) |
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers, Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 4.40/5 (2 votes) |
|
|
|
 |
|
 |
Hi,my English is very poor and never write this is my document ,I have read it many times but can not find r some syntax and expression Errors
0 Introduction XML (eXtensible Markup Language) is an standards of important data exchange and data representation , with the development of Internet technology, more and more applications domain have regard storage formats and transmission media as their bodys , Great increase in the amount of information about XML,the needs of XML information query search technology also came into being, how to effectively achieve the XML document retrieval, automatic classify and clustering to become a hot issue in our current study ,
XML document itself often contain a lot of information, and such information is only belong to some limited numbers of categories of information structure model. so what we only concerned is that XML documents may contain more closely link to information structure. rather than the reality represent information itself in document, XML model consistent with the definition of XML documents and XML document models are usually much smaller than XML document,though XML document clustering we can achieved the XML structure clustering.while the key to XML model clustering is similarity,this context presents a model-based similarity algorithm,it cosider the element semantics and also level information in XML model , the further improve the calculation accuracy of the similarity,at the same time it can reduce the number of analyst document and simplify the the analysis process , small complexity and easy to selete the common XML model.
1 XML Model XML model is a recommended standands of W3C,which is responsible for definie and describe XMLdocument and content of the models, we can define XML Schema as document elements and elements which exit in the the relationship between the element and also can be attribute and data type, Can use a specific XML model to validate an XML document to verify that the XML document compliance with his request. XML model itself is an XML document, it is consistent with XML syntax structure, and can be expressed as a document tree, so we can deal with XML documents as the same way to deal with XML.
In XML model, the definition is the body of the model , elements of informations reflect the contents of the XML model, XML model similarity composed by the elements' similarity. On the other hand,
XML model constraint defines the data type, occurrences, and the logical relationship between elements, since constraints has little impact of similarity ,similarity calculation ignores the elements of similarity constraints will only consider the elements of the structure similarity, semantic similarity. It will be a large number of non-model XML document in the real world when calutate similarity of these documents, the primary way is how efficient and accurate to win XML documents schema information [3]. Many researchers a tool for automatically selete XML model to study and have a certain results, XTRACT, DDbE, DTD-Miner is automatic tools to selete XML document DTD; After the XML Schema standard , XStruct [4] is used to automatically selete XML Schema.
2 XML model similarity 2.1 Structure similarity General spealing, two document tree doc1 and doc2 contains the same elements of the similarity and more higher the more contained the same elements as little as lower similarity. By accounting the commom of two tree elements ratio of all the elements in this two can reflect the similarity, and the formula is as follows::
(1) Elements contained in the document tree merely reflects the similarity of the two of elements in the document tree similarity, but it does not reflect the level of relations between elements. In two document trees, only when the element that contains elements of similarity the larger and more similar to the level of relations between the two and the structure of XML model of the greater degree of similarity. so should also be considered the level information when calculating structure similarity,the element level similarity of the formula is as follows:
(2) Ei is the same element in document tree doc1 and doc2 but not ej, Level (ei) and Level (ej) refers to the elements ei and ej in the document tree in which level. In document tree, the tree level is the numbers of nodes that containd from the root to the leaf the longest route , the remained nodes followed by decreasing . the structure of the similarity formula is: (3) 2.2 Semantic Similarity
XML specification does not stipulate XML document element names and document structure must be defined by a DTD or Schema, the user can customize the XML document element names.for the description of semi-structured data bring users flexibility, on the one hand can also cause a different element names but the description of the contents of the same problem. If the comparison of their document structure element names arrive an exact match what it required, then the similarity of this two documents well be low, that's obviously unreasonable. so when calculating the similarity XML model should also consider the elements of semantic similarity.
When the element tag to be compared contains a compound words,first compound words divided into word sequences, removal of the stop words, if the Act_Number decomposed into Act and Number, create two document tree, including all the elements of the establishment of a label a collection of T1 and T2, by calculating these two sets of words to calculate the similarity of the semantic similarity of two document tree. Semantic similarity formlu as follows: (4) | T1 | and | T2 | refers to a collection of T1 and T2 contained in the number of words, SimSW (e1, e2) for the word e1 and e2 similarity. when calculation the word similarity, first use WordNet [5] to decide whether are synonymous , if success and its similaruty is0.8, or using the string to edit the distance caculate its similarity between the two words, this can reduce match errors and ensure accuracy (5) 2.3 XML model of similarity After all the consideration of elements in XML structure and semantic similarity, XML model similarity formula is: (6) α and β are adjustable parameters used to control the degree of structural and semantic information on the similarities'influence. since the formula results in the range from 0 to 1 , the result 0 says that these two model totally different , the result 1 is totally same
3 Algorithms and Experimental Comparative Analysis 3.1 Algorithm and experiment Description Former similarity of the formula corresponds to a specific algorithm is as follows:
3.2 Experimental Analysis Now the main calculation method of similarity between XML documents are elements comparative , comparative margination, edit distance method. Elements of comparative refers to the two XML documents by calculating the number of total elements in accounting for all the elements of these two documents to reflect the proportion of the number of the similarity between documents, also considing the elements in which level. Edge set of comparative is by calculating the two XML document tree in the same number of directed edges account for all of these two documents to the ratio of the number of edges to reflect the similarity between documents. Edit distance method is the use of edit-distance to measure similarity between two trees, its basic idea is the distance between the two trees is defined as the use of editing to achieve one tree to another tree the cost of conversion required . In this paper, XML document generation tool XMLGenerator generated 30 XML data sets, using a document as the base, respectively, using the algorithm proposed in this paper, as well as the above-mentioned elements of comparative law, comparative law margination, edit distance method to calculate the first document and other documents similarity of the experimental results as shown below. Figure 1 Similarity Comparison from Figure 1, elements of comparative and comparative edge , only consider the same side of the same element or elements or edges of all proportion with the actual conditions vary greatly, not suitable for comparative similarity. Edit distance method can to some extent, the degree of similarity reflects the document tree, but in some cases, the use of edit distance can not distinguish the difference between trees and trees can not accurately reflect the actual degree of similarity. And these three methods do not take into account the actual semantics of the elements, so the accuracy of calculating the similarity is not high. In this paper, algorithms, taking into account the structure and semantics of information, the calculated results better reflected the similarity of XML documents. 4 Summary This version presents a schema-based XML document similarity algorithm. Model is a represention of XML document structure, eliminating the XML document, said data on the specific information of things itself, so the size of XML documents is far less than the model of XML. Similarity between the computing model can reduce the number of documents and simplify the analysis of the analysis, complexity, small and easy to extract the common XML model. The algorithm combines the same time, the structure and semantics of XML model to carry out both the similarity computation can make a more accurate similarity calculations. This similarity of the proposed algorithm can also be used for XML Document Clustering, XML document structure extraction, XML document transformation test, etc., with good general applicability. The next step, according to similarity for document clustering and information retrieval is the focus of the study will continue.
modified on Monday, November 23, 2009 4:35 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Please lwt me know if is there any way for sending and collecting Xml files between computers in order to be inmediately processed by the receptor at the arrival.
Best Regards
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
FJJCENTU wrote: Please lwt me know if is there any way for sending and collecting Xml files between computers in order to be inmediately processed by the receptor at the arrival.
The most basic communication method is direct TCP or UDP using sockets. If this is between Windows systems you should be able to use WCF.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi friends,
I am newbie to xml, i am writing xml file using xmlTextWriter Class of System.Xml namespace. i am able to write the contents in to an xml file but the problem here is that i want to embed images in to xml file. right now i am using
<img src="path"/>
but this will give u the link but i want to embed images directly in to xml file
Please share ur ideas
Thanks in advance
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
You can Base64 encode the image and put the encoded string between the tags:
<img encoding="base64">Encoded string</img> Be aware that Base64 encoding causes an increment of the file size of about 33%, so you should only embed small images inside the XML.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
hi me too having the same problem and tried converting the image to base64. But still the image didn't displayed in the final Output.
I want display an image in xml Spreadsheet.any suggestions?
Thanks in advance.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
What is your problem? What language are you using? In C# it's simple to convert a byte[] to a base64 string:
string result = System.Convert.ToBase64String(source); Then you can assign the string to the InnerText property of your XmlElement.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Good Day
I have an XML attached in the following zipped file
and i read it like this in C# http://www.vbforums.com/attachment.php?attachmentid=74357&d=1258368852[^]
and i read it like this in C#
DataSet ds1 = new DataSet(); StringReader rdr = new StringReader(xmlstr.ToString()); ds1.ReadXml(rdr);
and i get the Following Error
'_Chairs' is an unexpected token. The expected token is '='. Line 1, position 545.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Vuyiswa Maseko wrote: and i get the Following Error
'_Chairs' is an unexpected token. The expected token is '='. Line 1, position 545.
Well it took me less than twenty seconds to find this token, plainly showing the syntax error. Did you try the same?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
i found the Problem. The name of the Attribute was Desks_&_Chairs
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I, I am trying to use XQuery on XML data and elaborated samples are few on the web. I only find small tutorials for beginners.
Here is the query specification : > it's a list of "vehicle"; > each "vehicle" has "flags" nodes; > each "vehicle" is identified by a unique numeric "id" attribute; > I want to find the lowest id verifying a list of flags ;
Here is a sample of data :
?xml version="1.0" encoding="UTF-8"? vehicles vehicle id="1" flags flag1/ flag2/ /flags /vehicle vehicle id="5" flags flag1/ flag2/ /flags /vehicle /vehicles
Here a sample of query on one flag :
(: smallest index index  let $d := doc( $inputDocument)//vehicle let $e := $d/flags/flag1 return min( $e/../../fn:number( @id))
How to process for several flags, with "and" and "or"....
Best regards
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi ,
In my web application(devloped using spring framework and purely java) i have to tranform the xml data (I am getting xml from 3rd party) into the RDBMS table records of my application. Structure of both XML and table is different so its not one to one mapping. Can anybody please tell me what's the best way to do that?
Regards Rishi Saraf
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello,
I want to know what is the xpath expression when there is a space in attribute name. e.g. /Employee/*[@Employee Name='name'] "Employee Name" is attribute name.
Thanks, Aniruddha
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
If you have spaces in element names or in attribute names, then what you have **IS NOT XML**. XML doesn't allow spaces in element or attribute names. See the specification for names[^] (which is used for element and attribute names) in the XML spec.
So therefore, your question can only be answered logically with this statement: get rid of the spaces form your attribute names.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
Aniruddha,
Just check the spec, there is no such thing as attribute names with spaces. Validation of a corresponding document should fail.
Best regrads,
Stefan
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Given the xml snippet below, I am trying to read the Company value. I have other code which will obtain the Network Policy Zone and the Default Gateway of a given system. Using these two values, zone first, then dfgw, I need to get the Company value which correspondes so it can be set as an environment variable in a remote windows system.
Here's my mess of code, and I'm afraid it is a mess because I've been trying different things:
Sub ReadXML() Dim attrValue, child1, child2, gChild1 getZone() WScript.Echo "Zone is: " & zone Set xDoc = CreateObject("Microsoft.XMLDOM") xDoc.async = False xDoc.load ("company.xml") Set Root = xDoc.documentElement Set NodeList = Root.getElementsByTagName(zone) Set child1 = xDoc.documentElement.firstChild Set child2 = child1.nextSibling Set gChild1 = child1.firstChild Do Until attrValue <> dfgw attrValue = xDoc.GetAttrValue("DFGW") WScript.Echo("DFGW Attribute Value is: " & attrValue) xDoc.nextSibling Loop company = gChild1.nodeValue("Company") WScript.Echo("Company Attribute Value is: " & attrValue) WScript.Echo("Default Gateway: " & dfgw) SetCompany(company) End Sub
Here's the XML I'm trying to read:
="1.0" - <ZoneList> - <Zone0> - <DFGW> "192.168.25.1" <Company>"CPC"</Company> </DFGW> - <DFGW> "142.101.230.1" <Company>"Test Company"</Company> </DFGW> - <DFGW> "" <Company>""</Company> </DFGW> - <DFGW> "" <Company>""</Company> </DFGW> - <DFGW> "" <Company>""</Company> </DFGW> </Zone0> - <Zone1>
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
XPath?
Here's some VBscript that uses XPath to select the nodes you want
Dim attrValue, child1, child2, gChild1 zone = "Zone0" dfgw = """192.168.25.1""" WScript.Echo "Zone is: " & zone WScript.Echo "dfgw is: " & dfgw Set xDoc = CreateObject("Microsoft.XMLDOM") xDoc.async = False xDoc.load ("a.xml") xpathString = "//" & zone & "/DFGW[text() = '" & dfgw & "']/Company" WScript.Echo xpathString
Set CompanyNodeList = xDoc.selectNodes(xpathString) WScript.Echo CompanyNodeList.Length
You just need to be sure that the string values are correctly escaped when building the query.
Also - why the quotes around the string values?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
i have xml file iam having c# application i need to 1-read xml file in c# abd pass it as parameter to sql server store procedure (parameter type xml) 2- use procedure have xml parameter to insert data into table
md_refay
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Not to put to fine a point on it, what is stopping you? I'm not seeing a question or a problem here, just a task you have to do.
If you are having problems with your code post the problem code and errors and we can help.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850)www.JacksonSoft.co.uk
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Firstly, if anyone could send me a link that explains everything that is allowed in XSD xpath expressions, I would be very grateful. I have searched for hours, and still have no idea what subset of xpath is allowed for either the selector or the field nodes. Great thanks to anyone who knows where I can find some documentation on this feature of xsd.
On to my problem... I am attempting to have an element, "parent", that contains a key attribute called "key". Every such element may have 0 or more child elements, called "Child", such that they contain a keyref attribute called "key" as well. I am wondering if there is a way to enforce through the XSD that the value of "key" for the child elements cannot be equivalent to the value of "key" for the parent node. So, for example:
<!-- XSD File -->
<xsd:element name="Example" type="ExampleType"> <xsd:key name="ParentKey"> <xsd:selector xpath="Parent"/> <xsd:field xpath="@key" /> </xsd:key> <xsd:keyref name="ChildKeyRef" refer="ParentKey"> <xsd:selector xpath="Parent/Child"/> <xsd:field xpath="@key" /> </xsd:keyref> </xsd:element>
<xsd:complexType name="ExampleType"> <xsd:sequence> <xsd:element name="Parent" type="ParentType" maxOccurs="unbounded"> <!----> <xsd:unique name="UniqueKeyRef"> <xsd:selector xpath=".|Child"/> <xsd:field xpath="@key" /> </xsd:unique> </xsd:element> </xsd:sequence> </xsd:complexType>
<xsd:complexType name="ParentType"> <xsd:attribute name="key" type="xsd:String" use="required"/> <xsd:sequence> <xsd:element name="Child" type="ChildType" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType>
<xsd:complexType name="ChildType"> <xsd:attribute name="key" type="xsd:String" use="required"/> </xsd:complexType> <-- XML File -->
<Example> <Parent key="A"> <Child key="B"/> <Child key="B"/> <!----> <!----> <Child key="A"/> <!----> </Parent> <Parent key="B"/> </Example> Hopefully this example has clearly illustrated my desire. Any number of children of Parent "A" can reference any other parent, including multiple children referencing the same parent (such as the two child elements referencing parent "B" in my example). Is there some way to rework my unique constraint, or by adding another constraint, such that these duplicates are allowed? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
modified on Tuesday, November 3, 2009 10:19 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Not sure if this answers your question ( I didn't read it all ), but I've always used this[^] when I need to do XSLT/XPath stuff.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
The Essential XML Quick Reference[^] is an excellent (and free) XML (+ XSD + XPath + XSLT) reference.
On page 349, it defines the available XPath selectors (I'd copy them here, but it disallows copying - grrrr).
However, I don't think you can do what you want with the 'unique' relation. The correctness 'uniqueness' set would be '..|.' using the Child element as the context node. But you can't do that with XML Schemas.
Using the Parent as context node, there's no way to define the uniqueness set, I don't think, as there are n sets, where n==number of Child nodes.
However - using Schematron[^], you can validate this rule using this Schema:
<schema xmlns="http://www.ascc.net/xml/schematron" > <pattern name="Check CHild/Parent keys"> <rule context="Child"> <assert test="@key!=../@key">Child key should differ from Parent key.</assert> <report test="@name">Child key should differ from Parent key.</report> </rule> </pattern> </schema>
This should be used in addition to a schema describing the basic structure of the XML. Using xmllint (which comes with libxml2), I can confirm that this Schematron schema meets your requirements.
XML files can be validated against Schematron schemas using an XSLT processor, so even if your XML parser doesn't have Schematron support, you can still use Schematron.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|