|
If there is no root, you do not have a valid document. I think you are confusing the XML declaration with the root -- the root is the first element that is NOT the XML declaration...what you have posted -- is an XML schema fragment.
|
|
|
|
|
Consider the following XML file:
<handbook title="HangGlider">
<section title="Red Jewel 1:1" />
<section title="Red Jewel 1:2" />
<section title="Red Jewel 1:3" />
<section title="Red Jewel 1:4" />
<section title="Green Jewel 1:1" />
<section title="Green Jewel 1:2" />
<section title="Green Jewel 1:3" />
<section title="Green Jewel 1:4" />
</handbook>
<handbook title="WingRunner">
<section title="Red Jewel 1:1" />
<section title="Red Jewel 1:2" />
<section title="Red Jewel 1:3" />
<section title="Red Jewel 1:4" />
<section title="Green Jewel 1:1" />
<section title="Green Jewel 1:2" />
<section title="Green Jewel 1:3" />
<section title="Green Jewel 1:4" />
</handbook>
<handbook title="SkyStormer">
<section title="Red Jewel 1:1" />
<section title="Red Jewel 1:2" />
<section title="Red Jewel 1:3" />
<section title="Red Jewel 1:4" />
<section title="Green Jewel 1:1" />
<section title="Green Jewel 1:2" />
<section title="Green Jewel 1:3" />
<section title="Green Jewel 1:4" />
</handbook> I would like to lay the file out so that the repeated data only exists once, but can be shared by multiple handbooks. Is that possible?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Do you mean like this?
<handbooks>
<CommonSections>
<section title="Red Jewel 1:1" InBooks="1,2,3"/>
<section title="Red Jewel 1:2" InBooks="1,2,3"/>
<section title="Red Jewel 1:3" InBooks="1,2,3"/>
<section title="Red Jewel 1:4" InBooks="1,2,3"/>
<section title="Green Jewel 1:1" InBooks="1,2,3"/>
<section title="GreenJewel 1:2" InBooks="1,2,3"/>
<section title="Green Jewel 1:3" InBooks="1,2,3"/>
<section title="Green Jewel 1:4" InBooks="1,2,3"/>
</CommonSections>
<handbook id="1" title="HangGlider">
</handbook>
<handbook id="2" title="WingRunner">
</handbook>
<handbook id="3" title="SkyStormer">
</handbook>
</handbooks>
|
|
|
|
|
I am a total rookie so forgive my ignorance in advance.
I am (trying) to use XSLT to transform XML output from my Filemaker database so that I can re-import it (to synchronize the data after it has been copy-edited externally).
The whole business works fine with one exception. In the xml file, some text has visual tags such as <hi rend="italic"></hi>.
The xslt does not bring this tagging into the transformed file. I have tried using
<xsl:copy-of select="note"/> and
<xsl:value-of select="note"/>
either one of these brings the text perfectly, but not the <hi> tags.
ideas?
I'm using oXygen 12.2 and FMProAdvanced 11.
thanks!
|
|
|
|
|
Turns out "copy-of" was working, it was FMPro that is stripping the angle bracket tags out of the file on import. BAD Filemaker!
|
|
|
|
|
i have one xml and xsl and i am using javascript in xsl to load xml values like
<script type="text/javascript">
chars="<xsl:value-of select="//system-params/login/forbiddenChars" disable-output-escaping="yes" />;
Length = <xsl:value-of select="//system-params/login/Digits" disable-output-escaping="yes"/>;
</script>
and now i do not want to write above javaScript code in XSL and only want to include javascript by creating seperate file for javascript.
provide answers with exapmle by defining three (3) seperate file. i am begineer in this language.
modified 17-Sep-12 3:10am.
|
|
|
|
|
May be it can help you
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="//system-params">
<html>
<head>
<script type="text/javascript" src="YourJSfile.js" />
</head>
</html>
</xsl:template>
|
|
|
|
|
Actually i want to do like this as you mention in your answer but i am loadind XML values in javascript and this script is in XSL.
If i write above code in javascript file then i can not load xml values because these values dynamically loaded at the time of HTML generation.
|
|
|
|
|
Hi
I have XSL I created, that display output recieved from xml from Store Procedure.
My XSL has labels which are headings of columns, then for-each block for my output.
My output doesn't have to come belows my columns, I need to have something like this:
Column Value (first format)
-----------------
Name: Tom
Last Name: Brown
*NOT* (Second format)
-----
Name Last Name
Tom Brown
How do I display the output like in the first format, because my FOR-EACH clause in the xsl is the one taking data from Store Proc and displaying it.
|
|
|
|
|
Hi,
below my xml file
- <CateringOrders>
- <orders>
<userid>1</userid>
<orderid>DAK081012093349</orderid>
<Menu>Appetizers</Menu>
<MenuType>Veg</MenuType>
<Region>South-Indian</Region>
<Items>Vankaya Bajji</Items>
<Tray>Half Tray</Tray>
<Qty>12</Qty>
</orders>
- <orders>
<userid>2</userid>
<orderid>DAK081012093811</orderid>
<Menu>Appetizers</Menu>
<MenuType>Veg</MenuType>
<Region>South-Indian</Region>
<Items>Aloo Vada</Items>
<Tray>Half Tray</Tray>
<Qty>18</Qty>
</orders>
- <orders>
<userid>3</userid>
<orderid>DAK081012093811</orderid>
<Menu>Appetizers</Menu>
<MenuType>Veg</MenuType>
<Region>South-Indian</Region>
<Items>Vankaya Bajji</Items>
<Tray>Half Tray</Tray>
<Qty>20</Qty>
</orders>
</CateringOrders>
below auto increment code
Dim xmldoc As New XmlDocument()
Dim Str_XmlFile As String = ""
Str_XmlFile = Server.MapPath("~/CatOrders/") & "CateringOrder.xml"
If Not File.Exists(Str_XmlFile) Then
Dim StrWriter As New XmlTextWriter(Str_XmlFile, System.Text.Encoding.UTF8)
StrWriter.WriteStartDocument(True)
StrWriter.WriteStartElement("CateringOrders")
StrWriter.WriteEndElement()
StrWriter.Close()
End If
xmldoc.Load(Str_XmlFile)
Dim parentelement As XmlElement = xmldoc.CreateElement("orders")
Dim nodes As XmlNodeList = xmldoc.SelectNodes("//orders/userid")
Dim nNodeID As Integer = nodes.Count
nNodeID += 1
Dim userid As XmlElement = xmldoc.CreateElement("userid")
userid.InnerText = nNodeID
Dim orderid As XmlElement = xmldoc.CreateElement("orderid")
orderid.InnerText = Session("orderid")
please let me know how to get last unique id
|
|
|
|
|
I write in c#, but you should be able to use the xpath to get the last unique orderid from your xml.
static void Main(string[] args)
{
XmlDocument doc = new XmlDocument();
doc.Load(@"c:\temp\cateringorders.xml");
string query = "(//orderid[not(orderid=preceding-sibling::orderid)])[last()]";
XmlNodeList nodes = doc.SelectNodes(query);
foreach (XmlNode node in nodes)
{
Console.WriteLine(node.InnerText);
}
Console.WriteLine("Finished");
}
|
|
|
|
|
I used XSD.EXE to convert my schema to a C# class. The tool creates arrays to represent elements whose maxOccurs attribute is unbounded. Arrays are very limiting: you cannot add or delete items without a lot of shuffling.
Has anyone found a way around this limitation of arrays? For simple cases, I have converted the array to a List and back to an array, but that is only useful in the simplest of cases. Perhaps there is another tool that can convert my schema and use a list or some other suitable container (?).
|
|
|
|
|
There is no need for converting the list back to an array, you can replace it. I did that e.g. with GPX files (see also Bernie’s Trackviewer[^] where I use some more tricks for getting "nice" classes from an "ugly" XML schema).
|
|
|
|
|
I am not sure what you mean by "replace it." Do you mean change the implementation of the class produced by XSD.EXE?
My process is:
- convert class array to List (ToList())
- make my changes (add, delete, modify)
- assign back to class array (myList.ToArray)
|
|
|
|
|
Same basic question as the OP.
Looking at your source code it appears that you made manual changes to the generated files? And then fixed the actual serialization problem with XmlElementAttribute?
|
|
|
|
|
|
|
That is precisely what Collections are for -- to address the limitations imposed by fixed length arrays.
The limitation is not on arrays -- it appears to be on how willing programmers are to writing proper code, IMHO.
In C++, the standard library has some things for that, like vectors and maps, and in C# there are collections.
|
|
|
|
|
I think you do not understand the question.
The problem is that the tool (XSD.EXE) generates code that uses arrays. Arrays are limiting since it is difficult to add to or remove items from them. I was looking for another tool (that used a more appropriate collection) or an easy workaround.
Perhaps I could have phrased my question better. The limitation I mentioned was intended to mean that the tool generated arrays, not that of arrays themselves.
Even at this late stage, I appreciate your answer. However, I believe you misread the question.
|
|
|
|
|
I have the following two xml files:
<questionnaire>
<questionnaireid>1</questionnaireid>
<questionnairename>sample questionnaire</questionnairename>
<questions>
<question qid="1" >
<qid>1</qid>
<questiondesc>Q1) Enter some free text</questiondesc>
<typeid>2</typeid>
<required>1</required>
<parentquestion></parentquestion>
</question>
<question qid="2" >
<qid>2</qid>
<questiondesc>Q2) Select any of the choices</questiondesc>
<typeid>6</typeid>
<required>1</required>
<parentquestion></parentquestion>
<choices>
<choice>Choice1</choice>
<choice>Choice2</choice>
<choice>Choice3</choice>
</choices>
</question>
</questions>
</questionnaire>
<questionnaireresponse>
<questionnaireid>1</questionnaireid>
<userid>1234</userid>
<responses>
<response qid="1">
<answers>
<answer>This is some text</answer>
</answers>
</response>
<response qid="2">
<answers>
<answer>Choice 2</answer>
</answers>
</response>
</responses>
</questionnaireresponse>
How do you use xslt to add the response for this user to questionnare file and display as HTML form so in the above example the textbox will be populated with 'This is some text' and the dropdown will have 'Choice 2' selected?
Some example xslt implementing the above would be very helpful to get started. ideally I would like to do this in asp.net
|
|
|
|
|
Appreciate your suggestions to either a book, or an on-line site with tutorials, or whatever. I need to get up-to-speed (from a "cold start") quickly.
best, Bill
The glyphs you are reading now: are place-holders signifying the total absence of a signature.
|
|
|
|
|
Many thanks ! I don't know how I missed noticing that one, since Apress books have generally been very useful to me, and I thought I had searched their site.
best, Bill
It keeps me humble to think there's more bacteria in my gut than neurons in my brain, and that twenty trillion neutrinos pass through one hand a second, and that the average mattress contains 20 million bedbugs each of whom sh*ts once per hour.
|
|
|
|
|
trying to import xml into GPP. Converted .reg to xml but when I import I get the error:
<registry name="clsid=" "="">
An invalid or out of place input element was detected and will be ignored.
I've searched the xml file for that specific line and it doesn't appear. Any idea how to fix this?
|
|
|
|
|
Hi All,
I am trying to create Schema file for xml which looks like a General tree.
My xml will look like
<root>
<node name = "" >
<leaf name = "" value = "" />
</node>
</root>
A node can contain any number of node inside and it goes on.
like
<root>
<node name = "" >
<leaf name = "" value = "" />
</node>
<node name = "" >
<node name = "" >
<leaf name = "" value = "" />
<node name = "" >
<leaf name = "" value = "" />
</node>
</node>
</node>
</root>
Please advice how to create xsd file.
Thanks.
modified 14-Jun-12 13:47pm.
|
|
|
|
|