xml

XSLT Text Attribute as value for another element

With the XML below, I would like to know how to get the value of text in the case_id node as an attribute for the hidden input tag in the xsl sheet below. Is this possible? <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="data.xsl"?> <NewDataSet> <Cases> <Case> <case_id>30</case_id> ... ... </Case> </Cases> ...

Which one is better for schema to code generation, XMLBeans or JAXB?

Want to use a library for XML schema to code generation and wanted to know if people have a preference between XMLBeans and JAXB. Performance, Schema validation capability, Memory Usage.. Any indicators will help.. ...

Parsing XML with REGEX in Java

Given the below XML snippet I need to get a list of name/value pairs for each child under DataElements. XPath or an XML parser cannot be used for reasons beyond my control so I am using regex. <?xml version="1.0"?> <StandardDataObject xmlns="myns"> <DataElements> <EmpStatus>2.0</EmpStatus> <Expenditure>95465.00</Expenditure> ...

Write XML file (using XStream) to filesystem in Java

I need to be able to serialize a string and then have it save in a .txt or .xml file. I've never used the implementation to read/write files, just remember I am a relative beginner. Also, I need to know how to deserialize the string to be printed out in terminal as a normal string. ...

Filter XML based on another xml using XSLT 1

How do we filter an xml document based on another xml document. I have to remove all the elements which are not there in the lookup xml. Both the input xml and lookup xml has the same root elements, we are using XSLT 1.0. Ex Input <Root> <E1 a="1">V1</E1> <E2>V2</E2> <E3>V3</E3> <E5> <SE51>SEV1</SE51> <SE...

Can I use eclipse xml validator in a jsp?

I'm writing an application that outputs xml and I'm using a jsp to do it (in eclipse). It works fine, but the jsp editor complains about the xml tags. Is there a way to convince the jsp editor to validate xml instead of html? ...

Reading xml file from a resource

I am trying to load an xml file that is stored as a resource in my C# project so I can perform various LINQ queries. However at runtime an "Illegal characters in path" exception is thrown. This is how I am loading the file: XDocument doc = XDocument.Load(MyProject.Properties.Resources.XMLFile); ...

XML attribute ordering of namespaces

A related question to one I asked earlier... Just checking on something: Should the order of the xmlns, xmlns:xsi and xsi:schemaLocation attributes in an XML file matter? I'm finding that it does - at least when using XML Notepad 2007 to view the XML file. For example (assuming that my XML file is legal according to my schema) this gi...

Unzipping a file error

I am using the SharpZipLib open source .net library from www.icsharpcode.net My goal is to unzip an xml file and read it into a dataset. However I get the following error reading the file into a dataset: "Data at the root level is invalid. Line 1, position 1." I believe what is happening is the unzipping code is not releasing the file f...

xsl:for-each loop counter

How do I save the iterations that have occurred in an xsl:for-each? (variables in XSL are immutable) My goal is to find the MAX number of children for any node at a particular level. For example, I might want to print that there are no more than 2 Response nodes for any Question in this survey: <?xml version="1.0" encoding="ISO-8859-1...

XML editor with proper copy and paste?

I'm looking for an XML editor that lets me type and copy and paste arbitrary text into an XML element or attribute without requiring me to go back through and escape any characters that must use reserved XML entities (ampersands, angle brackets, or quote marks). XMLSpy came up short. ...

LINQ to XML Newbie Question: Returning Nodes Values AND Decendant Values

Greetings! I have some XML like this: <Root> <AlphaSection> . . . </AlphaSection> <BetaSection> <Choices> <SetA> <Choice id="choice1"> <Title>Choice 1 Title</Title> <Body>Choice 1 Body</Body> </Choice> <...

How to flatten this XML with XSLT

INPUT <logs> <logentry revision="648"> <author>nshmyrev</author> <date>2008-09-21T19:43:10.819236Z</date> <paths> <path action="M">/trunk/po/ru.pi</path> </paths> <msg>2008-09-21 Nickolay V. Shmyrev [email protected] * ru.po: Updated Russian translation.</msg> </logentry> <logentry revision="647"> <author>ckirbach</author> <date>2...

Best way to represt n/ depth tree for use in PHP (MySQL / XML / ?)

I am currently in the process of rewriting an application whereby teachers can plan curriculum online. The application guides teachers through a process of creating a unit of work for their students. The tool is currently used in three states but we have plans to get much bigger than that. One of the major draw cards of the application...

Any good XSLT tutorial/book/blog/site online?

Any recommendations? ...

Generating an XML file from a script

I've recently have a reason to include into our build script the creation of an XML configuration file. The most straightforward way I can think of to do this is to hard-code the XML content as a string into the script and then to simply create a file and write that XML string to the file (named appropriately etc). Is there a more elegan...

Best approach for passing XML to a webservice?

I have XML files in a directory that I wish to get over to a webservice on a server that will validate them and return a true/false as to whether they are valid in construct and values etc. Reason for server side processing is that the validation rules may change from time to time and need to adjust in one place as opposed to all client ...

RegExp in XSLT

Hi all! I need to parse Visual Studio automatically generated XML documentation to create a report. I decided to use XSLT but I'm very new to it and need help. Common template is: <doc> <members> <member name="F:MyNamespace"> <summary>Some text</summary> </member> </members> </doc> I want to isolate members with nam...

Binding XML in Sliverlight without Nominal Classes

Lets say I have a simple chunck of XML:- <root> <item forename="Fred" surname="Flintstone" /> <item forename="Barney" surname="Rubble" /> </root> Having fetched this XML in Silverlight I would like to bind it with xaml of this ilke:- <ListBox x:Name="ItemList" Style="{StaticResource Items}"> <ListBox.ItemTemplate> <...

Parsing XML with XPath in Java

I have a XML with a structure similar to this: <category> <subCategoryList> <category> </category> <category> <!--and so on --> </category> </subCategoryList> </category> I have a Category class that has a subcategory list (List<Category>). I'm trying to parse this XML file with XPath, but I can...